Skip to contentSkip to conversation

drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk

PATCH In review Enrico Weigelt, metux IT consult 2 participants 4 messages Dec 3, 2020 – Dec 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk

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

---
 drivers/gpio/gpio-bt8xx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-bt8xx.c +4 -4
index a6f30ad6750f..7920cf256798 100644
@@ -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;
 	}
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/3 drivers: gpio: amd8111: prefer dev_err()/dev_info() over raw printk

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

---
 drivers/gpio/gpio-amd8111.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpio-amd8111.c +2 -4
index fdcebe59510d..0e260950992d 100644
@@ -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;
 	}
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/3 drivers: gpio: amd8111: use SPDX-License-Identifier

In reply to Enrico Weigelt, metux IT consult

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

---
 drivers/gpio/gpio-amd8111.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpio/gpio-amd8111.c +1 -4
index 0e260950992d..14e6b3e64add 100644
@@ -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 <[email protected]>
  * Copyright 2000,2001 Philipp Rumpf <[email protected]>
- *
- * 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>
Signature · 1 line
2.11.0