Commit 6795bf62 authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: ngene: convert kernellog printing from printk() to dev_*() macros

Convert all printk() and pr_*() kernel log printing to rather use the
dev_*() macros. Not only is it discouraged to use printk() (checkpatch
even complains about that), but also this helps identifying the exact PCI
device for any printed event, and it makes almost all printing shorter
in terms of code style since there's no need to use KERN_* DEVICE_NAME
any more (dev_*() will take care of this).

Since the dprintk macro define isn't used anymore, remove it.
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 37a59823
This diff is collapsed.
......@@ -51,8 +51,6 @@ MODULE_PARM_DESC(debug, "Print debugging information.");
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#define dprintk if (debug) printk
#define ngwriteb(dat, adr) writeb((dat), dev->iomem + (adr))
#define ngwritel(dat, adr) writel((dat), dev->iomem + (adr))
#define ngwriteb(dat, adr) writeb((dat), dev->iomem + (adr))
......@@ -86,6 +84,7 @@ static void event_tasklet(unsigned long data)
static void demux_tasklet(unsigned long data)
{
struct ngene_channel *chan = (struct ngene_channel *)data;
struct device *pdev = &chan->dev->pci_dev->dev;
struct SBufferHeader *Cur = chan->nextBuffer;
spin_lock_irq(&chan->state_lock);
......@@ -124,16 +123,15 @@ static void demux_tasklet(unsigned long data)
chan->HWState = HWSTATE_RUN;
}
} else {
printk(KERN_ERR DEVICE_NAME ": OOPS\n");
dev_err(pdev, "OOPS\n");
if (chan->HWState == HWSTATE_RUN) {
Cur->ngeneBuffer.SR.Flags &= ~0x40;
break; /* Stop processing stream */
}
}
if (chan->AudioDTOUpdated) {
printk(KERN_INFO DEVICE_NAME
": Update AudioDTO = %d\n",
chan->AudioDTOValue);
dev_info(pdev, "Update AudioDTO = %d\n",
chan->AudioDTOValue);
Cur->ngeneBuffer.SR.DTOUpdate =
chan->AudioDTOValue;
chan->AudioDTOUpdated = 0;
......@@ -173,6 +171,7 @@ static void demux_tasklet(unsigned long data)
static irqreturn_t irq_handler(int irq, void *dev_id)
{
struct ngene *dev = (struct ngene *)dev_id;
struct device *pdev = &dev->pci_dev->dev;
u32 icounts = 0;
irqreturn_t rc = IRQ_NONE;
u32 i = MAX_STREAM;
......@@ -213,7 +212,7 @@ static irqreturn_t irq_handler(int irq, void *dev_id)
*(dev->EventBuffer);
dev->EventQueueWriteIndex = nextWriteIndex;
} else {
printk(KERN_ERR DEVICE_NAME ": event overflow\n");
dev_err(pdev, "event overflow\n");
dev->EventQueueOverflowCount += 1;
dev->EventQueueOverflowFlag = 1;
}
......@@ -249,23 +248,25 @@ static irqreturn_t irq_handler(int irq, void *dev_id)
static void dump_command_io(struct ngene *dev)
{
struct device *pdev = &dev->pci_dev->dev;
u8 buf[8], *b;
ngcpyfrom(buf, HOST_TO_NGENE, 8);
printk(KERN_ERR "host_to_ngene (%04x): %*ph\n", HOST_TO_NGENE, 8, buf);
dev_err(pdev, "host_to_ngene (%04x): %*ph\n", HOST_TO_NGENE, 8, buf);
ngcpyfrom(buf, NGENE_TO_HOST, 8);
printk(KERN_ERR "ngene_to_host (%04x): %*ph\n", NGENE_TO_HOST, 8, buf);
dev_err(pdev, "ngene_to_host (%04x): %*ph\n", NGENE_TO_HOST, 8, buf);
b = dev->hosttongene;
printk(KERN_ERR "dev->hosttongene (%p): %*ph\n", b, 8, b);
dev_err(pdev, "dev->hosttongene (%p): %*ph\n", b, 8, b);
b = dev->ngenetohost;
printk(KERN_ERR "dev->ngenetohost (%p): %*ph\n", b, 8, b);
dev_err(pdev, "dev->ngenetohost (%p): %*ph\n", b, 8, b);
}
static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com)
{
struct device *pdev = &dev->pci_dev->dev;
int ret;
u8 *tmpCmdDoneByte;
......@@ -313,9 +314,8 @@ static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com)
if (!ret) {
/*ngwritel(0, FORCE_NMI);*/
printk(KERN_ERR DEVICE_NAME
": Command timeout cmd=%02x prev=%02x\n",
com->cmd.hdr.Opcode, dev->prev_cmd);
dev_err(pdev, "Command timeout cmd=%02x prev=%02x\n",
com->cmd.hdr.Opcode, dev->prev_cmd);
dump_command_io(dev);
return -1;
}
......@@ -553,6 +553,7 @@ static void clear_buffers(struct ngene_channel *chan)
static int ngene_command_stream_control(struct ngene *dev, u8 stream,
u8 control, u8 mode, u8 flags)
{
struct device *pdev = &dev->pci_dev->dev;
struct ngene_channel *chan = &dev->channel[stream];
struct ngene_command com;
u16 BsUVI = ((stream & 1) ? 0x9400 : 0x9300);
......@@ -572,8 +573,7 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream,
com.in_len = sizeof(struct FW_STREAM_CONTROL);
com.out_len = 0;
dprintk(KERN_INFO DEVICE_NAME
": Stream=%02x, Control=%02x, Mode=%02x\n",
dev_dbg(pdev, "Stream=%02x, Control=%02x, Mode=%02x\n",
com.cmd.StreamControl.Stream, com.cmd.StreamControl.Control,
com.cmd.StreamControl.Mode);
......@@ -695,23 +695,24 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream,
void set_transfer(struct ngene_channel *chan, int state)
{
struct device *pdev = &chan->dev->pci_dev->dev;
u8 control = 0, mode = 0, flags = 0;
struct ngene *dev = chan->dev;
int ret;
/*
printk(KERN_INFO DEVICE_NAME ": st %d\n", state);
dev_info(pdev, "st %d\n", state);
msleep(100);
*/
if (state) {
if (chan->running) {
printk(KERN_INFO DEVICE_NAME ": already running\n");
dev_info(pdev, "already running\n");
return;
}
} else {
if (!chan->running) {
printk(KERN_INFO DEVICE_NAME ": already stopped\n");
dev_info(pdev, "already stopped\n");
return;
}
}
......@@ -722,7 +723,7 @@ void set_transfer(struct ngene_channel *chan, int state)
if (state) {
spin_lock_irq(&chan->state_lock);
/* printk(KERN_INFO DEVICE_NAME ": lock=%08x\n",
/* dev_info(pdev, "lock=%08x\n",
ngreadl(0x9310)); */
dvb_ringbuffer_flush(&dev->tsout_rbuf);
control = 0x80;
......@@ -740,7 +741,7 @@ void set_transfer(struct ngene_channel *chan, int state)
chan->pBufferExchange = tsin_exchange;
spin_unlock_irq(&chan->state_lock);
}
/* else printk(KERN_INFO DEVICE_NAME ": lock=%08x\n",
/* else dev_info(pdev, "lock=%08x\n",
ngreadl(0x9310)); */
mutex_lock(&dev->stream_mutex);
......@@ -751,8 +752,7 @@ void set_transfer(struct ngene_channel *chan, int state)
if (!ret)
chan->running = state;
else
printk(KERN_ERR DEVICE_NAME ": set_transfer %d failed\n",
state);
dev_err(pdev, "%s %d failed\n", __func__, state);
if (!state) {
spin_lock_irq(&chan->state_lock);
chan->pBufferExchange = NULL;
......@@ -1195,6 +1195,7 @@ static int ngene_get_buffers(struct ngene *dev)
static void ngene_init(struct ngene *dev)
{
struct device *pdev = &dev->pci_dev->dev;
int i;
tasklet_init(&dev->event_tasklet, event_tasklet, (unsigned long)dev);
......@@ -1214,12 +1215,12 @@ static void ngene_init(struct ngene *dev)
dev->icounts = ngreadl(NGENE_INT_COUNTS);
dev->device_version = ngreadl(DEV_VER) & 0x0f;
printk(KERN_INFO DEVICE_NAME ": Device version %d\n",
dev->device_version);
dev_info(pdev, "Device version %d\n", dev->device_version);
}
static int ngene_load_firm(struct ngene *dev)
{
struct device *pdev = &dev->pci_dev->dev;
u32 size;
const struct firmware *fw = NULL;
u8 *ngene_fw;
......@@ -1253,21 +1254,18 @@ static int ngene_load_firm(struct ngene *dev)
}
if (request_firmware(&fw, fw_name, &dev->pci_dev->dev) < 0) {
printk(KERN_ERR DEVICE_NAME
": Could not load firmware file %s.\n", fw_name);
printk(KERN_INFO DEVICE_NAME
": Copy %s to your hotplug directory!\n", fw_name);
dev_err(pdev, "Could not load firmware file %s.\n", fw_name);
dev_info(pdev, "Copy %s to your hotplug directory!\n",
fw_name);
return -1;
}
if (size == 0)
size = fw->size;
if (size != fw->size) {
printk(KERN_ERR DEVICE_NAME
": Firmware %s has invalid size!", fw_name);
dev_err(pdev, "Firmware %s has invalid size!", fw_name);
err = -1;
} else {
printk(KERN_INFO DEVICE_NAME
": Loading firmware file %s.\n", fw_name);
dev_info(pdev, "Loading firmware file %s.\n", fw_name);
ngene_fw = (u8 *) fw->data;
err = ngene_command_load_firmware(dev, ngene_fw, size);
}
......@@ -1327,6 +1325,7 @@ static int ngene_buffer_config(struct ngene *dev)
static int ngene_start(struct ngene *dev)
{
struct device *pdev = &dev->pci_dev->dev;
int stat;
int i;
......@@ -1366,8 +1365,7 @@ static int ngene_start(struct ngene *dev)
free_irq(dev->pci_dev->irq, dev);
stat = pci_enable_msi(dev->pci_dev);
if (stat) {
printk(KERN_INFO DEVICE_NAME
": MSI not available\n");
dev_info(pdev, "MSI not available\n");
flags = IRQF_SHARED;
} else {
flags = 0;
......@@ -1570,6 +1568,7 @@ static const struct cxd2099_cfg cxd_cfgtmpl = {
static void cxd_attach(struct ngene *dev)
{
struct device *pdev = &dev->pci_dev->dev;
struct ngene_ci *ci = &dev->ci;
struct cxd2099_cfg cxd_cfg = cxd_cfgtmpl;
struct i2c_client *client;
......@@ -1600,7 +1599,7 @@ static void cxd_attach(struct ngene *dev)
err_i2c:
i2c_unregister_device(client);
err_ret:
printk(KERN_ERR DEVICE_NAME ": CXD2099AR attach failed\n");
dev_err(pdev, "CXD2099AR attach failed\n");
return;
}
......@@ -1648,7 +1647,7 @@ void ngene_shutdown(struct pci_dev *pdev)
if (!dev || !shutdown_workaround)
return;
printk(KERN_INFO DEVICE_NAME ": shutdown workaround...\n");
dev_info(&pdev->dev, "shutdown workaround...\n");
ngene_unlink(dev);
pci_disable_device(pdev);
}
......@@ -1688,7 +1687,7 @@ int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
dev->pci_dev = pci_dev;
dev->card_info = (struct ngene_info *)id->driver_data;
printk(KERN_INFO DEVICE_NAME ": Found %s\n", dev->card_info->name);
dev_info(&pci_dev->dev, "Found %s\n", dev->card_info->name);
pci_set_drvdata(pci_dev, dev);
......
......@@ -152,7 +152,9 @@ void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
stripped++;
if (ok % 100 == 0 && overflow)
printk(KERN_WARNING "%s: ok %u overflow %u dropped %u\n", __func__, ok, overflow, stripped);
dev_warn(&dev->pci_dev->dev,
"%s: ok %u overflow %u dropped %u\n",
__func__, ok, overflow, stripped);
#endif
buf += 188;
len -= 188;
......
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