aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gpio-fan.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-06-14 02:50:50 -0400
committerGuenter Roeck <linux@roeck-us.net>2014-08-04 10:01:33 -0400
commit49153b092ceb099a5f38a645e3c40b4bd4e28a82 (patch)
tree39a357ce31ca03566d0d8979c1c404c586a9851d /drivers/hwmon/gpio-fan.c
parent5495af5f3e6e2cce34a2c22ecd8b1a94e93c184a (diff)
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>
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
-rw-r--r--drivers/hwmon/gpio-fan.c17
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)
537 } 537 }
538 538
539 /* Make this driver part of hwmon class. */ 539 /* Make this driver part of hwmon class. */
540 fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, 540 fan_data->hwmon_dev =
541 "gpio_fan", fan_data, 541 devm_hwmon_device_register_with_groups(&pdev->dev,
542 gpio_fan_groups); 542 "gpio_fan", fan_data,
543 gpio_fan_groups);
543 if (IS_ERR(fan_data->hwmon_dev)) 544 if (IS_ERR(fan_data->hwmon_dev))
544 return PTR_ERR(fan_data->hwmon_dev); 545 return PTR_ERR(fan_data->hwmon_dev);
545 546
@@ -548,15 +549,6 @@ static int gpio_fan_probe(struct platform_device *pdev)
548 return 0; 549 return 0;
549} 550}
550 551
551static int gpio_fan_remove(struct platform_device *pdev)
552{
553 struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
554
555 hwmon_device_unregister(fan_data->hwmon_dev);
556
557 return 0;
558}
559
560#ifdef CONFIG_PM_SLEEP 552#ifdef CONFIG_PM_SLEEP
561static int gpio_fan_suspend(struct device *dev) 553static int gpio_fan_suspend(struct device *dev)
562{ 554{
@@ -588,7 +580,6 @@ static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
588 580
589static struct platform_driver gpio_fan_driver = { 581static struct platform_driver gpio_fan_driver = {
590 .probe = gpio_fan_probe, 582 .probe = gpio_fan_probe,
591 .remove = gpio_fan_remove,
592 .driver = { 583 .driver = {
593 .name = "gpio-fan", 584 .name = "gpio-fan",
594 .pm = GPIO_FAN_PM, 585 .pm = GPIO_FAN_PM,