Messages in this thread | | | Date | Mon, 14 Apr 2008 12:18:56 +0200 | From | Takashi Iwai <> | Subject | Re: sound/usb/usbaudio.c: coding style |
| |
Hi,
just back from vacation and struggling with pending patches...
At Sat, 29 Mar 2008 22:09:28 +0100, Pavel Machek wrote: > > > 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>
Applied to ALSA tree now (with a fix for a coding issue you introduced ;). Thanks.
Takashi
> > diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c > index f48838a..8056d8a 100644 > --- a/sound/usb/usbaudio.c > +++ b/sound/usb/usbaudio.c > @@ -64,9 +67,10 @@ MODULE_SUPPORTED_DEVICE("{{Generic,USB A > > static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ > static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ > -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ > -static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Vendor ID for this card */ > -static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Product ID for this card */ > +static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ > +/* Vendor/product IDs for this card */ > +static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; > +static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; > static int nrpacks = 8; /* max. number of packets per urb */ > static int async_unlink = 1; > static int device_setup[SNDRV_CARDS]; /* device parameter for this card*/ > @@ -687,7 +691,7 @@ static void snd_complete_urb(struct urb > int err = 0; > > if ((subs->running && subs->ops.retire(subs, substream->runtime, urb)) || > - ! subs->running || /* can be stopped during retire callback */ > + !subs->running || /* can be stopped during retire callback */ > (err = subs->ops.prepare(subs, substream->runtime, urb)) < 0 || > (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { > clear_bit(ctx->index, &subs->active_mask); > @@ -710,7 +714,7 @@ static void snd_complete_sync_urb(struct > int err = 0; > > if ((subs->running && subs->ops.retire_sync(subs, substream->runtime, urb)) || > - ! subs->running || /* can be stopped during retire callback */ > + !subs->running || /* can be stopped during retire callback */ > (err = subs->ops.prepare_sync(subs, substream->runtime, urb)) < 0 || > (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { > clear_bit(ctx->index + 16, &subs->active_mask); > @@ -740,7 +744,7 @@ static int snd_pcm_alloc_vmalloc_buffer( > vfree(runtime->dma_area); > } > runtime->dma_area = vmalloc(size); > - if (! runtime->dma_area) > + if (!runtime->dma_area) > return -ENOMEM; > runtime->dma_bytes = size; > return 0; > @@ -772,12 +776,12 @@ static int deactivate_urbs(struct snd_us > > async = !can_sleep && async_unlink; > > - if (! async && in_interrupt()) > + if (!async && in_interrupt()) > return 0; > > for (i = 0; i < subs->nurbs; i++) { > if (test_bit(i, &subs->active_mask)) { > - if (! test_and_set_bit(i, &subs->unlink_mask)) { > + if (!test_and_set_bit(i, &subs->unlink_mask)) { > struct urb *u = subs->dataurb[i].urb; > if (async) > usb_unlink_urb(u); > @@ -789,7 +793,7 @@ static int deactivate_urbs(struct snd_us > if (subs->syncpipe) { > for (i = 0; i < SYNC_URBS; i++) { > if (test_bit(i+16, &subs->active_mask)) { > - if (! test_and_set_bit(i+16, &subs->unlink_mask)) { > + if (!test_and_set_bit(i+16, &subs->unlink_mask)) { > struct urb *u = subs->syncurb[i].urb; > if (async) > usb_unlink_urb(u); > @@ -1137,12 +1141,12 @@ static int init_substream_urbs(struct sn > if (subs->fmt_type == USB_FORMAT_TYPE_II) > u->packets++; /* for transfer delimiter */ > u->urb = usb_alloc_urb(u->packets, GFP_KERNEL); > - if (! u->urb) > + if (!u->urb) > goto out_of_memory; > u->urb->transfer_buffer = > usb_buffer_alloc(subs->dev, u->buffer_size, GFP_KERNEL, > &u->urb->transfer_dma); > - if (! u->urb->transfer_buffer) > + if (!u->urb->transfer_buffer) > goto out_of_memory; > u->urb->pipe = subs->datapipe; > u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; > @@ -1155,7 +1159,7 @@ static int init_substream_urbs(struct sn > /* allocate and initialize sync urbs */ > subs->syncbuf = usb_buffer_alloc(subs->dev, SYNC_URBS * 4, > GFP_KERNEL, &subs->sync_dma); > - if (! subs->syncbuf) > + if (!subs->syncbuf) > goto out_of_memory; > for (i = 0; i < SYNC_URBS; i++) { > struct snd_urb_ctx *u = &subs->syncurb[i]; > @@ -1163,7 +1167,7 @@ static int init_substream_urbs(struct sn > u->subs = subs; > u->packets = 1; > u->urb = usb_alloc_urb(1, GFP_KERNEL); > - if (! u->urb) > + if (!u->urb) > goto out_of_memory; > u->urb->transfer_buffer = subs->syncbuf + i * 4; > u->urb->transfer_dma = subs->sync_dma + i * 4; > @@ -1463,7 +1486,7 @@ static int snd_usb_hw_params(struct snd_ > rate = params_rate(hw_params); > channels = params_channels(hw_params); > fmt = find_format(subs, format, rate, channels); > - if (! fmt) { > + if (!fmt) { > snd_printd(KERN_DEBUG "cannot set format: format = 0x%x, rate = %d, channels = %d\n", > format, rate, channels); > return -EINVAL; > @@ -1584,7 +1607,7 @@ static int hw_check_valid_format(struct > struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); > > /* check the format */ > - if (! snd_mask_test(fmts, fp->format)) { > + if (!snd_mask_test(fmts, fp->format)) { > hwc_debug(" > check: no supported format %d\n", fp->format); > return 0; > } > @@ -1620,7 +1643,7 @@ static int hw_rule_rate(struct snd_pcm_h > list_for_each(p, &subs->fmt_list) { > struct audioformat *fp; > fp = list_entry(p, struct audioformat, list); > - if (! hw_check_valid_format(params, fp)) > + if (!hw_check_valid_format(params, fp)) > continue; > if (changed++) { > if (rmin > fp->rate_min) > @@ -1633,7 +1656,7 @@ static int hw_rule_rate(struct snd_pcm_h > } > } > > - if (! changed) { > + if (!changed) { > hwc_debug(" --> get empty\n"); > it->empty = 1; > return -EINVAL; > @@ -1674,7 +1697,7 @@ static int hw_rule_channels(struct snd_p > list_for_each(p, &subs->fmt_list) { > struct audioformat *fp; > fp = list_entry(p, struct audioformat, list); > - if (! hw_check_valid_format(params, fp)) > + if (!hw_check_valid_format(params, fp)) > continue; > if (changed++) { > if (rmin > fp->channels) > @@ -1687,7 +1710,7 @@ static int hw_rule_channels(struct snd_p > } > } > > - if (! changed) { > + if (!changed) { > hwc_debug(" --> get empty\n"); > it->empty = 1; > return -EINVAL; > @@ -1727,7 +1750,7 @@ static int hw_rule_format(struct snd_pcm > list_for_each(p, &subs->fmt_list) { > struct audioformat *fp; > fp = list_entry(p, struct audioformat, list); > - if (! hw_check_valid_format(params, fp)) > + if (!hw_check_valid_format(params, fp)) > continue; > fbits |= (1ULL << fp->format); > } > @@ -1736,7 +1759,7 @@ static int hw_rule_format(struct snd_pcm > oldbits[1] = fmt->bits[1]; > fmt->bits[0] &= (u32)fbits; > fmt->bits[1] &= (u32)(fbits >> 32); > - if (! fmt->bits[0] && ! fmt->bits[1]) { > + if (!fmt->bits[0] && !fmt->bits[1]) { > hwc_debug(" --> get empty\n"); > return -EINVAL; > } > @@ -2222,7 +2245,7 @@ static void proc_pcm_format_add(struct s > struct snd_card *card = stream->chip->card; > > sprintf(name, "stream%d", stream->pcm_index); > - if (! snd_card_proc_new(card, name, &entry)) > + if (!snd_card_proc_new(card, name, &entry)) > snd_info_set_text_ops(entry, stream, proc_pcm_format_read); > } > > @@ -2278,7 +2301,7 @@ static void free_substream(struct snd_us > { > struct list_head *p, *n; > > - if (! subs->num_formats) > + if (!subs->num_formats) > return; /* not initialized */ > list_for_each_safe(p, n, &subs->fmt_list) { > struct audioformat *fp = list_entry(p, struct audioformat, list); > @@ -2328,7 +2351,7 @@ static int add_audio_endpoint(struct snd > if (as->fmt_type != fp->fmt_type) > continue; > subs = &as->substream[stream]; > - if (! subs->endpoint) > + if (!subs->endpoint) > continue; > if (subs->endpoint == fp->endpoint) { > list_add_tail(&fp->list, &subs->fmt_list); > @@ -2354,7 +2377,7 @@ static int add_audio_endpoint(struct snd > > /* create a new pcm */ > as = kzalloc(sizeof(*as), GFP_KERNEL); > - if (! as) > + if (!as) > return -ENOMEM; > as->pcm_index = chip->pcm_devs; > as->chip = chip; > @@ -3375,14 +3398,14 @@ static int snd_usb_create_quirk(struct s > static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) > { > struct snd_usb_audio *chip = entry->private_data; > - if (! chip->shutdown) > + if (!chip->shutdown) > snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum); > } > > static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) > { > struct snd_usb_audio *chip = entry->private_data; > - if (! chip->shutdown) > + if (!chip->shutdown) > snd_iprintf(buffer, "%04x:%04x\n", > USB_ID_VENDOR(chip->usb_id), > USB_ID_PRODUCT(chip->usb_id)); > @@ -3391,9 +3414,9 @@ static void proc_audio_usbid_read(struct > static void snd_usb_audio_create_proc(struct snd_usb_audio *chip) > { > struct snd_info_entry *entry; > - if (! snd_card_proc_new(chip->card, "usbbus", &entry)) > + if (!snd_card_proc_new(chip->card, "usbbus", &entry)) > snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); > - if (! snd_card_proc_new(chip->card, "usbid", &entry)) > + if (!snd_card_proc_new(chip->card, "usbid", &entry)) > snd_info_set_text_ops(entry, chip, proc_audio_usbid_read); > } > > @@ -3600,8 +3623,8 @@ static void *snd_usb_audio_probe(struct > snd_card_set_dev(chip->card, &intf->dev); > break; > } > - if (! chip) { > - snd_printk(KERN_ERR "no available usb audio device\n"); > + if (!chip) { > + printk(KERN_ERR "no available usb audio device\n"); > goto __error; > } > } > > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html >
| |