diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-06-14 10:50:50 +0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-08-04 18:01:33 +0400 |
commit | 49153b092ceb099a5f38a645e3c40b4bd4e28a82 (patch) | |
tree | 39a357ce31ca03566d0d8979c1c404c586a9851d | |
parent | 5495af5f3e6e2cce34a2c22ecd8b1a94e93c184a (diff) | |
download | linux-49153b092ceb099a5f38a645e3c40b4bd4e28a82.tar.xz |
hwmon: (gpio-fan) Convert to devm_hwmon_device_register_with_groups
This simplifies the code a bit and also ensures the attribute groups are
properly removed from sysfs when unload the module.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/gpio-fan.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 2566c43dd1e9..a43e5b004eb8 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -537,9 +537,10 @@ static int gpio_fan_probe(struct platform_device *pdev) } /* Make this driver part of hwmon class. */ - fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, - "gpio_fan", fan_data, - gpio_fan_groups); + fan_data->hwmon_dev = + devm_hwmon_device_register_with_groups(&pdev->dev, + "gpio_fan", fan_data, + gpio_fan_groups); if (IS_ERR(fan_data->hwmon_dev)) return PTR_ERR(fan_data->hwmon_dev); @@ -548,15 +549,6 @@ static int gpio_fan_probe(struct platform_device *pdev) return 0; } -static int gpio_fan_remove(struct platform_device *pdev) -{ - struct gpio_fan_data *fan_data = platform_get_drvdata(pdev); - - hwmon_device_unregister(fan_data->hwmon_dev); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int gpio_fan_suspend(struct device *dev) { @@ -588,7 +580,6 @@ static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume); static struct platform_driver gpio_fan_driver = { .probe = gpio_fan_probe, - .remove = gpio_fan_remove, .driver = { .name = "gpio-fan", .pm = GPIO_FAN_PM, |