Commit 50e52c1f authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Guenter Roeck

hwmon: (via686a) 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. For an amd64 allyesconfig this even
reduces the size of the driver by 3 bytes.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220924135738.234051-1-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 8887516f
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/io.h> #include <linux/io.h>
#define DRIVER_NAME "via686a"
/* /*
* If force_addr is set to anything different from 0, we forcibly enable * If force_addr is set to anything different from 0, we forcibly enable
* the device at the given address. * the device at the given address.
...@@ -656,7 +658,7 @@ static const struct attribute_group via686a_group = { ...@@ -656,7 +658,7 @@ static const struct attribute_group via686a_group = {
static struct platform_driver via686a_driver = { static struct platform_driver via686a_driver = {
.driver = { .driver = {
.name = "via686a", .name = DRIVER_NAME,
}, },
.probe = via686a_probe, .probe = via686a_probe,
.remove = via686a_remove, .remove = via686a_remove,
...@@ -672,7 +674,7 @@ static int via686a_probe(struct platform_device *pdev) ...@@ -672,7 +674,7 @@ static int via686a_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, VIA686A_EXTENT, if (!devm_request_region(&pdev->dev, res->start, VIA686A_EXTENT,
via686a_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;
...@@ -685,7 +687,7 @@ static int via686a_probe(struct platform_device *pdev) ...@@ -685,7 +687,7 @@ static int via686a_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 = "via686a"; data->name = DRIVER_NAME;
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
/* Initialize the VIA686A chip */ /* Initialize the VIA686A chip */
...@@ -819,7 +821,7 @@ static int via686a_device_add(unsigned short address) ...@@ -819,7 +821,7 @@ static int via686a_device_add(unsigned short address)
struct resource res = { struct resource res = {
.start = address, .start = address,
.end = address + VIA686A_EXTENT - 1, .end = address + VIA686A_EXTENT - 1,
.name = "via686a", .name = DRIVER_NAME,
.flags = IORESOURCE_IO, .flags = IORESOURCE_IO,
}; };
int err; int err;
...@@ -828,7 +830,7 @@ static int via686a_device_add(unsigned short address) ...@@ -828,7 +830,7 @@ static int via686a_device_add(unsigned short address)
if (err) if (err)
goto exit; goto exit;
pdev = platform_device_alloc("via686a", 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");
...@@ -918,7 +920,7 @@ static int via686a_pci_probe(struct pci_dev *dev, ...@@ -918,7 +920,7 @@ static int via686a_pci_probe(struct pci_dev *dev,
} }
static struct pci_driver via686a_pci_driver = { static struct pci_driver via686a_pci_driver = {
.name = "via686a", .name = DRIVER_NAME,
.id_table = via686a_pci_ids, .id_table = via686a_pci_ids,
.probe = via686a_pci_probe, .probe = via686a_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