Commit 847a3b04 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Guenter Roeck

hwmon: (sis5595) Introduce a #define for the driver name and use it

Make use of the cpp symbol DRIVER_NAME to set the driver's name and use
it instead of all explicit usages of the same string. Also make use of
it instead of sis5595_driver.driver.name which breaks a cyclic dependency
between sis5595_probe() and sis5595_driver that in the next commit allows
to drop some forward declarations.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220922074900.2763331-1-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 0dee25eb
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
* 735 0008 0735 * 735 0008 0735
*/ */
#define DRIVER_NAME "sis5595"
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
...@@ -201,7 +202,7 @@ static void sis5595_init_device(struct sis5595_data *data); ...@@ -201,7 +202,7 @@ static void sis5595_init_device(struct sis5595_data *data);
static struct platform_driver sis5595_driver = { static struct platform_driver sis5595_driver = {
.driver = { .driver = {
.name = "sis5595", .name = DRIVER_NAME,
}, },
.probe = sis5595_probe, .probe = sis5595_probe,
.remove = sis5595_remove, .remove = sis5595_remove,
...@@ -580,7 +581,7 @@ static int sis5595_probe(struct platform_device *pdev) ...@@ -580,7 +581,7 @@ static int sis5595_probe(struct platform_device *pdev)
/* Reserve the ISA region */ /* Reserve the ISA region */
res = platform_get_resource(pdev, IORESOURCE_IO, 0); res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (!devm_request_region(&pdev->dev, res->start, SIS5595_EXTENT, if (!devm_request_region(&pdev->dev, res->start, SIS5595_EXTENT,
sis5595_driver.driver.name)) DRIVER_NAME))
return -EBUSY; return -EBUSY;
data = devm_kzalloc(&pdev->dev, sizeof(struct sis5595_data), data = devm_kzalloc(&pdev->dev, sizeof(struct sis5595_data),
...@@ -591,7 +592,7 @@ static int sis5595_probe(struct platform_device *pdev) ...@@ -591,7 +592,7 @@ static int sis5595_probe(struct platform_device *pdev)
mutex_init(&data->lock); mutex_init(&data->lock);
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
data->addr = res->start; data->addr = res->start;
data->name = "sis5595"; data->name = DRIVER_NAME;
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
/* /*
...@@ -764,7 +765,7 @@ static int sis5595_device_add(unsigned short address) ...@@ -764,7 +765,7 @@ static int sis5595_device_add(unsigned short address)
struct resource res = { struct resource res = {
.start = address, .start = address,
.end = address + SIS5595_EXTENT - 1, .end = address + SIS5595_EXTENT - 1,
.name = "sis5595", .name = DRIVER_NAME,
.flags = IORESOURCE_IO, .flags = IORESOURCE_IO,
}; };
int err; int err;
...@@ -773,7 +774,7 @@ static int sis5595_device_add(unsigned short address) ...@@ -773,7 +774,7 @@ static int sis5595_device_add(unsigned short address)
if (err) if (err)
goto exit; goto exit;
pdev = platform_device_alloc("sis5595", address); pdev = platform_device_alloc(DRIVER_NAME, address);
if (!pdev) { if (!pdev) {
err = -ENOMEM; err = -ENOMEM;
pr_err("Device allocation failed\n"); pr_err("Device allocation failed\n");
...@@ -886,7 +887,7 @@ static int sis5595_pci_probe(struct pci_dev *dev, ...@@ -886,7 +887,7 @@ static int sis5595_pci_probe(struct pci_dev *dev,
} }
static struct pci_driver sis5595_pci_driver = { static struct pci_driver sis5595_pci_driver = {
.name = "sis5595", .name = DRIVER_NAME,
.id_table = sis5595_pci_ids, .id_table = sis5595_pci_ids,
.probe = sis5595_pci_probe, .probe = sis5595_pci_probe,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment