* [PATCH 1/2] Staging: Comedi: dyna_pci10xx: Replace printk with dev_info
@ 2012-09-13 1:46 Bruce Humphrey
2012-09-13 8:00 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Humphrey @ 2012-09-13 1:46 UTC (permalink / raw)
To: abbotti, fmhess, gregkh
Cc: hsweeten, standby24x7, devel, linux-kernel, Bruce Humphrey
Replace printk(KERN_XXX with dev_info, dev_warn, dev_dbg as appropiate in dyna_pci10xx
Signed-off-by: Bruce Humphrey Ventura <brucehum@gmail.com>
---
drivers/staging/comedi/drivers/dyna_pci10xx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c
index 064be9a..bfa62d1 100644
--- a/drivers/staging/comedi/drivers/dyna_pci10xx.c
+++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c
@@ -140,8 +140,7 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev,
goto conv_finish;
}
data[n] = 0;
- printk(KERN_DEBUG "comedi: dyna_pci10xx: "
- "timeout reading analog input\n");
+ dev_dbg(dev->class_dev, "timeout reading analog input\n");
continue;
conv_finish:
/* mask the first 4 bits - EOC bits */
@@ -262,8 +261,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
int ret;
if (alloc_private(dev, sizeof(struct dyna_pci10xx_private)) < 0) {
- printk(KERN_ERR "comedi: dyna_pci10xx: "
- "failed to allocate memory!\n");
+ dev_err(dev->class_dev, "failed to allocate memory!\n");
return -ENOMEM;
}
@@ -276,14 +274,14 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
dev->irq = 0;
if (comedi_pci_enable(pcidev, DRV_NAME)) {
- printk(KERN_ERR "comedi: dyna_pci10xx: "
- "failed to enable PCI device and request regions!");
+ dev_err(dev->class_dev,
+ "failed to enable PCI device and request regions!\n");
return -EIO;
}
mutex_init(&devpriv->mutex);
- printk(KERN_INFO "comedi: dyna_pci10xx: device found!\n");
+ pr_info("comedi: dyna_pci10xx: device found!\n");
dev->iobase = pci_resource_start(pcidev, 2);
devpriv->BADR3 = pci_resource_start(pcidev, 3);
@@ -333,7 +331,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
s->state = 0;
s->insn_bits = dyna_pci10xx_do_insn_bits;
- printk(KERN_INFO "comedi: dyna_pci10xx: %s - device setup completed!\n",
+ dev_info(dev->class_dev, "%s - device setup completed!\n",
thisboard->name);
return 1;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] Staging: Comedi: dyna_pci10xx: Replace printk with dev_info
2012-09-13 1:46 [PATCH 1/2] Staging: Comedi: dyna_pci10xx: Replace printk with dev_info Bruce Humphrey
@ 2012-09-13 8:00 ` Dan Carpenter
[not found] ` <CAGzQFLgLkqOdfQjbz3LFArEZGxwiEA4nnpLLtCHaX3w=-=RbKw@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-09-13 8:00 UTC (permalink / raw)
To: Bruce Humphrey; +Cc: abbotti, fmhess, gregkh, devel, linux-kernel
On Thu, Sep 13, 2012 at 03:46:00AM +0200, Bruce Humphrey wrote:
> Replace printk(KERN_XXX with dev_info, dev_warn, dev_dbg as appropiate in dyna_pci10xx
>
> Signed-off-by: Bruce Humphrey Ventura <brucehum@gmail.com>
> ---
> drivers/staging/comedi/drivers/dyna_pci10xx.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c
> index 064be9a..bfa62d1 100644
> --- a/drivers/staging/comedi/drivers/dyna_pci10xx.c
> +++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c
> @@ -140,8 +140,7 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev,
> goto conv_finish;
> }
> data[n] = 0;
> - printk(KERN_DEBUG "comedi: dyna_pci10xx: "
> - "timeout reading analog input\n");
> + dev_dbg(dev->class_dev, "timeout reading analog input\n");
The trick with removing the "comedi: dyna_pci10xx: " prefix is that
you need to put this at the top of the file before the includes.
#define pr_fmt(fmt) "comedi: dyna_pci10xx: " fmt
You would need to remove the prefix from the other pr_info printk
as well so it's not included twice.
> continue;
> conv_finish:
> /* mask the first 4 bits - EOC bits */
> @@ -262,8 +261,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
> int ret;
>
> if (alloc_private(dev, sizeof(struct dyna_pci10xx_private)) < 0) {
> - printk(KERN_ERR "comedi: dyna_pci10xx: "
> - "failed to allocate memory!\n");
> + dev_err(dev->class_dev, "failed to allocate memory!\n");
No need. Kmalloc has it's own printk().
> return -ENOMEM;
> }
>
> @@ -276,14 +274,14 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
> dev->irq = 0;
>
> if (comedi_pci_enable(pcidev, DRV_NAME)) {
> - printk(KERN_ERR "comedi: dyna_pci10xx: "
> - "failed to enable PCI device and request regions!");
> + dev_err(dev->class_dev,
> + "failed to enable PCI device and request regions!\n");
> return -EIO;
> }
>
> mutex_init(&devpriv->mutex);
>
> - printk(KERN_INFO "comedi: dyna_pci10xx: device found!\n");
> + pr_info("comedi: dyna_pci10xx: device found!\n");
No need.
>
> dev->iobase = pci_resource_start(pcidev, 2);
> devpriv->BADR3 = pci_resource_start(pcidev, 3);
> @@ -333,7 +331,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
> s->state = 0;
> s->insn_bits = dyna_pci10xx_do_insn_bits;
>
> - printk(KERN_INFO "comedi: dyna_pci10xx: %s - device setup completed!\n",
> + dev_info(dev->class_dev, "%s - device setup completed!\n",
> thisboard->name);
No need for this either.
regards,
dan carpenter
>
> return 1;
> --
> 1.7.9.5
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-13 15:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13 1:46 [PATCH 1/2] Staging: Comedi: dyna_pci10xx: Replace printk with dev_info Bruce Humphrey
2012-09-13 8:00 ` Dan Carpenter
[not found] ` <CAGzQFLgLkqOdfQjbz3LFArEZGxwiEA4nnpLLtCHaX3w=-=RbKw@mail.gmail.com>
2012-09-13 15:27 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox