summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/sch5627.c
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2021-04-17 23:09:19 +0200
committerGuenter Roeck <linux@roeck-us.net>2021-04-20 15:50:14 +0200
commit93a6fb2c9135a14a6675bcb9a0250c307eae1af6 (patch)
tree557d48a4275e2d87c9cee5bcd67953eb30e17483 /drivers/hwmon/sch5627.c
parenthwmon: (pmbus/pxe1610) don't bail out when not all pages are active (diff)
downloadlinux-93a6fb2c9135a14a6675bcb9a0250c307eae1af6.tar.xz
linux-93a6fb2c9135a14a6675bcb9a0250c307eae1af6.zip
hwmon: (sch5627) Use devres function
Use devm_hwmon_device_register_with_info() and remove hwmon_dev from sch5627_data struct as it is not needed anymore. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20210417210920.15496-2-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/sch5627.c')
-rw-r--r--drivers/hwmon/sch5627.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c
index 8be339ae5f7d..ea042a6dae58 100644
--- a/drivers/hwmon/sch5627.c
+++ b/drivers/hwmon/sch5627.c
@@ -64,7 +64,6 @@ static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = {
struct sch5627_data {
unsigned short addr;
- struct device *hwmon_dev;
struct sch56xx_watchdog_data *watchdog;
u8 control;
u8 temp_max[SCH5627_NO_TEMPS];
@@ -365,15 +364,13 @@ static int sch5627_remove(struct platform_device *pdev)
if (data->watchdog)
sch56xx_watchdog_unregister(data->watchdog);
- if (data->hwmon_dev)
- hwmon_device_unregister(data->hwmon_dev);
-
return 0;
}
static int sch5627_probe(struct platform_device *pdev)
{
struct sch5627_data *data;
+ struct device *hwmon_dev;
int err, build_code, build_id, hwmon_rev, val;
data = devm_kzalloc(&pdev->dev, sizeof(struct sch5627_data),
@@ -471,12 +468,10 @@ static int sch5627_probe(struct platform_device *pdev)
pr_info("firmware build: code 0x%02X, id 0x%04X, hwmon: rev 0x%02X\n",
build_code, build_id, hwmon_rev);
- data->hwmon_dev = hwmon_device_register_with_info(&pdev->dev, DEVNAME, data,
- &sch5627_chip_info,
- NULL);
- if (IS_ERR(data->hwmon_dev)) {
- err = PTR_ERR(data->hwmon_dev);
- data->hwmon_dev = NULL;
+ hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, DEVNAME, data,
+ &sch5627_chip_info, NULL);
+ if (IS_ERR(hwmon_dev)) {
+ err = PTR_ERR(hwmon_dev);
goto error;
}