summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com>2021-03-23 15:57:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-23 15:22:40 +0100
commit96dc2b31abd0ed8a2a59a6672d4f16e4718d3701 (patch)
tree1b3539233935a82f844b141e12e3b685df389235 /drivers/hwmon
parentf94a5becabf43e17490aded8bddc5f924b00338b (diff)
downloadlinux-96dc2b31abd0ed8a2a59a6672d4f16e4718d3701.tar.gz
linux-96dc2b31abd0ed8a2a59a6672d4f16e4718d3701.tar.bz2
linux-96dc2b31abd0ed8a2a59a6672d4f16e4718d3701.zip
hwmon: raspberry-pi: Clean-up few drivers by using managed work init
Few drivers implement remove call-back only for ensuring a delayed work gets cancelled prior driver removal. Clean-up these by switching to use devm_delayed_work_autocancel() instead. This change is compile-tested only. All testing is appreciated. Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Link: https://lore.kernel.org/r/4830f52d46278ea1c92ad7252f6050540346d8b7.1616506559.git.matti.vaittinen@fi.rohmeurope.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/raspberrypi-hwmon.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c
index d3a64a35f7a9..805d396aa81b 100644
--- a/drivers/hwmon/raspberrypi-hwmon.c
+++ b/drivers/hwmon/raspberrypi-hwmon.c
@@ -7,6 +7,7 @@
* Copyright (C) 2018 Stefan Wahren <stefan.wahren@i2se.com>
*/
#include <linux/device.h>
+#include <linux/devm-helpers.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/module.h>
@@ -106,6 +107,7 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct rpi_hwmon_data *data;
+ int ret;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
@@ -119,7 +121,10 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
&rpi_chip_info,
NULL);
- INIT_DELAYED_WORK(&data->get_values_poll_work, get_values_poll);
+ ret = devm_delayed_work_autocancel(dev, &data->get_values_poll_work,
+ get_values_poll);
+ if (ret)
+ return ret;
platform_set_drvdata(pdev, data);
if (!PTR_ERR_OR_ZERO(data->hwmon_dev))
@@ -128,18 +133,8 @@ static int rpi_hwmon_probe(struct platform_device *pdev)
return PTR_ERR_OR_ZERO(data->hwmon_dev);
}
-static int rpi_hwmon_remove(struct platform_device *pdev)
-{
- struct rpi_hwmon_data *data = platform_get_drvdata(pdev);
-
- cancel_delayed_work_sync(&data->get_values_poll_work);
-
- return 0;
-}
-
static struct platform_driver rpi_hwmon_driver = {
.probe = rpi_hwmon_probe,
- .remove = rpi_hwmon_remove,
.driver = {
.name = "raspberrypi-hwmon",
},