Commit 36d89f7d authored by Joe Perches's avatar Joe Perches Committed by Mauro Carvalho Chehab

[media] 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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 13d28e49
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -42,11 +44,16 @@ ...@@ -42,11 +44,16 @@
#define AUDIO_SRAM_CHANNEL SRAM_CH08 #define AUDIO_SRAM_CHANNEL SRAM_CH08
#define dprintk(level, fmt, arg...) if (debug >= level) \ #define dprintk(level, fmt, arg...) \
printk(KERN_INFO "%s/1: " fmt, chip->dev->name , ## arg) do { \
if (debug >= level) \
#define dprintk_core(level, fmt, arg...) if (debug >= level) \ pr_info("%s/1: " fmt, chip->dev->name, ##arg); \
printk(KERN_DEBUG "%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 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) ...@@ -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 | tmp | FLD_AUD_DST_PK_MODE | FLD_AUD_DST_ENABLE |
FLD_AUD_CLK_ENABLE); FLD_AUD_CLK_ENABLE);
/* printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line," /*
"cmds_start(0x%x)= %d lines/FIFO, %d periods, " pr_info("DEBUG: Start audio DMA, %d B/line, cmds_start(0x%x)= %d lines/FIFO, %d periods, %d byte buffer\n",
"%d byte buffer\n", buf->bpl, buf->bpl, audio_ch->cmds_start,
audio_ch->cmds_start,
cx_read(audio_ch->cmds_start + 12)>>1, cx_read(audio_ch->cmds_start + 12)>>1,
chip->num_periods, buf->bpl *chip->num_periods); chip->num_periods, buf->bpl * chip->num_periods);
*/ */
/* Enables corresponding bits at AUD_INT_STAT */ /* Enables corresponding bits at AUD_INT_STAT */
...@@ -259,8 +265,7 @@ static void cx25821_aud_irq(struct cx25821_audio_dev *chip, u32 status, ...@@ -259,8 +265,7 @@ static void cx25821_aud_irq(struct cx25821_audio_dev *chip, u32 status,
/* risc op code error */ /* risc op code error */
if (status & AUD_INT_OPC_ERR) { if (status & AUD_INT_OPC_ERR) {
printk(KERN_WARNING "WARNING %s/1: Audio risc op code error\n", pr_warn("WARNING %s/1: Audio risc op code error\n", dev->name);
dev->name);
cx_clear(AUD_INT_DMA_CTL, cx_clear(AUD_INT_DMA_CTL,
FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN); 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, ...@@ -269,8 +274,7 @@ static void cx25821_aud_irq(struct cx25821_audio_dev *chip, u32 status,
[AUDIO_SRAM_CHANNEL]); [AUDIO_SRAM_CHANNEL]);
} }
if (status & AUD_INT_DN_SYNC) { if (status & AUD_INT_DN_SYNC) {
printk(KERN_WARNING "WARNING %s: Downstream sync error!\n", pr_warn("WARNING %s: Downstream sync error!\n", dev->name);
dev->name);
cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET); cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET);
return; return;
} }
...@@ -388,8 +392,7 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream) ...@@ -388,8 +392,7 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream)
unsigned int bpl = 0; unsigned int bpl = 0;
if (!chip) { if (!chip) {
printk(KERN_ERR "DEBUG: cx25821 can't find device struct." pr_err("DEBUG: cx25821 can't find device struct. Can't proceed with open\n");
" Can't proceed with open\n");
return -ENODEV; return -ENODEV;
} }
...@@ -479,8 +482,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, ...@@ -479,8 +482,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
chip->period_size, chip->num_periods, chip->period_size, chip->num_periods,
1); 1);
if (ret < 0) { if (ret < 0) {
printk(KERN_INFO pr_info("DEBUG: ERROR after cx25821_risc_databuffer_audio()\n");
"DEBUG: ERROR after cx25821_risc_databuffer_audio()\n");
goto error; goto error;
} }
...@@ -608,8 +610,7 @@ static int snd_cx25821_pcm(struct cx25821_audio_dev *chip, int device, ...@@ -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); err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm);
if (err < 0) { if (err < 0) {
printk(KERN_INFO "ERROR: FAILED snd_pcm_new() in %s\n", pr_info("ERROR: FAILED snd_pcm_new() in %s\n", __func__);
__func__);
return err; return err;
} }
pcm->private_data = chip; pcm->private_data = chip;
...@@ -674,22 +675,20 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) ...@@ -674,22 +675,20 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
int err; int err;
if (devno >= SNDRV_CARDS) { if (devno >= SNDRV_CARDS) {
printk(KERN_INFO "DEBUG ERROR: devno >= SNDRV_CARDS %s\n", pr_info("DEBUG ERROR: devno >= SNDRV_CARDS %s\n", __func__);
__func__);
return -ENODEV; return -ENODEV;
} }
if (!enable[devno]) { if (!enable[devno]) {
++devno; ++devno;
printk(KERN_INFO "DEBUG ERROR: !enable[devno] %s\n", __func__); pr_info("DEBUG ERROR: !enable[devno] %s\n", __func__);
return -ENOENT; return -ENOENT;
} }
err = snd_card_create(index[devno], id[devno], THIS_MODULE, err = snd_card_create(index[devno], id[devno], THIS_MODULE,
sizeof(struct cx25821_audio_dev), &card); sizeof(struct cx25821_audio_dev), &card);
if (err < 0) { if (err < 0) {
printk(KERN_INFO pr_info("DEBUG ERROR: cannot create snd_card_new in %s\n",
"DEBUG ERROR: cannot create snd_card_new in %s\n",
__func__); __func__);
return err; return err;
} }
...@@ -712,15 +711,14 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) ...@@ -712,15 +711,14 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
IRQF_SHARED | IRQF_DISABLED, chip->dev->name, chip); IRQF_SHARED | IRQF_DISABLED, chip->dev->name, chip);
if (err < 0) { 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); chip->dev->name, dev->pci->irq);
goto error; goto error;
} }
err = snd_cx25821_pcm(chip, 0, "cx25821 Digital"); err = snd_cx25821_pcm(chip, 0, "cx25821 Digital");
if (err < 0) { if (err < 0) {
printk(KERN_INFO pr_info("DEBUG ERROR: cannot create snd_cx25821_pcm %s\n",
"DEBUG ERROR: cannot create snd_cx25821_pcm %s\n",
__func__); __func__);
goto error; goto error;
} }
...@@ -732,12 +730,12 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) ...@@ -732,12 +730,12 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
chip->iobase, chip->irq); chip->iobase, chip->irq);
strcpy(card->mixername, "CX25821"); strcpy(card->mixername, "CX25821");
printk(KERN_INFO "%s/%i: ALSA support for cx25821 boards\n", pr_info("%s/%i: ALSA support for cx25821 boards\n",
card->driver, devno); card->driver, devno);
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0) {
printk(KERN_INFO "DEBUG ERROR: cannot register sound card %s\n", pr_info("DEBUG ERROR: cannot register sound card %s\n",
__func__); __func__);
goto error; goto error;
} }
...@@ -778,8 +776,7 @@ static int cx25821_alsa_init(void) ...@@ -778,8 +776,7 @@ static int cx25821_alsa_init(void)
} }
if (dev == NULL) if (dev == NULL)
printk(KERN_INFO pr_info("ERROR ALSA: no cx25821 cards found\n");
"cx25821 ERROR ALSA: no cx25821 cards found\n");
return 0; return 0;
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821-video.h" #include "cx25821-video.h"
#include "cx25821-audio-upstream.h" #include "cx25821-audio-upstream.h"
...@@ -221,7 +223,7 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) ...@@ -221,7 +223,7 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
if (!dev->_audio_is_running) { if (!dev->_audio_is_running) {
printk(KERN_DEBUG printk(KERN_DEBUG
"cx25821: No audio file is currently running so return!\n"); pr_fmt("No audio file is currently running so return!\n"));
return; return;
} }
/* Disable RISC interrupts */ /* Disable RISC interrupts */
...@@ -281,19 +283,19 @@ int cx25821_get_audio_data(struct cx25821_dev *dev, ...@@ -281,19 +283,19 @@ int cx25821_get_audio_data(struct cx25821_dev *dev,
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_audiofilename, open_errno); __func__, dev->_audiofilename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR "%s: File has no file operations registered!\n", pr_err("%s(): File has no file operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk(KERN_ERR "%s: File has no READ operations registered!\n", pr_err("%s(): File has no READ operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -320,8 +322,7 @@ int cx25821_get_audio_data(struct cx25821_dev *dev, ...@@ -320,8 +322,7 @@ int cx25821_get_audio_data(struct cx25821_dev *dev,
frame_offset += vfs_read_retval; frame_offset += vfs_read_retval;
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
"Done: exit %s() since no more bytes to read from Audio file.\n",
__func__); __func__);
break; break;
} }
...@@ -346,7 +347,7 @@ static void cx25821_audioups_handler(struct work_struct *work) ...@@ -346,7 +347,7 @@ static void cx25821_audioups_handler(struct work_struct *work)
container_of(work, struct cx25821_dev, _audio_work_entry); container_of(work, struct cx25821_dev, _audio_work_entry);
if (!dev) { if (!dev) {
printk(KERN_ERR "ERROR %s(): since container_of(work_struct) FAILED!\n", pr_err("ERROR %s(): since container_of(work_struct) FAILED!\n",
__func__); __func__);
return; return;
} }
...@@ -373,19 +374,19 @@ int cx25821_openfile_audio(struct cx25821_dev *dev, ...@@ -373,19 +374,19 @@ int cx25821_openfile_audio(struct cx25821_dev *dev,
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_audiofilename, open_errno); __func__, dev->_audiofilename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR "%s: File has no file operations registered!\n", pr_err("%s(): File has no file operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk(KERN_ERR "%s: File has no READ operations registered!\n", pr_err("%s(): File has no READ operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -414,8 +415,7 @@ int cx25821_openfile_audio(struct cx25821_dev *dev, ...@@ -414,8 +415,7 @@ int cx25821_openfile_audio(struct cx25821_dev *dev,
offset += vfs_read_retval; offset += vfs_read_retval;
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
"Done: exit %s() since no more bytes to read from Audio file.\n",
__func__); __func__);
break; break;
} }
...@@ -459,7 +459,7 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -459,7 +459,7 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
if (!dev->_risc_virt_addr) { if (!dev->_risc_virt_addr) {
printk(KERN_DEBUG printk(KERN_DEBUG
"cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning.\n"); pr_fmt("ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning\n"));
return -ENOMEM; return -ENOMEM;
} }
/* Clear out memory at address */ /* Clear out memory at address */
...@@ -474,7 +474,7 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -474,7 +474,7 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
if (!dev->_audiodata_buf_virt_addr) { if (!dev->_audiodata_buf_virt_addr) {
printk(KERN_DEBUG printk(KERN_DEBUG
"cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning.\n"); pr_fmt("ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning\n"));
return -ENOMEM; return -ENOMEM;
} }
/* Clear out memory at address */ /* Clear out memory at address */
...@@ -490,7 +490,7 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -490,7 +490,7 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
dev->_audio_lines_count); dev->_audio_lines_count);
if (ret < 0) { if (ret < 0) {
printk(KERN_DEBUG printk(KERN_DEBUG
"cx25821 ERROR creating audio upstream RISC programs!\n"); pr_fmt("ERROR creating audio upstream RISC programs!\n"));
goto error; goto error;
} }
...@@ -569,15 +569,15 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -569,15 +569,15 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
spin_unlock(&dev->slock); spin_unlock(&dev->slock);
} else { } else {
if (status & FLD_AUD_SRC_OF) if (status & FLD_AUD_SRC_OF)
printk(KERN_WARNING "%s: Audio Received Overflow Error Interrupt!\n", pr_warn("%s(): Audio Received Overflow Error Interrupt!\n",
__func__); __func__);
if (status & FLD_AUD_SRC_SYNC) if (status & FLD_AUD_SRC_SYNC)
printk(KERN_WARNING "%s: Audio Received Sync Error Interrupt!\n", pr_warn("%s(): Audio Received Sync Error Interrupt!\n",
__func__); __func__);
if (status & FLD_AUD_SRC_OPC_ERR) if (status & FLD_AUD_SRC_OPC_ERR)
printk(KERN_WARNING "%s: Audio Received OpCode Error Interrupt!\n", pr_warn("%s(): Audio Received OpCode Error Interrupt!\n",
__func__); __func__);
/* Read and write back the interrupt status register to clear /* Read and write back the interrupt status register to clear
...@@ -586,7 +586,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -586,7 +586,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
} }
if (dev->_audiofile_status == END_OF_FILE) { if (dev->_audiofile_status == END_OF_FILE) {
printk(KERN_WARNING "cx25821: EOF Channel Audio Framecount = %d\n", pr_warn("EOF Channel Audio Framecount = %d\n",
dev->_audioframe_count); dev->_audioframe_count);
return -1; return -1;
} }
...@@ -644,8 +644,7 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev, ...@@ -644,8 +644,7 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
/* 10 millisecond timeout */ /* 10 millisecond timeout */
if (count++ > 1000) { if (count++ > 1000) {
printk(KERN_ERR pr_err("ERROR: %s() fifo is NOT turned on. Timeout!\n",
"cx25821 ERROR: %s() fifo is NOT turned on. Timeout!\n",
__func__); __func__);
return; return;
} }
...@@ -696,8 +695,8 @@ int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev, ...@@ -696,8 +695,8 @@ int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
request_irq(dev->pci->irq, cx25821_upstream_irq_audio, request_irq(dev->pci->irq, cx25821_upstream_irq_audio,
IRQF_SHARED | IRQF_DISABLED, dev->name, dev); IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "%s: can't get upstream IRQ %d\n", dev->name, pr_err("%s: can't get upstream IRQ %d\n",
dev->pci->irq); dev->name, dev->pci->irq);
goto fail_irq; goto fail_irq;
} }
...@@ -726,7 +725,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) ...@@ -726,7 +725,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
int str_length = 0; int str_length = 0;
if (dev->_audio_is_running) { if (dev->_audio_is_running) {
printk(KERN_WARNING "Audio Channel is still running so return!\n"); pr_warn("Audio Channel is still running so return!\n");
return 0; return 0;
} }
...@@ -740,7 +739,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) ...@@ -740,7 +739,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
if (!dev->_irq_audio_queues) { if (!dev->_irq_audio_queues) {
printk(KERN_DEBUG printk(KERN_DEBUG
"cx25821 ERROR: create_singlethread_workqueue() for Audio FAILED!\n"); pr_fmt("ERROR: create_singlethread_workqueue() for Audio FAILED!\n"));
return -ENOMEM; return -ENOMEM;
} }
...@@ -787,8 +786,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) ...@@ -787,8 +786,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
retval = retval =
cx25821_audio_upstream_buffer_prepare(dev, sram_ch, _line_size); cx25821_audio_upstream_buffer_prepare(dev, sram_ch, _line_size);
if (retval < 0) { if (retval < 0) {
printk(KERN_ERR pr_err("%s: Failed to set up Audio upstream buffers!\n",
"%s: Failed to set up Audio upstream buffers!\n",
dev->name); dev->name);
goto error; goto error;
} }
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
......
This diff is collapsed.
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821.h" #include "cx25821.h"
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -32,10 +34,11 @@ static unsigned int i2c_scan; ...@@ -32,10 +34,11 @@ static unsigned int i2c_scan;
module_param(i2c_scan, int, 0444); module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
#define dprintk(level, fmt, arg...)\ #define dprintk(level, fmt, arg...) \
do { if (i2c_debug >= level)\ do { \
printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ if (i2c_debug >= level) \
} while (0) printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \
} while (0)
#define I2C_WAIT_DELAY 32 #define I2C_WAIT_DELAY 32
#define I2C_WAIT_RETRY 64 #define I2C_WAIT_RETRY 64
...@@ -98,7 +101,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, ...@@ -98,7 +101,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
if (!i2c_slave_did_ack(i2c_adap)) if (!i2c_slave_did_ack(i2c_adap))
return -EIO; return -EIO;
dprintk(1, "%s() returns 0\n", __func__); dprintk(1, "%s(): returns 0\n", __func__);
return 0; return 0;
} }
...@@ -163,7 +166,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, ...@@ -163,7 +166,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
retval = -EIO; retval = -EIO;
err: err:
if (i2c_debug) if (i2c_debug)
printk(KERN_ERR " ERR: %d\n", retval); pr_err(" ERR: %d\n", retval);
return retval; return retval;
} }
...@@ -187,7 +190,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, ...@@ -187,7 +190,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
if (!i2c_slave_did_ack(i2c_adap)) if (!i2c_slave_did_ack(i2c_adap))
return -EIO; return -EIO;
dprintk(1, "%s() returns 0\n", __func__); dprintk(1, "%s(): returns 0\n", __func__);
return 0; return 0;
} }
...@@ -227,7 +230,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, ...@@ -227,7 +230,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
retval = -EIO; retval = -EIO;
err: err:
if (i2c_debug) if (i2c_debug)
printk(KERN_ERR " ERR: %d\n", retval); pr_err(" ERR: %d\n", retval);
return retval; return retval;
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821.h" #include "cx25821.h"
#include "cx25821-medusa-video.h" #include "cx25821-medusa-video.h"
#include "cx25821-biffuncs.h" #include "cx25821-biffuncs.h"
...@@ -499,8 +501,7 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width, ...@@ -499,8 +501,7 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width,
/* validate the width - cannot be negative */ /* validate the width - cannot be negative */
if (width > MAX_WIDTH) { if (width > MAX_WIDTH) {
printk pr_info("%s(): width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n",
("cx25821 %s() : width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n",
__func__, width, MAX_WIDTH); __func__, width, MAX_WIDTH);
width = MAX_WIDTH; width = MAX_WIDTH;
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821-video.h" #include "cx25821-video.h"
#include "cx25821-video-upstream-ch2.h" #include "cx25821-video-upstream-ch2.h"
...@@ -211,8 +213,7 @@ void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev) ...@@ -211,8 +213,7 @@ void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev)
u32 tmp = 0; u32 tmp = 0;
if (!dev->_is_running_ch2) { if (!dev->_is_running_ch2) {
printk pr_info("No video file is currently running so return!\n");
("cx25821: No video file is currently running so return!\n");
return; return;
} }
/* Disable RISC interrupts */ /* Disable RISC interrupts */
...@@ -301,19 +302,19 @@ int cx25821_get_frame_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -301,19 +302,19 @@ int cx25821_get_frame_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch)
myfile = filp_open(dev->_filename_ch2, O_RDONLY | O_LARGEFILE, 0); myfile = filp_open(dev->_filename_ch2, O_RDONLY | O_LARGEFILE, 0);
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk("%s(): ERROR opening file(%s) with errno = %d!\n", pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename_ch2, open_errno); __func__, dev->_filename_ch2, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk("%s: File has no file operations registered!", pr_err("%s(): File has no file operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk("%s: File has no READ operations registered!", pr_err("%s(): File has no READ operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -340,8 +341,7 @@ int cx25821_get_frame_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -340,8 +341,7 @@ int cx25821_get_frame_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch)
frame_offset += vfs_read_retval; frame_offset += vfs_read_retval;
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO pr_info("Done: exit %s() since no more bytes to read from Video file\n",
"Done: exit %s() since no more bytes to read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -366,7 +366,7 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work) ...@@ -366,7 +366,7 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work)
container_of(work, struct cx25821_dev, _irq_work_entry_ch2); container_of(work, struct cx25821_dev, _irq_work_entry_ch2);
if (!dev) { if (!dev) {
printk("ERROR %s(): since container_of(work_struct) FAILED!\n", pr_err("ERROR %s(): since container_of(work_struct) FAILED!\n",
__func__); __func__);
return; return;
} }
...@@ -393,20 +393,19 @@ int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -393,20 +393,19 @@ int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk("%s(): ERROR opening file(%s) with errno = %d!\n", pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename_ch2, open_errno); __func__, dev->_filename_ch2, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk("%s: File has no file operations registered!", pr_err("%s(): File has no file operations registered!\n",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk pr_err("%s(): File has no READ operations registered! Returning\n",
("%s: File has no READ operations registered! Returning.",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -435,8 +434,7 @@ int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -435,8 +434,7 @@ int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch)
offset += vfs_read_retval; offset += vfs_read_retval;
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO pr_info("Done: exit %s() since no more bytes to read from Video file\n",
"Done: exit %s() since no more bytes to read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -483,8 +481,7 @@ static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev, ...@@ -483,8 +481,7 @@ static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev,
dev->_risc_size_ch2 = dev->upstream_riscbuf_size_ch2; dev->_risc_size_ch2 = dev->upstream_riscbuf_size_ch2;
if (!dev->_dma_virt_addr_ch2) { if (!dev->_dma_virt_addr_ch2) {
printk pr_err("FAILED to allocate memory for Risc buffer! Returning\n");
("cx25821: FAILED to allocate memory for Risc buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -504,8 +501,7 @@ static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev, ...@@ -504,8 +501,7 @@ static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev,
dev->_data_buf_size_ch2 = dev->upstream_databuf_size_ch2; dev->_data_buf_size_ch2 = dev->upstream_databuf_size_ch2;
if (!dev->_data_buf_virt_addr_ch2) { if (!dev->_data_buf_virt_addr_ch2) {
printk pr_err("FAILED to allocate memory for data buffer! Returning\n");
("cx25821: FAILED to allocate memory for data buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -521,8 +517,7 @@ static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev, ...@@ -521,8 +517,7 @@ static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev,
cx25821_risc_buffer_upstream_ch2(dev, dev->pci, 0, bpl, cx25821_risc_buffer_upstream_ch2(dev, dev->pci, 0, bpl,
dev->_lines_count_ch2); dev->_lines_count_ch2);
if (ret < 0) { if (ret < 0) {
printk(KERN_INFO pr_info("Failed creating Video Upstream Risc programs!\n");
"cx25821: Failed creating Video Upstream Risc programs!\n");
goto error; goto error;
} }
...@@ -602,7 +597,7 @@ int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num, ...@@ -602,7 +597,7 @@ int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num,
} }
if (dev->_file_status_ch2 == END_OF_FILE) { if (dev->_file_status_ch2 == END_OF_FILE) {
printk("cx25821: EOF Channel 2 Framecount = %d\n", pr_info("EOF Channel 2 Framecount = %d\n",
dev->_frame_count_ch2); dev->_frame_count_ch2);
return -1; return -1;
} }
...@@ -714,8 +709,8 @@ int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev, ...@@ -714,8 +709,8 @@ int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev,
request_irq(dev->pci->irq, cx25821_upstream_irq_ch2, request_irq(dev->pci->irq, cx25821_upstream_irq_ch2,
IRQF_SHARED | IRQF_DISABLED, dev->name, dev); IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "%s: can't get upstream IRQ %d\n", dev->name, pr_err("%s: can't get upstream IRQ %d\n",
dev->pci->irq); dev->name, dev->pci->irq);
goto fail_irq; goto fail_irq;
} }
/* Start the DMA engine */ /* Start the DMA engine */
...@@ -744,7 +739,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, ...@@ -744,7 +739,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
int str_length = 0; int str_length = 0;
if (dev->_is_running_ch2) { if (dev->_is_running_ch2) {
printk("Video Channel is still running so return!\n"); pr_info("Video Channel is still running so return!\n");
return 0; return 0;
} }
...@@ -756,8 +751,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, ...@@ -756,8 +751,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
create_singlethread_workqueue("cx25821_workqueue2"); create_singlethread_workqueue("cx25821_workqueue2");
if (!dev->_irq_queues_ch2) { if (!dev->_irq_queues_ch2) {
printk pr_err("create_singlethread_workqueue() for Video FAILED!\n");
("cx25821: create_singlethread_workqueue() for Video FAILED!\n");
return -ENOMEM; return -ENOMEM;
} }
/* /*
...@@ -829,8 +823,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, ...@@ -829,8 +823,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
cx25821_upstream_buffer_prepare_ch2(dev, sram_ch, cx25821_upstream_buffer_prepare_ch2(dev, sram_ch,
dev->_line_size_ch2); dev->_line_size_ch2);
if (retval < 0) { if (retval < 0) {
printk(KERN_ERR pr_err("%s: Failed to set up Video upstream buffers!\n",
"%s: Failed to set up Video upstream buffers!\n",
dev->name); dev->name);
goto error; goto error;
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821-video.h" #include "cx25821-video.h"
#include "cx25821-video-upstream.h" #include "cx25821-video-upstream.h"
...@@ -257,8 +259,7 @@ void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) ...@@ -257,8 +259,7 @@ void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev)
u32 tmp = 0; u32 tmp = 0;
if (!dev->_is_running) { if (!dev->_is_running) {
printk pr_info("No video file is currently running so return!\n");
(KERN_INFO "cx25821: No video file is currently running so return!\n");
return; return;
} }
/* Disable RISC interrupts */ /* Disable RISC interrupts */
...@@ -346,22 +347,19 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -346,22 +347,19 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
"%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename, open_errno); __func__, dev->_filename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR pr_err("%s(): File has no file operations registered!\n",
"%s: File has no file operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk(KERN_ERR pr_err("%s(): File has no READ operations registered!\n",
"%s: File has no READ operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -388,9 +386,7 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -388,9 +386,7 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch)
frame_offset += vfs_read_retval; frame_offset += vfs_read_retval;
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO pr_info("Done: exit %s() since no more bytes to read from Video file\n",
"Done: exit %s() since no more bytes to \
read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -415,8 +411,7 @@ static void cx25821_vidups_handler(struct work_struct *work) ...@@ -415,8 +411,7 @@ static void cx25821_vidups_handler(struct work_struct *work)
container_of(work, struct cx25821_dev, _irq_work_entry); container_of(work, struct cx25821_dev, _irq_work_entry);
if (!dev) { if (!dev) {
printk(KERN_ERR pr_err("ERROR %s(): since container_of(work_struct) FAILED!\n",
"ERROR %s(): since container_of(work_struct) FAILED!\n",
__func__); __func__);
return; return;
} }
...@@ -443,22 +438,19 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -443,22 +438,19 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename, open_errno); __func__, dev->_filename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR pr_err("%s(): File has no file operations registered!\n",
"%s: File has no file operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk(KERN_ERR pr_err("%s(): File has no READ operations registered! Returning\n",
"%s: File has no READ operations registered! \
Returning.",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -487,9 +479,7 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -487,9 +479,7 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
offset += vfs_read_retval; offset += vfs_read_retval;
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO pr_info("Done: exit %s() since no more bytes to read from Video file\n",
"Done: exit %s() since no more \
bytes to read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -534,9 +524,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -534,9 +524,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
dev->_risc_size = dev->upstream_riscbuf_size; dev->_risc_size = dev->upstream_riscbuf_size;
if (!dev->_dma_virt_addr) { if (!dev->_dma_virt_addr) {
printk pr_err("FAILED to allocate memory for Risc buffer! Returning\n");
(KERN_ERR "cx25821: FAILED to allocate memory for Risc \
buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -556,9 +544,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -556,9 +544,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
dev->_data_buf_size = dev->upstream_databuf_size; dev->_data_buf_size = dev->upstream_databuf_size;
if (!dev->_data_buf_virt_addr) { if (!dev->_data_buf_virt_addr) {
printk pr_err("FAILED to allocate memory for data buffer! Returning\n");
(KERN_ERR "cx25821: FAILED to allocate memory for data \
buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -574,8 +560,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -574,8 +560,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
cx25821_risc_buffer_upstream(dev, dev->pci, 0, bpl, cx25821_risc_buffer_upstream(dev, dev->pci, 0, bpl,
dev->_lines_count); dev->_lines_count);
if (ret < 0) { if (ret < 0) {
printk(KERN_INFO pr_info("Failed creating Video Upstream Risc programs!\n");
"cx25821: Failed creating Video Upstream Risc programs!\n");
goto error; goto error;
} }
...@@ -652,22 +637,20 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -652,22 +637,20 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num,
spin_unlock(&dev->slock); spin_unlock(&dev->slock);
} else { } else {
if (status & FLD_VID_SRC_UF) if (status & FLD_VID_SRC_UF)
printk pr_err("%s(): Video Received Underflow Error Interrupt!\n",
(KERN_ERR "%s: Video Received Underflow Error \ __func__);
Interrupt!\n", __func__);
if (status & FLD_VID_SRC_SYNC) if (status & FLD_VID_SRC_SYNC)
printk(KERN_ERR "%s: Video Received Sync Error \ pr_err("%s(): Video Received Sync Error Interrupt!\n",
Interrupt!\n", __func__); __func__);
if (status & FLD_VID_SRC_OPC_ERR) if (status & FLD_VID_SRC_OPC_ERR)
printk(KERN_ERR "%s: Video Received OpCode Error \ pr_err("%s(): Video Received OpCode Error Interrupt!\n",
Interrupt!\n", __func__); __func__);
} }
if (dev->_file_status == END_OF_FILE) { if (dev->_file_status == END_OF_FILE) {
printk(KERN_ERR "cx25821: EOF Channel 1 Framecount = %d\n", pr_err("EOF Channel 1 Framecount = %d\n", dev->_frame_count);
dev->_frame_count);
return -1; return -1;
} }
/* ElSE, set the interrupt mask register, re-enable irq. */ /* ElSE, set the interrupt mask register, re-enable irq. */
...@@ -775,8 +758,8 @@ int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, ...@@ -775,8 +758,8 @@ int cx25821_start_video_dma_upstream(struct cx25821_dev *dev,
request_irq(dev->pci->irq, cx25821_upstream_irq, request_irq(dev->pci->irq, cx25821_upstream_irq,
IRQF_SHARED | IRQF_DISABLED, dev->name, dev); IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "%s: can't get upstream IRQ %d\n", dev->name, pr_err("%s: can't get upstream IRQ %d\n",
dev->pci->irq); dev->name, dev->pci->irq);
goto fail_irq; goto fail_irq;
} }
...@@ -806,7 +789,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, ...@@ -806,7 +789,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
int str_length = 0; int str_length = 0;
if (dev->_is_running) { if (dev->_is_running) {
printk(KERN_INFO "Video Channel is still running so return!\n"); pr_info("Video Channel is still running so return!\n");
return 0; return 0;
} }
...@@ -817,9 +800,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, ...@@ -817,9 +800,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
dev->_irq_queues = create_singlethread_workqueue("cx25821_workqueue"); dev->_irq_queues = create_singlethread_workqueue("cx25821_workqueue");
if (!dev->_irq_queues) { if (!dev->_irq_queues) {
printk pr_err("create_singlethread_workqueue() for Video FAILED!\n");
(KERN_ERR "cx25821: create_singlethread_workqueue() for \
Video FAILED!\n");
return -ENOMEM; return -ENOMEM;
} }
/* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for
...@@ -895,8 +876,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, ...@@ -895,8 +876,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
/* Allocating buffers and prepare RISC program */ /* Allocating buffers and prepare RISC program */
retval = cx25821_upstream_buffer_prepare(dev, sram_ch, dev->_line_size); retval = cx25821_upstream_buffer_prepare(dev, sram_ch, dev->_line_size);
if (retval < 0) { if (retval < 0) {
printk(KERN_ERR pr_err("%s: Failed to set up Video upstream buffers!\n",
"%s: Failed to set up Video upstream buffers!\n",
dev->name); dev->name);
goto error; goto error;
} }
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821-video.h" #include "cx25821-video.h"
MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards"); MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards");
...@@ -104,7 +106,7 @@ struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc) ...@@ -104,7 +106,7 @@ struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc)
if (formats[i].fourcc == fourcc) if (formats[i].fourcc == fourcc)
return formats + i; return formats + i;
printk(KERN_ERR "%s(0x%08x) NOT FOUND\n", __func__, fourcc); pr_err("%s(0x%08x) NOT FOUND\n", __func__, fourcc);
return NULL; return NULL;
} }
...@@ -159,15 +161,15 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q, ...@@ -159,15 +161,15 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q,
else else
mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT);
if (bc != 1) if (bc != 1)
printk(KERN_ERR "%s: %d buffers handled (should be 1)\n", pr_err("%s: %d buffers handled (should be 1)\n",
__func__, bc); __func__, bc);
} }
#ifdef TUNER_FLAG #ifdef TUNER_FLAG
int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm) int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
{ {
dprintk(1, "%s(norm = 0x%08x) name: [%s]\n", __func__, dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
(unsigned int)norm, v4l2_norm_to_name(norm)); __func__, (unsigned int)norm, v4l2_norm_to_name(norm));
dev->tvnorm = norm; dev->tvnorm = norm;
...@@ -267,7 +269,7 @@ int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input) ...@@ -267,7 +269,7 @@ int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input)
struct v4l2_routing route; struct v4l2_routing route;
memset(&route, 0, sizeof(route)); memset(&route, 0, sizeof(route));
dprintk(1, "%s() video_mux: %d [vmux=%d, gpio=0x%x,0x%x,0x%x,0x%x]\n", dprintk(1, "%s(): video_mux: %d [vmux=%d, gpio=0x%x,0x%x,0x%x,0x%x]\n",
__func__, input, INPUT(input)->vmux, INPUT(input)->gpio0, __func__, input, INPUT(input)->vmux, INPUT(input)->gpio0,
INPUT(input)->gpio1, INPUT(input)->gpio2, INPUT(input)->gpio3); INPUT(input)->gpio1, INPUT(input)->gpio2, INPUT(input)->gpio3);
dev->input = input; dev->input = input;
...@@ -400,7 +402,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) ...@@ -400,7 +402,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
/* risc op code error */ /* risc op code error */
if (status & (1 << 16)) { if (status & (1 << 16)) {
printk(KERN_WARNING "%s, %s: video risc op code error\n", pr_warn("%s, %s: video risc op code error\n",
dev->name, channel->name); dev->name, channel->name);
cx_clear(channel->dma_ctl, 0x11); cx_clear(channel->dma_ctl, 0x11);
cx25821_sram_channel_dump(dev, channel); cx25821_sram_channel_dump(dev, channel);
...@@ -458,7 +460,7 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) ...@@ -458,7 +460,7 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
btcx_riscmem_free(dev->pci, btcx_riscmem_free(dev->pci,
&dev->channels[chan_num].vidq.stopper); &dev->channels[chan_num].vidq.stopper);
printk(KERN_WARNING "device %d released!\n", chan_num); pr_warn("device %d released!\n", chan_num);
} }
} }
...@@ -590,7 +592,7 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -590,7 +592,7 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
init_buffer = 1; init_buffer = 1;
rc = videobuf_iolock(q, &buf->vb, NULL); rc = videobuf_iolock(q, &buf->vb, NULL);
if (0 != rc) { if (0 != rc) {
printk(KERN_DEBUG "videobuf_iolock failed!\n"); printk(KERN_DEBUG pr_fmt("videobuf_iolock failed!\n"));
goto fail; goto fail;
} }
} }
...@@ -1038,7 +1040,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -1038,7 +1040,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
dev->channels[fh->channel_id].cif_width = fh->width; dev->channels[fh->channel_id].cif_width = fh->width;
medusa_set_resolution(dev, fh->width, SRAM_CH00); medusa_set_resolution(dev, fh->width, SRAM_CH00);
dprintk(2, "%s() width=%d height=%d field=%d\n", __func__, fh->width, dprintk(2, "%s(): width=%d height=%d field=%d\n", __func__, fh->width,
fh->height, fh->vidq.field); fh->height, fh->vidq.field);
v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED); v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED);
cx25821_call_all(dev, video, s_mbus_fmt, &mbus_fmt); cx25821_call_all(dev, video, s_mbus_fmt, &mbus_fmt);
...@@ -1070,13 +1072,13 @@ static int vidioc_log_status(struct file *file, void *priv) ...@@ -1070,13 +1072,13 @@ static int vidioc_log_status(struct file *file, void *priv)
u32 tmp = 0; u32 tmp = 0;
snprintf(name, sizeof(name), "%s/2", dev->name); snprintf(name, sizeof(name), "%s/2", dev->name);
printk(KERN_INFO "%s/2: ============ START LOG STATUS ============\n", pr_info("%s/2: ============ START LOG STATUS ============\n",
dev->name); dev->name);
cx25821_call_all(dev, core, log_status); cx25821_call_all(dev, core, log_status);
tmp = cx_read(sram_ch->dma_ctl); tmp = cx_read(sram_ch->dma_ctl);
printk(KERN_INFO "Video input 0 is %s\n", pr_info("Video input 0 is %s\n",
(tmp & 0x11) ? "streaming" : "stopped"); (tmp & 0x11) ? "streaming" : "stopped");
printk(KERN_INFO "%s/2: ============= END LOG STATUS =============\n", pr_info("%s/2: ============= END LOG STATUS =============\n",
dev->name); dev->name);
return 0; return 0;
} }
...@@ -1319,7 +1321,7 @@ int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i) ...@@ -1319,7 +1321,7 @@ int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
*i = dev->input; *i = dev->input;
dprintk(1, "%s() returns %d\n", __func__, *i); dprintk(1, "%s(): returns %d\n", __func__, *i);
return 0; return 0;
} }
...@@ -1339,7 +1341,7 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) ...@@ -1339,7 +1341,7 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
} }
if (i > 2) { if (i > 2) {
dprintk(1, "%s() -EINVAL\n", __func__); dprintk(1, "%s(): -EINVAL\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -1390,7 +1392,7 @@ int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_freque ...@@ -1390,7 +1392,7 @@ int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_freque
if (0 != err) if (0 != err)
return err; return err;
} else { } else {
printk(KERN_ERR "Invalid fh pointer!\n"); pr_err("Invalid fh pointer!\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1734,9 +1736,7 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd, ...@@ -1734,9 +1736,7 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd,
data_from_user = (struct upstream_user_struct *)arg; data_from_user = (struct upstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk pr_err("%s(): Upstream data is INVALID. Returning\n", __func__);
("cx25821 in %s(): Upstream data is INVALID. Returning.\n",
__func__);
return 0; return 0;
} }
...@@ -1777,9 +1777,7 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd, ...@@ -1777,9 +1777,7 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd,
data_from_user = (struct upstream_user_struct *)arg; data_from_user = (struct upstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk pr_err("%s(): Upstream data is INVALID. Returning\n", __func__);
("cx25821 in %s(): Upstream data is INVALID. Returning.\n",
__func__);
return 0; return 0;
} }
...@@ -1820,9 +1818,7 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd, ...@@ -1820,9 +1818,7 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,
data_from_user = (struct upstream_user_struct *)arg; data_from_user = (struct upstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk pr_err("%s(): Upstream data is INVALID. Returning\n", __func__);
("cx25821 in %s(): Upstream data is INVALID. Returning.\n",
__func__);
return 0; return 0;
} }
...@@ -1867,9 +1863,7 @@ static long video_ioctl_set(struct file *file, unsigned int cmd, ...@@ -1867,9 +1863,7 @@ static long video_ioctl_set(struct file *file, unsigned int cmd,
data_from_user = (struct downstream_user_struct *)arg; data_from_user = (struct downstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk( pr_err("%s(): User data is INVALID. Returning\n", __func__);
"cx25821 in %s(): User data is INVALID. Returning.\n",
__func__);
return 0; return 0;
} }
......
...@@ -49,10 +49,11 @@ ...@@ -49,10 +49,11 @@
#define VIDEO_DEBUG 0 #define VIDEO_DEBUG 0
#define dprintk(level, fmt, arg...)\ #define dprintk(level, fmt, arg...) \
do { if (VIDEO_DEBUG >= level)\ do { \
printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ if (VIDEO_DEBUG >= level) \
} while (0) printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \
} while (0)
/* For IOCTL to identify running upstream */ /* For IOCTL to identify running upstream */
#define UPSTREAM_START_VIDEO 700 #define UPSTREAM_START_VIDEO 700
......
...@@ -519,9 +519,12 @@ extern struct sram_channel cx25821_sram_channels[]; ...@@ -519,9 +519,12 @@ extern struct sram_channel cx25821_sram_channels[];
#define Set_GPIO_Bit(Bit) (1 << Bit) #define Set_GPIO_Bit(Bit) (1 << Bit)
#define Clear_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_ERR(fmt, args...) \
#define CX25821_WARN(fmt, args...) printk(KERN_WARNING "cx25821(%d): " fmt, dev->board , ## args) pr_err("(%d): " fmt, dev->board, ##args)
#define CX25821_INFO(fmt, args...) printk(KERN_INFO "cx25821(%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 int cx25821_i2c_register(struct cx25821_i2c *bus);
extern void cx25821_card_setup(struct cx25821_dev *dev); extern void cx25821_card_setup(struct cx25821_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment