mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 13:34:30 +00:00
8cc099170f
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* INT3401 processor thermal device
|
|
* Copyright (c) 2020, Intel Corporation.
|
|
*/
|
|
#include <linux/acpi.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/thermal.h>
|
|
|
|
#include "int340x_thermal_zone.h"
|
|
#include "processor_thermal_device.h"
|
|
|
|
static const struct acpi_device_id int3401_device_ids[] = {
|
|
{"INT3401", 0},
|
|
{"", 0},
|
|
};
|
|
MODULE_DEVICE_TABLE(acpi, int3401_device_ids);
|
|
|
|
static int int3401_add(struct platform_device *pdev)
|
|
{
|
|
struct proc_thermal_device *proc_priv;
|
|
int ret;
|
|
|
|
proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL);
|
|
if (!proc_priv)
|
|
return -ENOMEM;
|
|
|
|
ret = proc_thermal_add(&pdev->dev, proc_priv);
|
|
if (ret)
|
|
return ret;
|
|
|
|
platform_set_drvdata(pdev, proc_priv);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void int3401_remove(struct platform_device *pdev)
|
|
{
|
|
proc_thermal_remove(platform_get_drvdata(pdev));
|
|
}
|
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
static int int3401_thermal_suspend(struct device *dev)
|
|
{
|
|
return proc_thermal_suspend(dev);
|
|
}
|
|
static int int3401_thermal_resume(struct device *dev)
|
|
{
|
|
return proc_thermal_resume(dev);
|
|
}
|
|
#else
|
|
#define int3401_thermal_suspend NULL
|
|
#define int3401_thermal_resume NULL
|
|
#endif
|
|
|
|
static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
|
|
int3401_thermal_resume);
|
|
|
|
static struct platform_driver int3401_driver = {
|
|
.probe = int3401_add,
|
|
.remove_new = int3401_remove,
|
|
.driver = {
|
|
.name = "int3401 thermal",
|
|
.acpi_match_table = int3401_device_ids,
|
|
.pm = &int3401_proc_thermal_pm,
|
|
},
|
|
};
|
|
|
|
module_platform_driver(int3401_driver);
|
|
|
|
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
|
|
MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
|
|
MODULE_LICENSE("GPL v2");
|