@@ -32,9 +32,6 @@ struct uac_req {
32
32
struct uac_rtd_params {
33
33
struct snd_uac_chip * uac ; /* parent chip */
34
34
bool ep_enabled ; /* if the ep is enabled */
35
- /* Size of the ring buffer */
36
- size_t dma_bytes ;
37
- unsigned char * dma_area ;
38
35
39
36
struct snd_pcm_substream * ss ;
40
37
@@ -90,6 +87,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
90
87
int status = req -> status ;
91
88
struct uac_req * ur = req -> context ;
92
89
struct snd_pcm_substream * substream ;
90
+ struct snd_pcm_runtime * runtime ;
93
91
struct uac_rtd_params * prm = ur -> pp ;
94
92
struct snd_uac_chip * uac = prm -> uac ;
95
93
@@ -111,6 +109,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
111
109
if (!substream )
112
110
goto exit ;
113
111
112
+ runtime = substream -> runtime ;
114
113
spin_lock_irqsave (& prm -> lock , flags );
115
114
116
115
if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK ) {
@@ -147,29 +146,31 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
147
146
spin_unlock_irqrestore (& prm -> lock , flags );
148
147
149
148
/* Pack USB load in ALSA ring buffer */
150
- pending = prm -> dma_bytes - hw_ptr ;
149
+ pending = runtime -> dma_bytes - hw_ptr ;
151
150
152
151
if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK ) {
153
152
if (unlikely (pending < req -> actual )) {
154
- memcpy (req -> buf , prm -> dma_area + hw_ptr , pending );
155
- memcpy (req -> buf + pending , prm -> dma_area ,
153
+ memcpy (req -> buf , runtime -> dma_area + hw_ptr , pending );
154
+ memcpy (req -> buf + pending , runtime -> dma_area ,
156
155
req -> actual - pending );
157
156
} else {
158
- memcpy (req -> buf , prm -> dma_area + hw_ptr , req -> actual );
157
+ memcpy (req -> buf , runtime -> dma_area + hw_ptr ,
158
+ req -> actual );
159
159
}
160
160
} else {
161
161
if (unlikely (pending < req -> actual )) {
162
- memcpy (prm -> dma_area + hw_ptr , req -> buf , pending );
163
- memcpy (prm -> dma_area , req -> buf + pending ,
162
+ memcpy (runtime -> dma_area + hw_ptr , req -> buf , pending );
163
+ memcpy (runtime -> dma_area , req -> buf + pending ,
164
164
req -> actual - pending );
165
165
} else {
166
- memcpy (prm -> dma_area + hw_ptr , req -> buf , req -> actual );
166
+ memcpy (runtime -> dma_area + hw_ptr , req -> buf ,
167
+ req -> actual );
167
168
}
168
169
}
169
170
170
171
spin_lock_irqsave (& prm -> lock , flags );
171
172
/* update hw_ptr after data is copied to memory */
172
- prm -> hw_ptr = (hw_ptr + req -> actual ) % prm -> dma_bytes ;
173
+ prm -> hw_ptr = (hw_ptr + req -> actual ) % runtime -> dma_bytes ;
173
174
spin_unlock_irqrestore (& prm -> lock , flags );
174
175
175
176
exit :
@@ -251,11 +252,8 @@ static int uac_pcm_hw_params(struct snd_pcm_substream *substream,
251
252
252
253
err = snd_pcm_lib_malloc_pages (substream ,
253
254
params_buffer_bytes (hw_params ));
254
- if (err >= 0 ) {
255
- prm -> dma_bytes = substream -> runtime -> dma_bytes ;
256
- prm -> dma_area = substream -> runtime -> dma_area ;
255
+ if (err >= 0 )
257
256
prm -> period_size = params_period_bytes (hw_params );
258
- }
259
257
260
258
return err ;
261
259
}
@@ -270,8 +268,6 @@ static int uac_pcm_hw_free(struct snd_pcm_substream *substream)
270
268
else
271
269
prm = & uac -> c_prm ;
272
270
273
- prm -> dma_area = NULL ;
274
- prm -> dma_bytes = 0 ;
275
271
prm -> period_size = 0 ;
276
272
277
273
return snd_pcm_lib_free_pages (substream );
0 commit comments