Commit 6c7c469c authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Guenter Roeck

hwmon: (vt8231) 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 vt8231_driver.driver.name which breaks a cyclic dependency
between vt8231_probe() and vt8231_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/20220920135617.1046361-1-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 070affa8
...@@ -38,6 +38,8 @@ static struct platform_device *pdev; ...@@ -38,6 +38,8 @@ static struct platform_device *pdev;
#define VT8231_BASE_REG 0x70 #define VT8231_BASE_REG 0x70
#define VT8231_ENABLE_REG 0x74 #define VT8231_ENABLE_REG 0x74
#define DRIVER_NAME "vt8231"
/* /*
* The VT8231 registers * The VT8231 registers
* *
...@@ -753,7 +755,7 @@ static const struct attribute_group vt8231_group = { ...@@ -753,7 +755,7 @@ static const struct attribute_group vt8231_group = {
static struct platform_driver vt8231_driver = { static struct platform_driver vt8231_driver = {
.driver = { .driver = {
.name = "vt8231", .name = DRIVER_NAME,
}, },
.probe = vt8231_probe, .probe = vt8231_probe,
.remove = vt8231_remove, .remove = vt8231_remove,
...@@ -770,7 +772,7 @@ static int vt8231_pci_probe(struct pci_dev *dev, ...@@ -770,7 +772,7 @@ static int vt8231_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id); const struct pci_device_id *id);
static struct pci_driver vt8231_pci_driver = { static struct pci_driver vt8231_pci_driver = {
.name = "vt8231", .name = DRIVER_NAME,
.id_table = vt8231_pci_ids, .id_table = vt8231_pci_ids,
.probe = vt8231_pci_probe, .probe = vt8231_pci_probe,
}; };
...@@ -784,7 +786,7 @@ static int vt8231_probe(struct platform_device *pdev) ...@@ -784,7 +786,7 @@ static int vt8231_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, VT8231_EXTENT, if (!devm_request_region(&pdev->dev, res->start, VT8231_EXTENT,
vt8231_driver.driver.name)) { DRIVER_NAME)) {
dev_err(&pdev->dev, "Region 0x%lx-0x%lx already in use!\n", dev_err(&pdev->dev, "Region 0x%lx-0x%lx already in use!\n",
(unsigned long)res->start, (unsigned long)res->end); (unsigned long)res->start, (unsigned long)res->end);
return -ENODEV; return -ENODEV;
...@@ -796,7 +798,7 @@ static int vt8231_probe(struct platform_device *pdev) ...@@ -796,7 +798,7 @@ static int vt8231_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
data->addr = res->start; data->addr = res->start;
data->name = "vt8231"; data->name = DRIVER_NAME;
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
vt8231_init_device(data); vt8231_init_device(data);
...@@ -942,7 +944,7 @@ static int vt8231_device_add(unsigned short address) ...@@ -942,7 +944,7 @@ static int vt8231_device_add(unsigned short address)
struct resource res = { struct resource res = {
.start = address, .start = address,
.end = address + VT8231_EXTENT - 1, .end = address + VT8231_EXTENT - 1,
.name = "vt8231", .name = DRIVER_NAME,
.flags = IORESOURCE_IO, .flags = IORESOURCE_IO,
}; };
int err; int err;
...@@ -951,7 +953,7 @@ static int vt8231_device_add(unsigned short address) ...@@ -951,7 +953,7 @@ static int vt8231_device_add(unsigned short address)
if (err) if (err)
goto exit; goto exit;
pdev = platform_device_alloc("vt8231", 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");
......
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