diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-02-28 01:43:30 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 17:54:26 -0400 |
| commit | 68dc3dde0213c0560b6117998088f3e992934d37 (patch) | |
| tree | d8842af6dcdca6830b0a3fbcf1f7db7ee01da78b | |
| parent | ce9b490cbf1cffa988fce64e6ff824bdd241d87e (diff) | |
Staging: line6: fix checkpatch errors in pcm.c
Lots of warnings also fixed up.
Cc: Markus Grabner <grabner@icg.tugraz.at>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | drivers/staging/line6/pcm.c | 100 |
1 files changed, 60 insertions, 40 deletions
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c index 489d398e65bb..fc4113f33159 100644 --- a/drivers/staging/line6/pcm.c +++ b/drivers/staging/line6/pcm.c | |||
| @@ -34,12 +34,13 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 34 | clear_bit(BIT_PREPARED, &line6pcm->flags); | 34 | clear_bit(BIT_PREPARED, &line6pcm->flags); |
| 35 | 35 | ||
| 36 | snd_pcm_group_for_each_entry(s, substream) { | 36 | snd_pcm_group_for_each_entry(s, substream) { |
| 37 | switch(s->stream) { | 37 | switch (s->stream) { |
| 38 | case SNDRV_PCM_STREAM_PLAYBACK: | 38 | case SNDRV_PCM_STREAM_PLAYBACK: |
| 39 | err = snd_line6_playback_trigger(s, cmd); | 39 | err = snd_line6_playback_trigger(s, cmd); |
| 40 | 40 | ||
| 41 | if(err < 0) { | 41 | if (err < 0) { |
| 42 | spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); | 42 | spin_unlock_irqrestore(&line6pcm->lock_trigger, |
| 43 | flags); | ||
| 43 | return err; | 44 | return err; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| @@ -48,15 +49,17 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 48 | case SNDRV_PCM_STREAM_CAPTURE: | 49 | case SNDRV_PCM_STREAM_CAPTURE: |
| 49 | err = snd_line6_capture_trigger(s, cmd); | 50 | err = snd_line6_capture_trigger(s, cmd); |
| 50 | 51 | ||
| 51 | if(err < 0) { | 52 | if (err < 0) { |
| 52 | spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); | 53 | spin_unlock_irqrestore(&line6pcm->lock_trigger, |
| 54 | flags); | ||
| 53 | return err; | 55 | return err; |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | break; | 58 | break; |
| 57 | 59 | ||
| 58 | default: | 60 | default: |
| 59 | dev_err(s2m(substream), "Unknown stream direction %d\n", s->stream); | 61 | dev_err(s2m(substream), "Unknown stream direction %d\n", |
| 62 | s->stream); | ||
| 60 | } | 63 | } |
| 61 | } | 64 | } |
| 62 | 65 | ||
| @@ -65,7 +68,9 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 65 | } | 68 | } |
| 66 | 69 | ||
| 67 | /* control info callback */ | 70 | /* control info callback */ |
| 68 | static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { | 71 | static int snd_line6_control_info(struct snd_kcontrol *kcontrol, |
| 72 | struct snd_ctl_elem_info *uinfo) | ||
| 73 | { | ||
| 69 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 74 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
| 70 | uinfo->count = 2; | 75 | uinfo->count = 2; |
| 71 | uinfo->value.integer.min = 0; | 76 | uinfo->value.integer.min = 0; |
| @@ -74,23 +79,27 @@ static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
| 74 | } | 79 | } |
| 75 | 80 | ||
| 76 | /* control get callback */ | 81 | /* control get callback */ |
| 77 | static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { | 82 | static int snd_line6_control_get(struct snd_kcontrol *kcontrol, |
| 83 | struct snd_ctl_elem_value *ucontrol) | ||
| 84 | { | ||
| 78 | int i; | 85 | int i; |
| 79 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 86 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
| 80 | 87 | ||
| 81 | for(i = 2; i--;) | 88 | for (i = 2; i--;) |
| 82 | ucontrol->value.integer.value[i] = line6pcm->volume[i]; | 89 | ucontrol->value.integer.value[i] = line6pcm->volume[i]; |
| 83 | 90 | ||
| 84 | return 0; | 91 | return 0; |
| 85 | } | 92 | } |
| 86 | 93 | ||
| 87 | /* control put callback */ | 94 | /* control put callback */ |
| 88 | static int snd_line6_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { | 95 | static int snd_line6_control_put(struct snd_kcontrol *kcontrol, |
| 96 | struct snd_ctl_elem_value *ucontrol) | ||
| 97 | { | ||
| 89 | int i, changed = 0; | 98 | int i, changed = 0; |
| 90 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 99 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
| 91 | 100 | ||
| 92 | for(i = 2; i--;) | 101 | for (i = 2; i--;) |
| 93 | if(line6pcm->volume[i] != ucontrol->value.integer.value[i]) { | 102 | if (line6pcm->volume[i] != ucontrol->value.integer.value[i]) { |
| 94 | line6pcm->volume[i] = ucontrol->value.integer.value[i]; | 103 | line6pcm->volume[i] = ucontrol->value.integer.value[i]; |
| 95 | changed = 1; | 104 | changed = 1; |
| 96 | } | 105 | } |
| @@ -117,12 +126,12 @@ static void line6_cleanup_pcm(struct snd_pcm *pcm) | |||
| 117 | int i; | 126 | int i; |
| 118 | struct snd_line6_pcm *line6pcm = snd_pcm_chip(pcm); | 127 | struct snd_line6_pcm *line6pcm = snd_pcm_chip(pcm); |
| 119 | 128 | ||
| 120 | for(i = LINE6_ISO_BUFFERS; i--;) { | 129 | for (i = LINE6_ISO_BUFFERS; i--;) { |
| 121 | if(line6pcm->urb_audio_out[i]) { | 130 | if (line6pcm->urb_audio_out[i]) { |
| 122 | usb_kill_urb(line6pcm->urb_audio_out[i]); | 131 | usb_kill_urb(line6pcm->urb_audio_out[i]); |
| 123 | usb_free_urb(line6pcm->urb_audio_out[i]); | 132 | usb_free_urb(line6pcm->urb_audio_out[i]); |
| 124 | } | 133 | } |
| 125 | if(line6pcm->urb_audio_in[i]) { | 134 | if (line6pcm->urb_audio_in[i]) { |
| 126 | usb_kill_urb(line6pcm->urb_audio_in[i]); | 135 | usb_kill_urb(line6pcm->urb_audio_in[i]); |
| 127 | usb_free_urb(line6pcm->urb_audio_in[i]); | 136 | usb_free_urb(line6pcm->urb_audio_in[i]); |
| 128 | } | 137 | } |
| @@ -135,7 +144,10 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) | |||
| 135 | struct snd_pcm *pcm; | 144 | struct snd_pcm *pcm; |
| 136 | int err; | 145 | int err; |
| 137 | 146 | ||
| 138 | if((err = snd_pcm_new(line6pcm->line6->card, (char *)line6pcm->line6->properties->name, 0, 1, 1, &pcm)) < 0) | 147 | err = snd_pcm_new(line6pcm->line6->card, |
| 148 | (char *)line6pcm->line6->properties->name, | ||
| 149 | 0, 1, 1, &pcm); | ||
| 150 | if (err < 0) | ||
| 139 | return err; | 151 | return err; |
| 140 | 152 | ||
| 141 | pcm->private_data = line6pcm; | 153 | pcm->private_data = line6pcm; |
| @@ -148,10 +160,9 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) | |||
| 148 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops); | 160 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops); |
| 149 | 161 | ||
| 150 | /* pre-allocation of buffers */ | 162 | /* pre-allocation of buffers */ |
| 151 | snd_pcm_lib_preallocate_pages_for_all(pcm, | 163 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, |
| 152 | SNDRV_DMA_TYPE_CONTINUOUS, | 164 | snd_dma_continuous_data(GFP_KERNEL), |
| 153 | snd_dma_continuous_data(GFP_KERNEL), | 165 | 64 * 1024, 128 * 1024); |
| 154 | 64 * 1024, 128 * 1024); | ||
| 155 | 166 | ||
| 156 | return 0; | 167 | return 0; |
| 157 | } | 168 | } |
| @@ -166,7 +177,8 @@ static int snd_line6_pcm_free(struct snd_device *device) | |||
| 166 | Create and register the PCM device and mixer entries. | 177 | Create and register the PCM device and mixer entries. |
| 167 | Create URBs for playback and capture. | 178 | Create URBs for playback and capture. |
| 168 | */ | 179 | */ |
| 169 | int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *properties) | 180 | int line6_init_pcm(struct usb_line6 *line6, |
| 181 | struct line6_pcm_properties *properties) | ||
| 170 | { | 182 | { |
| 171 | static struct snd_device_ops pcm_ops = { | 183 | static struct snd_device_ops pcm_ops = { |
| 172 | .dev_free = snd_line6_pcm_free, | 184 | .dev_free = snd_line6_pcm_free, |
| @@ -176,33 +188,33 @@ int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *propert | |||
| 176 | int ep_read = 0, ep_write = 0; | 188 | int ep_read = 0, ep_write = 0; |
| 177 | struct snd_line6_pcm *line6pcm; | 189 | struct snd_line6_pcm *line6pcm; |
| 178 | 190 | ||
| 179 | if(!(line6->properties->capabilities & LINE6_BIT_PCM)) | 191 | if (!(line6->properties->capabilities & LINE6_BIT_PCM)) |
| 180 | return 0; /* skip PCM initialization and report success */ | 192 | return 0; /* skip PCM initialization and report success */ |
| 181 | 193 | ||
| 182 | /* initialize PCM subsystem based on product id: */ | 194 | /* initialize PCM subsystem based on product id: */ |
| 183 | switch(line6->product) { | 195 | switch (line6->product) { |
| 184 | case LINE6_DEVID_BASSPODXT: | 196 | case LINE6_DEVID_BASSPODXT: |
| 185 | case LINE6_DEVID_BASSPODXTLIVE: | 197 | case LINE6_DEVID_BASSPODXTLIVE: |
| 186 | case LINE6_DEVID_BASSPODXTPRO: | 198 | case LINE6_DEVID_BASSPODXTPRO: |
| 187 | case LINE6_DEVID_PODXT: | 199 | case LINE6_DEVID_PODXT: |
| 188 | case LINE6_DEVID_PODXTLIVE: | 200 | case LINE6_DEVID_PODXTLIVE: |
| 189 | case LINE6_DEVID_PODXTPRO: | 201 | case LINE6_DEVID_PODXTPRO: |
| 190 | ep_read = 0x82; | 202 | ep_read = 0x82; |
| 191 | ep_write = 0x01; | 203 | ep_write = 0x01; |
| 192 | break; | 204 | break; |
| 193 | 205 | ||
| 194 | case LINE6_DEVID_PODX3: | 206 | case LINE6_DEVID_PODX3: |
| 195 | case LINE6_DEVID_PODX3LIVE: | 207 | case LINE6_DEVID_PODX3LIVE: |
| 196 | ep_read = 0x86; | 208 | ep_read = 0x86; |
| 197 | ep_write = 0x02; | 209 | ep_write = 0x02; |
| 198 | break; | 210 | break; |
| 199 | 211 | ||
| 200 | case LINE6_DEVID_POCKETPOD: | 212 | case LINE6_DEVID_POCKETPOD: |
| 201 | ep_read = 0x82; | 213 | ep_read = 0x82; |
| 202 | ep_write = 0x02; | 214 | ep_write = 0x02; |
| 203 | break; | 215 | break; |
| 204 | 216 | ||
| 205 | case LINE6_DEVID_GUITARPORT: | 217 | case LINE6_DEVID_GUITARPORT: |
| 206 | case LINE6_DEVID_TONEPORT_GX: | 218 | case LINE6_DEVID_TONEPORT_GX: |
| 207 | ep_read = 0x82; | 219 | ep_read = 0x82; |
| 208 | ep_write = 0x01; | 220 | ep_write = 0x01; |
| @@ -224,38 +236,46 @@ int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *propert | |||
| 224 | 236 | ||
| 225 | line6pcm = kzalloc(sizeof(struct snd_line6_pcm), GFP_KERNEL); | 237 | line6pcm = kzalloc(sizeof(struct snd_line6_pcm), GFP_KERNEL); |
| 226 | 238 | ||
| 227 | if(line6pcm == NULL) | 239 | if (line6pcm == NULL) |
| 228 | return -ENOMEM; | 240 | return -ENOMEM; |
| 229 | 241 | ||
| 230 | line6pcm->volume[0] = line6pcm->volume[1] = 128; | 242 | line6pcm->volume[0] = line6pcm->volume[1] = 128; |
| 231 | line6pcm->line6 = line6; | 243 | line6pcm->line6 = line6; |
| 232 | line6pcm->ep_audio_read = ep_read; | 244 | line6pcm->ep_audio_read = ep_read; |
| 233 | line6pcm->ep_audio_write = ep_write; | 245 | line6pcm->ep_audio_write = ep_write; |
| 234 | line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, usb_rcvintpipe(line6->usbdev, ep_read), 0); | 246 | line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, |
| 247 | usb_rcvintpipe(line6->usbdev, | ||
| 248 | ep_read), | ||
| 249 | 0); | ||
| 235 | line6pcm->properties = properties; | 250 | line6pcm->properties = properties; |
| 236 | line6->line6pcm = line6pcm; | 251 | line6->line6pcm = line6pcm; |
| 237 | 252 | ||
| 238 | /* PCM device: */ | 253 | /* PCM device: */ |
| 239 | if((err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops)) < 0) | 254 | err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops); |
| 255 | if (err < 0) | ||
| 240 | return err; | 256 | return err; |
| 241 | 257 | ||
| 242 | snd_card_set_dev(line6->card, line6->ifcdev); | 258 | snd_card_set_dev(line6->card, line6->ifcdev); |
| 243 | 259 | ||
| 244 | if((err = snd_line6_new_pcm(line6pcm)) < 0) | 260 | err = snd_line6_new_pcm(line6pcm); |
| 261 | if (err < 0) | ||
| 245 | return err; | 262 | return err; |
| 246 | 263 | ||
| 247 | spin_lock_init(&line6pcm->lock_audio_out); | 264 | spin_lock_init(&line6pcm->lock_audio_out); |
| 248 | spin_lock_init(&line6pcm->lock_audio_in); | 265 | spin_lock_init(&line6pcm->lock_audio_in); |
| 249 | spin_lock_init(&line6pcm->lock_trigger); | 266 | spin_lock_init(&line6pcm->lock_trigger); |
| 250 | 267 | ||
| 251 | if((err = create_audio_out_urbs(line6pcm)) < 0) | 268 | err = create_audio_out_urbs(line6pcm); |
| 269 | if (err < 0) | ||
| 252 | return err; | 270 | return err; |
| 253 | 271 | ||
| 254 | if((err = create_audio_in_urbs(line6pcm)) < 0) | 272 | err = create_audio_in_urbs(line6pcm); |
| 273 | if (err < 0) | ||
| 255 | return err; | 274 | return err; |
| 256 | 275 | ||
| 257 | /* mixer: */ | 276 | /* mixer: */ |
| 258 | if((err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control, line6pcm))) < 0) | 277 | err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control, line6pcm)); |
| 278 | if (err < 0) | ||
| 259 | return err; | 279 | return err; |
| 260 | 280 | ||
| 261 | return 0; | 281 | return 0; |
| @@ -266,7 +286,7 @@ int snd_line6_prepare(struct snd_pcm_substream *substream) | |||
| 266 | { | 286 | { |
| 267 | struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); | 287 | struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); |
| 268 | 288 | ||
| 269 | if(!test_and_set_bit(BIT_PREPARED, &line6pcm->flags)) { | 289 | if (!test_and_set_bit(BIT_PREPARED, &line6pcm->flags)) { |
| 270 | unlink_wait_clear_audio_out_urbs(line6pcm); | 290 | unlink_wait_clear_audio_out_urbs(line6pcm); |
| 271 | line6pcm->pos_out = 0; | 291 | line6pcm->pos_out = 0; |
| 272 | line6pcm->pos_out_done = 0; | 292 | line6pcm->pos_out_done = 0; |
