linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk
@ 2020-12-03 18:24 Enrico Weigelt, metux IT consult
  2020-12-03 18:24 ` [PATCH 2/3] drivers: gpio: amd8111: prefer dev_err()/dev_info() over " Enrico Weigelt, metux IT consult
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-03 18:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: linus.walleij, bgolaszewski, m, linux-gpio

For logging in device contexts, dev_*() functions are preferred over
raw printk(), which also print out device name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/gpio/gpio-bt8xx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c
index a6f30ad6750f..7920cf256798 100644
--- a/drivers/gpio/gpio-bt8xx.c
+++ b/drivers/gpio/gpio-bt8xx.c
@@ -175,13 +175,13 @@ static int bt8xxgpio_probe(struct pci_dev *dev,
 
 	err = pci_enable_device(dev);
 	if (err) {
-		printk(KERN_ERR "bt8xxgpio: Can't enable device.\n");
+		dev_err(&dev->dev, "can't enable device.\n");
 		return err;
 	}
 	if (!devm_request_mem_region(&dev->dev, pci_resource_start(dev, 0),
 				pci_resource_len(dev, 0),
 				"bt8xxgpio")) {
-		printk(KERN_WARNING "bt8xxgpio: Can't request iomem (0x%llx).\n",
+		dev_warn(&dev->dev, "can't request iomem (0x%llx).\n",
 		       (unsigned long long)pci_resource_start(dev, 0));
 		err = -EBUSY;
 		goto err_disable;
@@ -191,7 +191,7 @@ static int bt8xxgpio_probe(struct pci_dev *dev,
 
 	bg->mmio = devm_ioremap(&dev->dev, pci_resource_start(dev, 0), 0x1000);
 	if (!bg->mmio) {
-		printk(KERN_ERR "bt8xxgpio: ioremap() failed\n");
+		dev_err(&dev->dev, "ioremap() failed\n");
 		err = -EIO;
 		goto err_disable;
 	}
@@ -207,7 +207,7 @@ static int bt8xxgpio_probe(struct pci_dev *dev,
 	bt8xxgpio_gpio_setup(bg);
 	err = gpiochip_add_data(&bg->gpio, bg);
 	if (err) {
-		printk(KERN_ERR "bt8xxgpio: Failed to register GPIOs\n");
+		dev_err(&dev->dev, "failed to register GPIOs\n");
 		goto err_disable;
 	}
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] drivers: gpio: amd8111: prefer dev_err()/dev_info() over raw printk
  2020-12-03 18:24 [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Enrico Weigelt, metux IT consult
@ 2020-12-03 18:24 ` Enrico Weigelt, metux IT consult
  2020-12-03 18:24 ` [PATCH 3/3] drivers: gpio: amd8111: use SPDX-License-Identifier Enrico Weigelt, metux IT consult
  2020-12-08  8:42 ` [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-03 18:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: linus.walleij, bgolaszewski, m, linux-gpio

For logging in device contexts, dev_*() functions are preferred over
raw printk(), which also print out device name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/gpio/gpio-amd8111.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
index fdcebe59510d..0e260950992d 100644
--- a/drivers/gpio/gpio-amd8111.c
+++ b/drivers/gpio/gpio-amd8111.c
@@ -179,7 +179,6 @@ static int __init amd_gpio_init(void)
 	struct pci_dev *pdev = NULL;
 	const struct pci_device_id *ent;
 
-
 	/* We look for our device - AMD South Bridge
 	 * I don't know about a system with two such bridges,
 	 * so we can assume that there is max. one device.
@@ -223,11 +222,10 @@ static int __init amd_gpio_init(void)
 
 	spin_lock_init(&gp.lock);
 
-	printk(KERN_INFO "AMD-8111 GPIO detected\n");
+	dev_info(&pdev->dev, "AMD-8111 GPIO detected\n");
 	err = gpiochip_add_data(&gp.chip, &gp);
 	if (err) {
-		printk(KERN_ERR "GPIO registering failed (%d)\n",
-		       err);
+		dev_err(&pdev->dev, "GPIO registering failed (%d)\n", err);
 		ioport_unmap(gp.pm);
 		goto out;
 	}
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] drivers: gpio: amd8111: use SPDX-License-Identifier
  2020-12-03 18:24 [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Enrico Weigelt, metux IT consult
  2020-12-03 18:24 ` [PATCH 2/3] drivers: gpio: amd8111: prefer dev_err()/dev_info() over " Enrico Weigelt, metux IT consult
@ 2020-12-03 18:24 ` Enrico Weigelt, metux IT consult
  2020-12-08  8:42 ` [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-03 18:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: linus.walleij, bgolaszewski, m, linux-gpio

Prefer SPDX-License-Identifier over hand-written texts.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/gpio/gpio-amd8111.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
index 0e260950992d..14e6b3e64add 100644
--- a/drivers/gpio/gpio-amd8111.c
+++ b/drivers/gpio/gpio-amd8111.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * GPIO driver for AMD 8111 south bridges
  *
@@ -20,10 +21,6 @@
  * Hardware driver for Intel i810 Random Number Generator (RNG)
  * Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>
  * Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
  */
 #include <linux/ioport.h>
 #include <linux/module.h>
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk
  2020-12-03 18:24 [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Enrico Weigelt, metux IT consult
  2020-12-03 18:24 ` [PATCH 2/3] drivers: gpio: amd8111: prefer dev_err()/dev_info() over " Enrico Weigelt, metux IT consult
  2020-12-03 18:24 ` [PATCH 3/3] drivers: gpio: amd8111: use SPDX-License-Identifier Enrico Weigelt, metux IT consult
@ 2020-12-08  8:42 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2020-12-08  8:42 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult
  Cc: linux-kernel, Bartosz Golaszewski, Michael Buesch,
	open list:GPIO SUBSYSTEM

On Thu, Dec 3, 2020 at 7:24 PM Enrico Weigelt, metux IT consult
<info@metux.net> wrote:

> For logging in device contexts, dev_*() functions are preferred over
> raw printk(), which also print out device name.
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>

All three patches applied.

Thanks for tidying this up Enrico!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-08  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 18:24 [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Enrico Weigelt, metux IT consult
2020-12-03 18:24 ` [PATCH 2/3] drivers: gpio: amd8111: prefer dev_err()/dev_info() over " Enrico Weigelt, metux IT consult
2020-12-03 18:24 ` [PATCH 3/3] drivers: gpio: amd8111: use SPDX-License-Identifier Enrico Weigelt, metux IT consult
2020-12-08  8:42 ` [PATCH 1/3] drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).