Skip to contentSkip to conversation

i2c: i801: Use driver name constant instead of function dev_driver_string

PATCH Applied Heiner Kallweit 3 participants 3 messages May 25, 2021 – Jun 20, 2021

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

PATCH 1/1 i2c: i801: Use driver name constant instead of function dev_driver_string

We are the driver, so we can use the driver name directly instead of retrieving it by calling dev_driver_string().

---
 drivers/i2c/busses/i2c-i801.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-i801.c +5 -5
index 047f73f1a..5a7ce2658 100644
@@ -88,6 +88,8 @@
  * See the file Documentation/i2c/busses/i2c-i801.rst for details.
  */
 
+#define DRV_NAME	"i801_smbus"
+
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -1813,8 +1815,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	if (i801_acpi_probe(priv))
 		return -ENODEV;
 
-	err = pcim_iomap_regions(dev, 1 << SMBBAR,
-				 dev_driver_string(&dev->dev));
+	err = pcim_iomap_regions(dev, 1 << SMBBAR, DRV_NAME);
 	if (err) {
 		dev_err(&dev->dev,
 			"Failed to request SMBus region 0x%lx-0x%Lx\n",
@@ -1872,8 +1873,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		init_completion(&priv->done);
 
 		err = devm_request_irq(&dev->dev, dev->irq, i801_isr,
-				       IRQF_SHARED,
-				       dev_driver_string(&dev->dev), priv);
+				       IRQF_SHARED, DRV_NAME, priv);
 		if (err) {
 			dev_err(&dev->dev, "Failed to allocate irq %d: %d\n",
 				dev->irq, err);
@@ -1963,7 +1963,7 @@ static int i801_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(i801_pm_ops, i801_suspend, i801_resume);
 
 static struct pci_driver i801_driver = {
-	.name		= "i801_smbus",
+	.name		= DRV_NAME,
 	.id_table	= i801_ids,
 	.probe		= i801_probe,
 	.remove		= i801_remove,
Signature · 1 line
2.31.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 2 lines · Heiner Kallweit

We are the driver, so we can use the driver name directly instead of retrieving it by calling dev_driver_string().

Makes sense. Should make the code slightly faster.

Quoted 5 lines
---
 drivers/i2c/busses/i2c-i801.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(...)

Signature · 2 lines
Jean Delvare
SUSE L3 Support