summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2016-07-25 16:27:49 -0400
committerGuenter Roeck <linux@roeck-us.net>2016-09-09 00:34:14 -0400
commit640208567660dbe8ad81f3b1c7c90e56fd352317 (patch)
treeba2d8773ceac425e2a32c07af00997b4330594e4
parentcc00decf0e280953e9067e938ad331f93bda8b40 (diff)
hwmon: (ntc_thermistor) Use devm_iio_channel_get
Use devm_iio_channel_get() instead of iio_channel_get to simplify error handling and device removal. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/ntc_thermistor.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index 8ef7b713cb1a..485701ca3609 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -331,7 +331,7 @@ ntc_thermistor_parse_dt(struct platform_device *pdev)
331 if (!pdata) 331 if (!pdata)
332 return ERR_PTR(-ENOMEM); 332 return ERR_PTR(-ENOMEM);
333 333
334 chan = iio_channel_get(&pdev->dev, NULL); 334 chan = devm_iio_channel_get(&pdev->dev, NULL);
335 if (IS_ERR(chan)) 335 if (IS_ERR(chan))
336 return ERR_CAST(chan); 336 return ERR_CAST(chan);
337 337
@@ -359,11 +359,6 @@ ntc_thermistor_parse_dt(struct platform_device *pdev)
359 359
360 return pdata; 360 return pdata;
361} 361}
362static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata)
363{
364 if (pdata->chan)
365 iio_channel_release(pdata->chan);
366}
367#else 362#else
368static struct ntc_thermistor_platform_data * 363static struct ntc_thermistor_platform_data *
369ntc_thermistor_parse_dt(struct platform_device *pdev) 364ntc_thermistor_parse_dt(struct platform_device *pdev)
@@ -373,8 +368,6 @@ ntc_thermistor_parse_dt(struct platform_device *pdev)
373 368
374#define ntc_match NULL 369#define ntc_match NULL
375 370
376static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata)
377{ }
378#endif 371#endif
379 372
380static inline u64 div64_u64_safe(u64 dividend, u64 divisor) 373static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
@@ -685,18 +678,15 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
685 return 0; 678 return 0;
686err_after_sysfs: 679err_after_sysfs:
687 sysfs_remove_group(&data->dev->kobj, &ntc_attr_group); 680 sysfs_remove_group(&data->dev->kobj, &ntc_attr_group);
688 ntc_iio_channel_release(pdata);
689 return ret; 681 return ret;
690} 682}
691 683
692static int ntc_thermistor_remove(struct platform_device *pdev) 684static int ntc_thermistor_remove(struct platform_device *pdev)
693{ 685{
694 struct ntc_data *data = platform_get_drvdata(pdev); 686 struct ntc_data *data = platform_get_drvdata(pdev);
695 struct ntc_thermistor_platform_data *pdata = data->pdata;
696 687
697 hwmon_device_unregister(data->hwmon_dev); 688 hwmon_device_unregister(data->hwmon_dev);
698 sysfs_remove_group(&data->dev->kobj, &ntc_attr_group); 689 sysfs_remove_group(&data->dev->kobj, &ntc_attr_group);
699 ntc_iio_channel_release(pdata);
700 690
701 return 0; 691 return 0;
702} 692}