2012-10-19 19:09:23

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging/sbe-2t3e3: Use netdev_ or dev_ or pr_ printks in module.c

On Thu, Sep 27, 2012 at 10:59:10PM +0900, YAMANE Toshiaki wrote:
> fixed below checkpatch warning.
> - WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
>
> and add pr_fmt.
>
> Signed-off-by: YAMANE Toshiaki <[email protected]>
> ---
> drivers/staging/sbe-2t3e3/module.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/sbe-2t3e3/module.c b/drivers/staging/sbe-2t3e3/module.c
> index cd778b3..4547137 100644
> --- a/drivers/staging/sbe-2t3e3/module.c
> +++ b/drivers/staging/sbe-2t3e3/module.c
> @@ -10,6 +10,8 @@
> * This code is based on a driver written by SBE Inc.
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/delay.h>
> @@ -66,7 +68,7 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
>
> dev = alloc_hdlcdev(channel);
> if (!dev) {
> - printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
> + pr_err("SBE 2T3E3" ": Out of memory\n");
> goto free_regions;
> }
>
> @@ -93,7 +95,8 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *
> t3e3_init(channel);
>
> if (request_irq(dev->irq, &t3e3_intr, IRQF_SHARED, dev->name, dev)) {
> - printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
> + netdev_warn(channel->dev, "%s: could not get irq: %d\n",
> + dev->name, dev->irq);
> goto free_regions;
> }
>
> @@ -137,7 +140,8 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
> break; /* found the second channel */
>
> if (!pdev1) {
> - printk(KERN_ERR "SBE 2T3E3" ": Can't find the second channel\n");
> + dev_err(&pdev->dev,
> + "SBE 2T3E3" ": Can't find the second channel\n");

The "SBE 2T3E3" is no longer needed here, now that you set pr_info.

Care to fix this up and resend it?

thanks,

greg k-h


2012-10-24 02:53:22

by YAMANE Toshiaki

[permalink] [raw]
Subject: [PATCH 2/3] staging/sbe-2t3e3: Use netdev_ or dev_ or pr_ printks in module.c

fixed below checkpatch warning.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(... to printk(KERN_WARNING ...

and add pr_fmt.

Signed-off-by: YAMANE Toshiaki <[email protected]>
---
drivers/staging/sbe-2t3e3/module.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sbe-2t3e3/module.c b/drivers/staging/sbe-2t3e3/module.c
index 8adb178..8e1a043 100644
--- a/drivers/staging/sbe-2t3e3/module.c
+++ b/drivers/staging/sbe-2t3e3/module.c
@@ -10,6 +10,8 @@
* This code is based on a driver written by SBE Inc.
*/

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
@@ -66,7 +68,7 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *

dev = alloc_hdlcdev(channel);
if (!dev) {
- printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+ pr_err("Out of memory\n");
err = -ENOMEM;
goto free_regions;
}
@@ -96,7 +98,8 @@ static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *

err = request_irq(dev->irq, &t3e3_intr, IRQF_SHARED, dev->name, dev);
if (err) {
- printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
+ netdev_warn(channel->dev, "%s: could not get irq: %d\n",
+ dev->name, dev->irq);
goto unregister_dev;
}

@@ -144,7 +147,7 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic
break; /* found the second channel */

if (!pdev1) {
- printk(KERN_ERR "SBE 2T3E3" ": Can't find the second channel\n");
+ dev_err(&pdev->dev, "Can't find the second channel\n");
return -EFAULT;
}
channels = 2;
@@ -153,7 +156,7 @@ static int __devinit t3e3_init_card(struct pci_dev *pdev, const struct pci_devic

card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel), GFP_KERNEL);
if (!card) {
- printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
+ dev_err(&pdev->dev, "Out of memory\n");
return -ENOBUFS;
}

--
1.7.9.5