From 2a613e41ec7684ba863d54a9df3d964e2c7aa4c1 Mon Sep 17 00:00:00 2001 From: Wouter Van Rooy Date: Thu, 11 Mar 2010 20:51:14 +0100 Subject: Staging: cx25821 fixed C99 comments, white spaces and unnecessary braces This patch fixes some C99 style comments, trailing white spaces and some unnecessary 'if' braces found by checkpatch.pl Signed-off-by: Wouter Van Rooy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cx25821/cx25821-alsa.c | 72 ++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 33 deletions(-) (limited to 'drivers/staging/cx25821') diff --git a/drivers/staging/cx25821/cx25821-alsa.c b/drivers/staging/cx25821/cx25821-alsa.c index 061add3..f5a7719 100644 --- a/drivers/staging/cx25821/cx25821-alsa.c +++ b/drivers/staging/cx25821/cx25821-alsa.c @@ -42,10 +42,10 @@ #define AUDIO_SRAM_CHANNEL SRAM_CH08 -#define dprintk(level,fmt, arg...) if (debug >= level) \ +#define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s/1: " fmt, chip->dev->name , ## arg) -#define dprintk_core(level,fmt, arg...) if (debug >= level) \ +#define dprintk_core(level, fmt, arg...) if (debug >= level) \ printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg) /**************************************************************************** @@ -105,7 +105,7 @@ MODULE_PARM_DESC(index, "Index value for cx25821 capture interface(s)."); MODULE_DESCRIPTION("ALSA driver module for cx25821 based capture cards"); MODULE_AUTHOR("Hiep Huynh"); MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("{{Conexant,25821}"); //"{{Conexant,23881}," +MODULE_SUPPORTED_DEVICE("{{Conexant,25821}"); /*"{{Conexant,23881},"*/ static unsigned int debug; module_param(debug, int, 0644); @@ -135,7 +135,7 @@ MODULE_PARM_DESC(debug, "enable debug messages"); * BOARD Specific: Sets audio DMA */ -static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) +static int _cx25821_start_audio_dma(snd_cx25821_card_t *chip) { struct cx25821_buffer *buf = chip->buf; struct cx25821_dev *dev = chip->dev; @@ -143,7 +143,7 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) &cx25821_sram_channels[AUDIO_SRAM_CHANNEL]; u32 tmp = 0; - // enable output on the GPIO 0 for the MCLK ADC (Audio) + /* enable output on the GPIO 0 for the MCLK ADC (Audio) */ cx25821_set_gpiopin_direction(chip->dev, 0, 0); /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ @@ -158,18 +158,22 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) cx_write(AUD_A_LNGTH, buf->bpl); /* reset counter */ - cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET); //GP_COUNT_CONTROL_RESET = 0x3 + cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET); + /* GP_COUNT_CONTROL_RESET = 0x3 */ + atomic_set(&chip->count, 0); - //Set the input mode to 16-bit + /* Set the input mode to 16-bit */ tmp = cx_read(AUD_A_CFG); cx_write(AUD_A_CFG, tmp | FLD_AUD_DST_PK_MODE | FLD_AUD_DST_ENABLE | FLD_AUD_CLK_ENABLE); - //printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line, cmds_start(0x%x)= %d lines/FIFO, %d periods, %d " - // "byte buffer\n", buf->bpl, audio_ch->cmds_start, cx_read(audio_ch->cmds_start + 12)>>1, - // chip->num_periods, buf->bpl * chip->num_periods); + /*printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line, " + "cmds_start(0x%x)= %d lines/FIFO, %d periods, %d " + "byte buffer\n", buf->bpl, audio_ch->cmds_start, " + "cx_read(audio_ch->cmds_start + 12)>>1, + chip->num_periods, buf->bpl * chip->num_periods);*/ /* Enables corresponding bits at AUD_INT_STAT */ cx_write(AUD_A_INT_MSK, @@ -182,7 +186,7 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) /* enable audio irqs */ cx_set(PCI_INT_MSK, chip->dev->pci_irqmask | PCI_MSK_AUD_INT); - // Turn on audio downstream fifo and risc enable 0x101 + /* Turn on audio downstream fifo and risc enable 0x101 */ tmp = cx_read(AUD_INT_DMA_CTL); cx_set(AUD_INT_DMA_CTL, tmp | (FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN)); @@ -194,7 +198,7 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) /* * BOARD Specific: Resets audio DMA */ -static int _cx25821_stop_audio_dma(snd_cx25821_card_t * chip) +static int _cx25821_stop_audio_dma(snd_cx25821_card_t *chip) { struct cx25821_dev *dev = chip->dev; @@ -232,13 +236,12 @@ static char *cx25821_aud_irqs[32] = { /* * BOARD Specific: Threats IRQ audio specific calls */ -static void cx25821_aud_irq(snd_cx25821_card_t * chip, u32 status, u32 mask) +static void cx25821_aud_irq(snd_cx25821_card_t *chip, u32 status, u32 mask) { struct cx25821_dev *dev = chip->dev; - if (0 == (status & mask)) { + if (0 == (status & mask)) return; - } cx_write(AUD_A_INT_STAT, status); if (debug > 1 || (status & mask & ~0xff)) @@ -318,11 +321,11 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) if (handled) cx_write(PCI_INT_STAT, pci_status); - out: +out: return IRQ_RETVAL(handled); } -static int dsp_buffer_free(snd_cx25821_card_t * chip) +static int dsp_buffer_free(snd_cx25821_card_t *chip) { BUG_ON(!chip->dma_size); @@ -363,7 +366,8 @@ static struct snd_pcm_hardware snd_cx25821_digital_hw = { .period_bytes_max = DEFAULT_FIFO_SIZE / 3, .periods_min = 1, .periods_max = AUDIO_LINE_SIZE, - .buffer_bytes_max = (AUDIO_LINE_SIZE * AUDIO_LINE_SIZE), //128*128 = 16384 = 1024 * 16 + .buffer_bytes_max = (AUDIO_LINE_SIZE * AUDIO_LINE_SIZE), + /* 128*128 = 16384 = 1024 * 16 */ }; /* @@ -393,18 +397,20 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream) if (cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size != DEFAULT_FIFO_SIZE) { - bpl = cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size / 3; //since there are 3 audio Clusters + /* since there are 3 audio Clusters */ + bpl = cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size / 3; + bpl &= ~7; /* must be multiple of 8 */ - if (bpl > AUDIO_LINE_SIZE) { + if (bpl > AUDIO_LINE_SIZE) bpl = AUDIO_LINE_SIZE; - } + runtime->hw.period_bytes_min = bpl; runtime->hw.period_bytes_max = bpl; } return 0; - _error: +_error: dprintk(1, "Error opening PCM!\n"); return err; } @@ -445,9 +451,9 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, if (NULL == buf) return -ENOMEM; - if (chip->period_size > AUDIO_LINE_SIZE) { + if (chip->period_size > AUDIO_LINE_SIZE) chip->period_size = AUDIO_LINE_SIZE; - } + buf->vb.memory = V4L2_MEMORY_MMAP; buf->vb.field = V4L2_FIELD_NONE; @@ -474,7 +480,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, buf->vb.width, buf->vb.height, 1); if (ret < 0) { printk(KERN_INFO - "DEBUG: ERROR after cx25821_risc_databuffer_audio() \n"); + "DEBUG: ERROR after cx25821_risc_databuffer_audio()\n"); goto error; } @@ -494,7 +500,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, return 0; - error: +error: kfree(buf); return ret; } @@ -593,10 +599,10 @@ static struct snd_pcm_ops snd_cx25821_pcm_ops = { }; /* - * ALSA create a PCM device: Called when initializing the board. Sets up the name and hooks up - * the callbacks + * ALSA create a PCM device: Called when initializing the board. + * Sets up the name and hooks up the callbacks */ -static int snd_cx25821_pcm(snd_cx25821_card_t * chip, int device, char *name) +static int snd_cx25821_pcm(snd_cx25821_card_t *chip, int device, char *name) { struct snd_pcm *pcm; int err; @@ -655,7 +661,7 @@ static void snd_cx25821_dev_free(struct snd_card *card) { snd_cx25821_card_t *chip = card->private_data; - //snd_cx25821_free(chip); + /*snd_cx25821_free(chip);*/ snd_card_free(chip->card); } @@ -671,13 +677,13 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) if (devno >= SNDRV_CARDS) { printk(KERN_INFO "DEBUG ERROR: devno >= SNDRV_CARDS %s\n", __func__); - return (-ENODEV); + return -ENODEV; } if (!enable[devno]) { ++devno; printk(KERN_INFO "DEBUG ERROR: !enable[devno] %s\n", __func__); - return (-ENOENT); + return -ENOENT; } err = snd_card_create(index[devno], id[devno], THIS_MODULE, @@ -741,7 +747,7 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) devno++; return 0; - error: +error: snd_card_free(card); return err; } -- cgit v1.1 From 7c2c2eb7b2ea83e759d75bf362b161c264b98081 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 24 Mar 2010 22:16:55 -0700 Subject: Staging: cx25821: Hoist assign from if Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cx25821/cx25821-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging/cx25821') diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c index 9e9b8c3..eee4dc7 100644 --- a/drivers/staging/cx25821/cx25821-core.c +++ b/drivers/staging/cx25821/cx25821-core.c @@ -1299,7 +1299,8 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci, instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; instructions += 1; - if ((rc = btcx_riscmem_alloc(pci, risc, instructions * 12)) < 0) + rc = btcx_riscmem_alloc(pci, risc, instructions * 12); + if (rc < 0) return rc; /* write risc instructions */ -- cgit v1.1 From 324148788bf3744d90fb6894ec5744eb0ca91b74 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 11 May 2010 20:26:57 +0200 Subject: Staging: Drop memory allocation cast Drop cast on the result of kmalloc and similar functions. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; @@ - (T *) (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...)) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cx25821/cx25821-audio-upstream.c | 6 ++---- drivers/staging/cx25821/cx25821-video-upstream-ch2.c | 6 ++---- drivers/staging/cx25821/cx25821-video-upstream.c | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'drivers/staging/cx25821') diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c index 11c56bd..4c7d21e 100644 --- a/drivers/staging/cx25821/cx25821-audio-upstream.c +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c @@ -751,8 +751,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) if (dev->input_audiofilename) { str_length = strlen(dev->input_audiofilename); - dev->_audiofilename = - (char *)kmalloc(str_length + 1, GFP_KERNEL); + dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL); if (!dev->_audiofilename) goto error; @@ -766,8 +765,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) } } else { str_length = strlen(_defaultAudioName); - dev->_audiofilename = - (char *)kmalloc(str_length + 1, GFP_KERNEL); + dev->_audiofilename = kmalloc(str_length + 1, GFP_KERNEL); if (!dev->_audiofilename) goto error; diff --git a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c index cc51618..343df66 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c +++ b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c @@ -769,8 +769,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, if (dev->input_filename_ch2) { str_length = strlen(dev->input_filename_ch2); - dev->_filename_ch2 = - (char *)kmalloc(str_length + 1, GFP_KERNEL); + dev->_filename_ch2 = kmalloc(str_length + 1, GFP_KERNEL); if (!dev->_filename_ch2) goto error; @@ -779,8 +778,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, str_length + 1); } else { str_length = strlen(dev->_defaultname_ch2); - dev->_filename_ch2 = - (char *)kmalloc(str_length + 1, GFP_KERNEL); + dev->_filename_ch2 = kmalloc(str_length + 1, GFP_KERNEL); if (!dev->_filename_ch2) goto error; diff --git a/drivers/staging/cx25821/cx25821-video-upstream.c b/drivers/staging/cx25821/cx25821-video-upstream.c index 6d48a1e..fdd94cf 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream.c +++ b/drivers/staging/cx25821/cx25821-video-upstream.c @@ -825,7 +825,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, if (dev->input_filename) { str_length = strlen(dev->input_filename); - dev->_filename = (char *)kmalloc(str_length + 1, GFP_KERNEL); + dev->_filename = kmalloc(str_length + 1, GFP_KERNEL); if (!dev->_filename) goto error; @@ -833,7 +833,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, memcpy(dev->_filename, dev->input_filename, str_length + 1); } else { str_length = strlen(dev->_defaultname); - dev->_filename = (char *)kmalloc(str_length + 1, GFP_KERNEL); + dev->_filename = kmalloc(str_length + 1, GFP_KERNEL); if (!dev->_filename) goto error; -- cgit v1.1