aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@suse.cz>2008-04-14 07:15:56 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:34 -0400
commit07f51a727462696ddea01c7a7750c27796a0e1f3 (patch)
treec2634f0bc35540d225f6b346586368bbefe8976d /sound/usb/usbaudio.c
parent2a56f51bcc3650ecff806450f7fdab5edf57618f (diff)
[ALSA] sound/usb/usbaudio.c: coding style
Putting space between ! and variable is a strange coding style, fix that, also make it fit into 80 columns where that is easy. Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 26fb5769d951..7b3bcf1916d2 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -64,9 +64,10 @@ MODULE_SUPPORTED_DEVICE("{{Generic,USB Audio}}");
64 64
65static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 65static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
66static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 66static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
67static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 67static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
68static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Vendor ID for this card */ 68/* Vendor/product IDs for this card */
69static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Product ID for this card */ 69static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
70static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
70static int nrpacks = 8; /* max. number of packets per urb */ 71static int nrpacks = 8; /* max. number of packets per urb */
71static int async_unlink = 1; 72static int async_unlink = 1;
72static int device_setup[SNDRV_CARDS]; /* device parameter for this card*/ 73static int device_setup[SNDRV_CARDS]; /* device parameter for this card*/
@@ -687,7 +688,7 @@ static void snd_complete_urb(struct urb *urb)
687 int err = 0; 688 int err = 0;
688 689
689 if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) || 690 if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) ||
690 ! subs->running || /* can be stopped during retire callback */ 691 !subs->running || /* can be stopped during retire callback */
691 (err = subs->ops.prepare(subs, substream->runtime, urb)) < 0 || 692 (err = subs->ops.prepare(subs, substream->runtime, urb)) < 0 ||
692 (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 693 (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
693 clear_bit(ctx->index, &subs->active_mask); 694 clear_bit(ctx->index, &subs->active_mask);
@@ -710,7 +711,7 @@ static void snd_complete_sync_urb(struct urb *urb)
710 int err = 0; 711 int err = 0;
711 712
712 if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) || 713 if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) ||
713 ! subs->running || /* can be stopped during retire callback */ 714 !subs->running || /* can be stopped during retire callback */
714 (err = subs->ops.prepare_sync(subs, substream->runtime, urb)) < 0 || 715 (err = subs->ops.prepare_sync(subs, substream->runtime, urb)) < 0 ||
715 (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 716 (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
716 clear_bit(ctx->index + 16, &subs->active_mask); 717 clear_bit(ctx->index + 16, &subs->active_mask);
@@ -740,7 +741,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
740 vfree(runtime->dma_area); 741 vfree(runtime->dma_area);
741 } 742 }
742 runtime->dma_area = vmalloc(size); 743 runtime->dma_area = vmalloc(size);
743 if (! runtime->dma_area) 744 if (!runtime->dma_area)
744 return -ENOMEM; 745 return -ENOMEM;
745 runtime->dma_bytes = size; 746 runtime->dma_bytes = size;
746 return 0; 747 return 0;
@@ -772,12 +773,12 @@ static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sl
772 773
773 async = !can_sleep && async_unlink; 774 async = !can_sleep && async_unlink;
774 775
775 if (! async && in_interrupt()) 776 if (!async && in_interrupt())
776 return 0; 777 return 0;
777 778
778 for (i = 0; i < subs->nurbs; i++) { 779 for (i = 0; i < subs->nurbs; i++) {
779 if (test_bit(i, &subs->active_mask)) { 780 if (test_bit(i, &subs->active_mask)) {
780 if (! test_and_set_bit(i, &subs->unlink_mask)) { 781 if (!test_and_set_bit(i, &subs->unlink_mask)) {
781 struct urb *u = subs->dataurb[i].urb; 782 struct urb *u = subs->dataurb[i].urb;
782 if (async) 783 if (async)
783 usb_unlink_urb(u); 784 usb_unlink_urb(u);
@@ -789,7 +790,7 @@ static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sl
789 if (subs->syncpipe) { 790 if (subs->syncpipe) {
790 for (i = 0; i < SYNC_URBS; i++) { 791 for (i = 0; i < SYNC_URBS; i++) {
791 if (test_bit(i+16, &subs->active_mask)) { 792 if (test_bit(i+16, &subs->active_mask)) {
792 if (! test_and_set_bit(i+16, &subs->unlink_mask)) { 793 if (!test_and_set_bit(i+16, &subs->unlink_mask)) {
793 struct urb *u = subs->syncurb[i].urb; 794 struct urb *u = subs->syncurb[i].urb;
794 if (async) 795 if (async)
795 usb_unlink_urb(u); 796 usb_unlink_urb(u);
@@ -1137,12 +1138,12 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri
1137 if (subs->fmt_type == USB_FORMAT_TYPE_II) 1138 if (subs->fmt_type == USB_FORMAT_TYPE_II)
1138 u->packets++; /* for transfer delimiter */ 1139 u->packets++; /* for transfer delimiter */
1139 u->urb = usb_alloc_urb(u->packets, GFP_KERNEL); 1140 u->urb = usb_alloc_urb(u->packets, GFP_KERNEL);
1140 if (! u->urb) 1141 if (!u->urb)
1141 goto out_of_memory; 1142 goto out_of_memory;
1142 u->urb->transfer_buffer = 1143 u->urb->transfer_buffer =
1143 usb_buffer_alloc(subs->dev, u->buffer_size, GFP_KERNEL, 1144 usb_buffer_alloc(subs->dev, u->buffer_size, GFP_KERNEL,
1144 &u->urb->transfer_dma); 1145 &u->urb->transfer_dma);
1145 if (! u->urb->transfer_buffer) 1146 if (!u->urb->transfer_buffer)
1146 goto out_of_memory; 1147 goto out_of_memory;
1147 u->urb->pipe = subs->datapipe; 1148 u->urb->pipe = subs->datapipe;
1148 u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; 1149 u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
@@ -1155,7 +1156,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri
1155 /* allocate and initialize sync urbs */ 1156 /* allocate and initialize sync urbs */
1156 subs->syncbuf = usb_buffer_alloc(subs->dev, SYNC_URBS * 4, 1157 subs->syncbuf = usb_buffer_alloc(subs->dev, SYNC_URBS * 4,
1157 GFP_KERNEL, &subs->sync_dma); 1158 GFP_KERNEL, &subs->sync_dma);
1158 if (! subs->syncbuf) 1159 if (!subs->syncbuf)
1159 goto out_of_memory; 1160 goto out_of_memory;
1160 for (i = 0; i < SYNC_URBS; i++) { 1161 for (i = 0; i < SYNC_URBS; i++) {
1161 struct snd_urb_ctx *u = &subs->syncurb[i]; 1162 struct snd_urb_ctx *u = &subs->syncurb[i];
@@ -1163,7 +1164,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri
1163 u->subs = subs; 1164 u->subs = subs;
1164 u->packets = 1; 1165 u->packets = 1;
1165 u->urb = usb_alloc_urb(1, GFP_KERNEL); 1166 u->urb = usb_alloc_urb(1, GFP_KERNEL);
1166 if (! u->urb) 1167 if (!u->urb)
1167 goto out_of_memory; 1168 goto out_of_memory;
1168 u->urb->transfer_buffer = subs->syncbuf + i * 4; 1169 u->urb->transfer_buffer = subs->syncbuf + i * 4;
1169 u->urb->transfer_dma = subs->sync_dma + i * 4; 1170 u->urb->transfer_dma = subs->sync_dma + i * 4;
@@ -1463,7 +1464,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
1463 rate = params_rate(hw_params); 1464 rate = params_rate(hw_params);
1464 channels = params_channels(hw_params); 1465 channels = params_channels(hw_params);
1465 fmt = find_format(subs, format, rate, channels); 1466 fmt = find_format(subs, format, rate, channels);
1466 if (! fmt) { 1467 if (!fmt) {
1467 snd_printd(KERN_DEBUG "cannot set format: format = 0x%x, rate = %d, channels = %d\n", 1468 snd_printd(KERN_DEBUG "cannot set format: format = 0x%x, rate = %d, channels = %d\n",
1468 format, rate, channels); 1469 format, rate, channels);
1469 return -EINVAL; 1470 return -EINVAL;
@@ -1584,7 +1585,7 @@ static int hw_check_valid_format(struct snd_pcm_hw_params *params, struct audiof
1584 struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1585 struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
1585 1586
1586 /* check the format */ 1587 /* check the format */
1587 if (! snd_mask_test(fmts, fp->format)) { 1588 if (!snd_mask_test(fmts, fp->format)) {
1588 hwc_debug(" > check: no supported format %d\n", fp->format); 1589 hwc_debug(" > check: no supported format %d\n", fp->format);
1589 return 0; 1590 return 0;
1590 } 1591 }
@@ -1620,7 +1621,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params,
1620 list_for_each(p, &subs->fmt_list) { 1621 list_for_each(p, &subs->fmt_list) {
1621 struct audioformat *fp; 1622 struct audioformat *fp;
1622 fp = list_entry(p, struct audioformat, list); 1623 fp = list_entry(p, struct audioformat, list);
1623 if (! hw_check_valid_format(params, fp)) 1624 if (!hw_check_valid_format(params, fp))
1624 continue; 1625 continue;
1625 if (changed++) { 1626 if (changed++) {
1626 if (rmin > fp->rate_min) 1627 if (rmin > fp->rate_min)
@@ -1633,7 +1634,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params,
1633 } 1634 }
1634 } 1635 }
1635 1636
1636 if (! changed) { 1637 if (!changed) {
1637 hwc_debug(" --> get empty\n"); 1638 hwc_debug(" --> get empty\n");
1638 it->empty = 1; 1639 it->empty = 1;
1639 return -EINVAL; 1640 return -EINVAL;
@@ -1674,7 +1675,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params,
1674 list_for_each(p, &subs->fmt_list) { 1675 list_for_each(p, &subs->fmt_list) {
1675 struct audioformat *fp; 1676 struct audioformat *fp;
1676 fp = list_entry(p, struct audioformat, list); 1677 fp = list_entry(p, struct audioformat, list);
1677 if (! hw_check_valid_format(params, fp)) 1678 if (!hw_check_valid_format(params, fp))
1678 continue; 1679 continue;
1679 if (changed++) { 1680 if (changed++) {
1680 if (rmin > fp->channels) 1681 if (rmin > fp->channels)
@@ -1687,7 +1688,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params,
1687 } 1688 }
1688 } 1689 }
1689 1690
1690 if (! changed) { 1691 if (!changed) {
1691 hwc_debug(" --> get empty\n"); 1692 hwc_debug(" --> get empty\n");
1692 it->empty = 1; 1693 it->empty = 1;
1693 return -EINVAL; 1694 return -EINVAL;
@@ -1727,7 +1728,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params,
1727 list_for_each(p, &subs->fmt_list) { 1728 list_for_each(p, &subs->fmt_list) {
1728 struct audioformat *fp; 1729 struct audioformat *fp;
1729 fp = list_entry(p, struct audioformat, list); 1730 fp = list_entry(p, struct audioformat, list);
1730 if (! hw_check_valid_format(params, fp)) 1731 if (!hw_check_valid_format(params, fp))
1731 continue; 1732 continue;
1732 fbits |= (1ULL << fp->format); 1733 fbits |= (1ULL << fp->format);
1733 } 1734 }
@@ -1736,7 +1737,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params,
1736 oldbits[1] = fmt->bits[1]; 1737 oldbits[1] = fmt->bits[1];
1737 fmt->bits[0] &= (u32)fbits; 1738 fmt->bits[0] &= (u32)fbits;
1738 fmt->bits[1] &= (u32)(fbits >> 32); 1739 fmt->bits[1] &= (u32)(fbits >> 32);
1739 if (! fmt->bits[0] && ! fmt->bits[1]) { 1740 if (!fmt->bits[0] && !fmt->bits[1]) {
1740 hwc_debug(" --> get empty\n"); 1741 hwc_debug(" --> get empty\n");
1741 return -EINVAL; 1742 return -EINVAL;
1742 } 1743 }
@@ -2227,7 +2228,7 @@ static void proc_pcm_format_add(struct snd_usb_stream *stream)
2227 struct snd_card *card = stream->chip->card; 2228 struct snd_card *card = stream->chip->card;
2228 2229
2229 sprintf(name, "stream%d", stream->pcm_index); 2230 sprintf(name, "stream%d", stream->pcm_index);
2230 if (! snd_card_proc_new(card, name, &entry)) 2231 if (!snd_card_proc_new(card, name, &entry))
2231 snd_info_set_text_ops(entry, stream, proc_pcm_format_read); 2232 snd_info_set_text_ops(entry, stream, proc_pcm_format_read);
2232} 2233}
2233 2234
@@ -2283,7 +2284,7 @@ static void free_substream(struct snd_usb_substream *subs)
2283{ 2284{
2284 struct list_head *p, *n; 2285 struct list_head *p, *n;
2285 2286
2286 if (! subs->num_formats) 2287 if (!subs->num_formats)
2287 return; /* not initialized */ 2288 return; /* not initialized */
2288 list_for_each_safe(p, n, &subs->fmt_list) { 2289 list_for_each_safe(p, n, &subs->fmt_list) {
2289 struct audioformat *fp = list_entry(p, struct audioformat, list); 2290 struct audioformat *fp = list_entry(p, struct audioformat, list);
@@ -2333,7 +2334,7 @@ static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct aud
2333 if (as->fmt_type != fp->fmt_type) 2334 if (as->fmt_type != fp->fmt_type)
2334 continue; 2335 continue;
2335 subs = &as->substream[stream]; 2336 subs = &as->substream[stream];
2336 if (! subs->endpoint) 2337 if (!subs->endpoint)
2337 continue; 2338 continue;
2338 if (subs->endpoint == fp->endpoint) { 2339 if (subs->endpoint == fp->endpoint) {
2339 list_add_tail(&fp->list, &subs->fmt_list); 2340 list_add_tail(&fp->list, &subs->fmt_list);
@@ -2359,7 +2360,7 @@ static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct aud
2359 2360
2360 /* create a new pcm */ 2361 /* create a new pcm */
2361 as = kzalloc(sizeof(*as), GFP_KERNEL); 2362 as = kzalloc(sizeof(*as), GFP_KERNEL);
2362 if (! as) 2363 if (!as)
2363 return -ENOMEM; 2364 return -ENOMEM;
2364 as->pcm_index = chip->pcm_devs; 2365 as->pcm_index = chip->pcm_devs;
2365 as->chip = chip; 2366 as->chip = chip;
@@ -3392,14 +3393,14 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
3392static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) 3393static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3393{ 3394{
3394 struct snd_usb_audio *chip = entry->private_data; 3395 struct snd_usb_audio *chip = entry->private_data;
3395 if (! chip->shutdown) 3396 if (!chip->shutdown)
3396 snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum); 3397 snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum);
3397} 3398}
3398 3399
3399static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) 3400static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3400{ 3401{
3401 struct snd_usb_audio *chip = entry->private_data; 3402 struct snd_usb_audio *chip = entry->private_data;
3402 if (! chip->shutdown) 3403 if (!chip->shutdown)
3403 snd_iprintf(buffer, "%04x:%04x\n", 3404 snd_iprintf(buffer, "%04x:%04x\n",
3404 USB_ID_VENDOR(chip->usb_id), 3405 USB_ID_VENDOR(chip->usb_id),
3405 USB_ID_PRODUCT(chip->usb_id)); 3406 USB_ID_PRODUCT(chip->usb_id));
@@ -3408,9 +3409,9 @@ static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_
3408static void snd_usb_audio_create_proc(struct snd_usb_audio *chip) 3409static void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
3409{ 3410{
3410 struct snd_info_entry *entry; 3411 struct snd_info_entry *entry;
3411 if (! snd_card_proc_new(chip->card, "usbbus", &entry)) 3412 if (!snd_card_proc_new(chip->card, "usbbus", &entry))
3412 snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); 3413 snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read);
3413 if (! snd_card_proc_new(chip->card, "usbid", &entry)) 3414 if (!snd_card_proc_new(chip->card, "usbid", &entry))
3414 snd_info_set_text_ops(entry, chip, proc_audio_usbid_read); 3415 snd_info_set_text_ops(entry, chip, proc_audio_usbid_read);
3415} 3416}
3416 3417
@@ -3617,8 +3618,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3617 snd_card_set_dev(chip->card, &intf->dev); 3618 snd_card_set_dev(chip->card, &intf->dev);
3618 break; 3619 break;
3619 } 3620 }
3620 if (! chip) { 3621 if (!chip) {
3621 snd_printk(KERN_ERR "no available usb audio device\n"); 3622 printk(KERN_ERR "no available usb audio device\n");
3622 goto __error; 3623 goto __error;
3623 } 3624 }
3624 } 3625 }