drivers/staging/cx25821: Use pr_fmt and pr_<level>
Subsystems (2)
PATCH 1/1 drivers/staging/cx25821: Use pr_fmt and pr_<level>
Fix several defects with bad line continuation uses that introduce whitespace.
Fix several defects with lines missing "\n". Standardize prefixes via pr_fmt.
Remove internal cx25821 prefixes.
Standardize :%s():" ... __func__ uses.
Coalesce long formats.
Add KERN_<level> prefixes via pr_<level> to printks.
Signed-off-by Joe Perches <[email protected]>
--- drivers/staging/cx25821/cx25821-alsa.c | 71 ++++---- drivers/staging/cx25821/cx25821-audio-upstream.c | 66 ++++---- drivers/staging/cx25821/cx25821-cards.c | 2 + drivers/staging/cx25821/cx25821-core.c | 191 ++++++++++---------- drivers/staging/cx25821/cx25821-i2c.c | 19 ++- drivers/staging/cx25821/cx25821-medusa-video.c | 7 +- .../staging/cx25821/cx25821-video-upstream-ch2.c | 63 +++---- drivers/staging/cx25821/cx25821-video-upstream.c | 90 ++++------ drivers/staging/cx25821/cx25821-video.c | 82 ++++----- drivers/staging/cx25821/cx25821-video.h | 9 +- drivers/staging/cx25821/cx25821.h | 9 +- 11 files changed, 287 insertions(+), 322 deletions(-)
drivers/staging/cx25821/cx25821-alsa.c +34 -37
@@ -20,6 +20,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/init.h> #include <linux/device.h>
@@ -42,11 +44,16 @@#define AUDIO_SRAM_CHANNEL SRAM_CH08 -#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) \ - printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg) +#define dprintk(level, fmt, arg...) \ +do { \ + if (debug >= level) \ + pr_info("%s/1: " fmt, chip->dev->name, ##arg); \ +} while (0) +#define dprintk_core(level, fmt, arg...) \ +do { \ + if (debug >= level) \ + printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name, ##arg); \ +} while (0)/**************************************************************************** Data type declarations - Can be moded to a header file later
@@ -173,12 +180,11 @@ static int _cx25821_start_audio_dma(struct cx25821_audio_dev *chip) 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); +/* +pr_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 */
@@ -259,8 +265,7 @@ static void cx25821_aud_irq(struct cx25821_audio_dev *chip, u32 status,/* risc op code error */ if (status &AUD_INT_OPC_ERR ) { -printk (KERN_WARNING "WARNING %s/1: Audio risc op code error\n" , - dev->name); +pr_warn ("WARNING %s/1: Audio risc op code error\n" , dev->name);cx_clear (AUD_INT_DMA_CTL ,FLD_AUD_DST_A_RISC_EN |FLD_AUD_DST_A_FIFO_EN );
@@ -269,8 +274,7 @@ static void cx25821_aud_irq(struct cx25821_audio_dev *chip, u32 status, [AUDIO_SRAM_CHANNEL]); }if (status &AUD_INT_DN_SYNC ) { -printk (KERN_WARNING "WARNING %s: Downstream sync error!\n" , - dev->name); +pr_warn ("WARNING %s: Downstream sync error!\n" , dev->name);cx_write (AUD_A_GPCNT_CTL ,GP_COUNT_CONTROL_RESET );return ; }
@@ -388,8 +392,7 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream)unsigned int bpl =0 ;if (!chip) { -printk (KERN_ERR "DEBUG: cx25821 can't find device struct." -" Can't proceed with open\n" ); +pr_err ("DEBUG: cx25821 can't find device struct. Can't proceed with open\n" );return -ENODEV ; }
@@ -479,8 +482,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, chip->period_size, chip->num_periods, 1);if (ret <0 ) { -printk (KERN_INFO -"DEBUG: ERROR after cx25821_risc_databuffer_audio()\n" ); +pr_info ("DEBUG: ERROR after cx25821_risc_databuffer_audio()\n" ); goto error; }
@@ -608,8 +610,7 @@ static int snd_cx25821_pcm(struct cx25821_audio_dev *chip, int device, err =snd_pcm_new (chip->card, name, device,0 ,1 , &pcm);if (err <0 ) { -printk (KERN_INFO "ERROR: FAILED snd_pcm_new() in %s\n" , - __func__); +pr_info ("ERROR: FAILED snd_pcm_new() in %s\n" , __func__);return err; } pcm->private_data = chip;
@@ -674,23 +675,21 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)int err;if (devno >=SNDRV_CARDS ) { -printk (KERN_INFO "DEBUG ERROR: devno >= SNDRV_CARDS %s\n" , - __func__); +pr_info ("DEBUG ERROR: devno >= SNDRV_CARDS %s\n" , __func__);return -ENODEV ; }if (!enable[devno]) { ++devno; -printk (KERN_INFO "DEBUG ERROR: !enable[devno] %s\n" , __func__); +pr_info ("DEBUG ERROR: !enable[devno] %s\n" , __func__);return -ENOENT ; } err =snd_card_create (index[devno], id[devno],THIS_MODULE ,sizeof (struct cx25821_audio_dev ), &card);if (err <0 ) { -printk (KERN_INFO -"DEBUG ERROR: cannot create snd_card_new in %s\n" , - __func__); +pr_info ("DEBUG ERROR: cannot create snd_card_new in %s\n" , + __func__);return err; }
@@ -712,16 +711,15 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) IRQF_SHARED | IRQF_DISABLED, chip->dev->name, chip);if (err <0 ) { -printk (KERN_ERR "ERROR %s: can't get IRQ %d for ALSA\n" , +pr_err ("ERROR %s: can't get IRQ %d for ALSA\n" , chip->dev->name, dev->pci->irq); goto error; } err =snd_cx25821_pcm (chip,0 ,"cx25821 Digital" );if (err <0 ) { -printk (KERN_INFO -"DEBUG ERROR: cannot create snd_cx25821_pcm %s\n" , - __func__); +pr_info ("DEBUG ERROR: cannot create snd_cx25821_pcm %s\n" , + __func__); goto error; }
@@ -732,13 +730,13 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) chip->iobase, chip->irq);strcpy (card->mixername,"CX25821" ); -printk (KERN_INFO "%s/%i: ALSA support for cx25821 boards\n" , - card->driver, devno); +pr_info ("%s/%i: ALSA support for cx25821 boards\n" , + card->driver, devno); err =snd_card_register (card);if (err <0 ) { -printk (KERN_INFO "DEBUG ERROR: cannot register sound card %s\n" , - __func__); +pr_info ("DEBUG ERROR: cannot register sound card %s\n" , + __func__); goto error; }
@@ -778,8 +776,7 @@ static int cx25821_alsa_init(void) }if (dev ==NULL ) -printk (KERN_INFO -"cx25821 ERROR ALSA: no cx25821 cards found\n" ); +pr_info ("ERROR ALSA: no cx25821 cards found\n" );return 0 ;
drivers/staging/cx25821/cx25821-audio-upstream.c +32 -34
192 lines not on this page · raw message
drivers/staging/cx25821/cx25821-cards.c +2 -0
@@ -21,6 +21,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/init.h> #include <linux/module.h> #include <linux/pci.h>
drivers/staging/cx25821/cx25821-core.c +92 -99
393 lines not on this page · raw message
drivers/staging/cx25821/cx25821-i2c.c +11 -8
@@ -21,6 +21,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "cx25821.h" #include <linux/i2c.h>
@@ -32,10 +34,11 @@ static unsigned int i2c_scan;module_param (i2c_scan, int,0444 );MODULE_PARM_DESC (i2c_scan,"scan i2c bus at insmod time" ); -#define dprintk(level, fmt, arg...)\ - do { if (i2c_debug >= level)\ - printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ - } while (0) +#define dprintk(level, fmt, arg...) \ +do { \ + if (i2c_debug >= level) \ + printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \ +} while (0)#define I2C_WAIT_DELAY 32#define I2C_WAIT_RETRY 64
@@ -98,7 +101,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,if (!i2c_slave_did_ack (i2c_adap))return -EIO ; -dprintk (1 ,"%s() returns 0\n" , __func__); +dprintk (1 ,"%s(): returns 0\n" , __func__);return 0 ; }
@@ -163,7 +166,7 @@ eio: retval = -EIO ; err:if (i2c_debug) -printk (KERN_ERR " ERR: %d\n" , retval); +pr_err (" ERR: %d\n" , retval);return retval; }
@@ -187,7 +190,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,if (!i2c_slave_did_ack (i2c_adap))return -EIO ; -dprintk (1 ,"%s() returns 0\n" , __func__); +dprintk (1 ,"%s(): returns 0\n" , __func__);return 0 ; }
@@ -227,7 +230,7 @@ eio: retval = -EIO ; err:if (i2c_debug) -printk (KERN_ERR " ERR: %d\n" , retval); +pr_err (" ERR: %d\n" , retval);return retval; }
drivers/staging/cx25821/cx25821-medusa-video.c +4 -3
@@ -20,6 +20,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "cx25821.h" #include "cx25821-medusa-video.h" #include "cx25821-biffuncs.h"
@@ -499,9 +501,8 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width,/* validate the width - cannot be negative */ if (width >MAX_WIDTH ) { -printk - ("cx25821 %s() : width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n" , - __func__, width,MAX_WIDTH ); +pr_info ("%s(): width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n" , + __func__, width,MAX_WIDTH ); width =MAX_WIDTH ; }
drivers/staging/cx25821/cx25821-video-upstream-ch2.c +28 -35
171 lines not on this page · raw message
drivers/staging/cx25821/cx25821-video-upstream.c +35 -55
204 lines not on this page · raw message
drivers/staging/cx25821/cx25821-video.c +38 -44
186 lines not on this page · raw message
drivers/staging/cx25821/cx25821-video.h +5 -4
@@ -49,10 +49,11 @@#define VIDEO_DEBUG 0 -#define dprintk(level, fmt, arg...)\ - do { if (VIDEO_DEBUG >= level)\ - printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ - } while (0) +#define dprintk(level, fmt, arg...) \ +do { \ + if (VIDEO_DEBUG >= level) \ + printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \ +} while (0)/* For IOCTL to identify running upstream */ #define UPSTREAM_START_VIDEO 700
drivers/staging/cx25821/cx25821.h +6 -3
@@ -519,9 +519,12 @@ extern struct sram_channel cx25821_sram_channels[];#define Set_GPIO_Bit (Bit) (1 << Bit)#define Clear_GPIO_Bit (Bit) (~(1 << Bit)) -#define CX25821_ERR(fmt, args...) printk(KERN_ERR "cx25821(%d): " fmt, dev->board, ## args) -#define CX25821_WARN(fmt, args...) printk(KERN_WARNING "cx25821(%d): " fmt, dev->board , ## args) -#define CX25821_INFO(fmt, args...) printk(KERN_INFO "cx25821(%d): " fmt, dev->board , ## args) +#define CX25821_ERR(fmt, args...) \ + pr_err("(%d): " fmt, dev->board, ##args) +#define CX25821_WARN(fmt, args...) \ + pr_warn("(%d): " fmt, dev->board, ##args) +#define CX25821_INFO(fmt, args...) \ + pr_info("(%d): " fmt, dev->board, ##args)extern int cx25821_i2c_register (struct cx25821_i2c *bus);extern void cx25821_card_setup (struct cx25821_dev *dev);