mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-11 21:14:07 +08:00
d2a89b5283
The initcalls like to play joke. In our case, the thermal-netlink initcall is called after the thermal-core initcall but this one sends a notification before the former is initialized. No issue was spotted, but it could lead to a memory corruption, so instead of relying on the core_initcall for the thermal-netlink, let's initialize directly from the thermal-core init routine, so we have full control of the init ordering. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Link: https://lore.kernel.org/r/20200717164217.18819-1-daniel.lezcano@linaro.org
105 lines
2.3 KiB
C
105 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) Linaro Ltd 2020
|
|
* Author: Daniel Lezcano <daniel.lezcano@linaro.org>
|
|
*/
|
|
|
|
/* Netlink notification function */
|
|
#ifdef CONFIG_THERMAL_NETLINK
|
|
int __init thermal_netlink_init(void);
|
|
int thermal_notify_tz_create(int tz_id, const char *name);
|
|
int thermal_notify_tz_delete(int tz_id);
|
|
int thermal_notify_tz_enable(int tz_id);
|
|
int thermal_notify_tz_disable(int tz_id);
|
|
int thermal_notify_tz_trip_down(int tz_id, int id);
|
|
int thermal_notify_tz_trip_up(int tz_id, int id);
|
|
int thermal_notify_tz_trip_delete(int tz_id, int id);
|
|
int thermal_notify_tz_trip_add(int tz_id, int id, int type,
|
|
int temp, int hyst);
|
|
int thermal_notify_tz_trip_change(int tz_id, int id, int type,
|
|
int temp, int hyst);
|
|
int thermal_notify_cdev_state_update(int cdev_id, int state);
|
|
int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state);
|
|
int thermal_notify_cdev_delete(int cdev_id);
|
|
int thermal_notify_tz_gov_change(int tz_id, const char *name);
|
|
int thermal_genl_sampling_temp(int id, int temp);
|
|
#else
|
|
static inline int thermal_netlink_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_create(int tz_id, const char *name)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_delete(int tz_id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_enable(int tz_id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_disable(int tz_id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_trip_down(int tz_id, int id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_trip_up(int tz_id, int id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_trip_delete(int tz_id, int id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type,
|
|
int temp, int hyst)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type,
|
|
int temp, int hyst)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_cdev_state_update(int cdev_id, int state)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_cdev_add(int cdev_id, const char *name,
|
|
int max_state)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_cdev_delete(int cdev_id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_notify_tz_gov_change(int tz_id, const char *name)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int thermal_genl_sampling_temp(int id, int temp)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_THERMAL_NETLINK */
|