Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal fixes from Zhang Rui: "Specifics: - update Email address of Thermal subsystem maintainer Eduardo Valentin. - fix a problem that unloading thermal module results in kernel crash because a non-exist device file is removed on thermal unload. - fix a problem that critical trip point is set wrongly on latest i.MX6 SOC and results in system critical shutdown. - a couple of fixes to Tmon tool, of-thermal code and ti thermal driver" * 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: tmon: set umask to a reasonable value tmon: Check log file for common secuirty issues tools/thermal: tmon: fix compilation errors when building statically thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked Thermal: imx: correct critical trip temperature setting thermal: Bind cooling devices with the correct arguments thermal: Add braces around suspect code thermal: hwmon: Make the check for critical temp valid consistent MAINTAINERS: Update Eduardo Valentin's email address
This commit is contained in:
Коммит
448bfad8a1
|
@ -8984,7 +8984,7 @@ F: drivers/media/radio/radio-raremono.c
|
|||
|
||||
THERMAL
|
||||
M: Zhang Rui <rui.zhang@intel.com>
|
||||
M: Eduardo Valentin <eduardo.valentin@ti.com>
|
||||
M: Eduardo Valentin <edubezval@gmail.com>
|
||||
L: linux-pm@vger.kernel.org
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git
|
||||
|
@ -9011,7 +9011,7 @@ S: Maintained
|
|||
F: drivers/platform/x86/thinkpad_acpi.c
|
||||
|
||||
TI BANDGAP AND THERMAL DRIVER
|
||||
M: Eduardo Valentin <eduardo.valentin@ti.com>
|
||||
M: Eduardo Valentin <edubezval@gmail.com>
|
||||
L: linux-pm@vger.kernel.org
|
||||
S: Supported
|
||||
F: drivers/thermal/ti-soc-thermal/
|
||||
|
|
|
@ -306,7 +306,7 @@ static int imx_get_sensor_data(struct platform_device *pdev)
|
|||
{
|
||||
struct imx_thermal_data *data = platform_get_drvdata(pdev);
|
||||
struct regmap *map;
|
||||
int t1, t2, n1, n2;
|
||||
int t1, n1;
|
||||
int ret;
|
||||
u32 val;
|
||||
u64 temp64;
|
||||
|
@ -333,14 +333,10 @@ static int imx_get_sensor_data(struct platform_device *pdev)
|
|||
/*
|
||||
* Sensor data layout:
|
||||
* [31:20] - sensor value @ 25C
|
||||
* [19:8] - sensor value of hot
|
||||
* [7:0] - hot temperature value
|
||||
* Use universal formula now and only need sensor value @ 25C
|
||||
* slope = 0.4297157 - (0.0015976 * 25C fuse)
|
||||
*/
|
||||
n1 = val >> 20;
|
||||
n2 = (val & 0xfff00) >> 8;
|
||||
t2 = val & 0xff;
|
||||
t1 = 25; /* t1 always 25C */
|
||||
|
||||
/*
|
||||
|
@ -366,16 +362,16 @@ static int imx_get_sensor_data(struct platform_device *pdev)
|
|||
data->c2 = n1 * data->c1 + 1000 * t1;
|
||||
|
||||
/*
|
||||
* Set the default passive cooling trip point to 20 °C below the
|
||||
* maximum die temperature. Can be changed from userspace.
|
||||
* Set the default passive cooling trip point,
|
||||
* can be changed from userspace.
|
||||
*/
|
||||
data->temp_passive = 1000 * (t2 - 20);
|
||||
data->temp_passive = IMX_TEMP_PASSIVE;
|
||||
|
||||
/*
|
||||
* The maximum die temperature is t2, let's give 5 °C cushion
|
||||
* for noise and possible temperature rise between measurements.
|
||||
* The maximum die temperature set to 20 C higher than
|
||||
* IMX_TEMP_PASSIVE.
|
||||
*/
|
||||
data->temp_critical = 1000 * (t2 - 5);
|
||||
data->temp_critical = 1000 * 20 + data->temp_passive;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -156,8 +156,8 @@ static int of_thermal_bind(struct thermal_zone_device *thermal,
|
|||
|
||||
ret = thermal_zone_bind_cooling_device(thermal,
|
||||
tbp->trip_id, cdev,
|
||||
tbp->min,
|
||||
tbp->max);
|
||||
tbp->max,
|
||||
tbp->min);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
@ -712,11 +712,12 @@ thermal_of_build_thermal_zone(struct device_node *np)
|
|||
}
|
||||
|
||||
i = 0;
|
||||
for_each_child_of_node(child, gchild)
|
||||
for_each_child_of_node(child, gchild) {
|
||||
ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++],
|
||||
tz->trips, tz->ntrips);
|
||||
if (ret)
|
||||
goto free_tbps;
|
||||
}
|
||||
|
||||
finish:
|
||||
of_node_put(child);
|
||||
|
|
|
@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
|
||||
{
|
||||
unsigned long temp;
|
||||
return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
|
||||
}
|
||||
|
||||
int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
|
||||
{
|
||||
struct thermal_hwmon_device *hwmon;
|
||||
|
@ -189,21 +195,18 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
|
|||
if (result)
|
||||
goto free_temp_mem;
|
||||
|
||||
if (tz->ops->get_crit_temp) {
|
||||
unsigned long temperature;
|
||||
if (!tz->ops->get_crit_temp(tz, &temperature)) {
|
||||
snprintf(temp->temp_crit.name,
|
||||
sizeof(temp->temp_crit.name),
|
||||
if (thermal_zone_crit_temp_valid(tz)) {
|
||||
snprintf(temp->temp_crit.name,
|
||||
sizeof(temp->temp_crit.name),
|
||||
"temp%d_crit", hwmon->count);
|
||||
temp->temp_crit.attr.attr.name = temp->temp_crit.name;
|
||||
temp->temp_crit.attr.attr.mode = 0444;
|
||||
temp->temp_crit.attr.show = temp_crit_show;
|
||||
sysfs_attr_init(&temp->temp_crit.attr.attr);
|
||||
result = device_create_file(hwmon->device,
|
||||
&temp->temp_crit.attr);
|
||||
if (result)
|
||||
goto unregister_input;
|
||||
}
|
||||
temp->temp_crit.attr.attr.name = temp->temp_crit.name;
|
||||
temp->temp_crit.attr.attr.mode = 0444;
|
||||
temp->temp_crit.attr.show = temp_crit_show;
|
||||
sysfs_attr_init(&temp->temp_crit.attr.attr);
|
||||
result = device_create_file(hwmon->device,
|
||||
&temp->temp_crit.attr);
|
||||
if (result)
|
||||
goto unregister_input;
|
||||
}
|
||||
|
||||
mutex_lock(&thermal_hwmon_list_lock);
|
||||
|
@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
|
|||
}
|
||||
|
||||
device_remove_file(hwmon->device, &temp->temp_input.attr);
|
||||
if (tz->ops->get_crit_temp)
|
||||
if (thermal_zone_crit_temp_valid(tz))
|
||||
device_remove_file(hwmon->device, &temp->temp_crit.attr);
|
||||
|
||||
mutex_lock(&thermal_hwmon_list_lock);
|
||||
|
|
|
@ -1155,7 +1155,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
|
|||
/* register shadow for context save and restore */
|
||||
bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
|
||||
bgp->conf->sensor_count, GFP_KERNEL);
|
||||
if (!bgp) {
|
||||
if (!bgp->regval) {
|
||||
dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ OBJS = tmon.o tui.o sysfs.o pid.o
|
|||
OBJS +=
|
||||
|
||||
tmon: $(OBJS) Makefile tmon.h
|
||||
$(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -lpthread
|
||||
$(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread
|
||||
|
||||
valgrind: tmon
|
||||
sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null
|
||||
|
|
|
@ -142,6 +142,7 @@ static void start_syslog(void)
|
|||
static void prepare_logging(void)
|
||||
{
|
||||
int i;
|
||||
struct stat logstat;
|
||||
|
||||
if (!logging)
|
||||
return;
|
||||
|
@ -152,6 +153,29 @@ static void prepare_logging(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (lstat(TMON_LOG_FILE, &logstat) < 0) {
|
||||
syslog(LOG_ERR, "Unable to stat log file %s\n", TMON_LOG_FILE);
|
||||
fclose(tmon_log);
|
||||
tmon_log = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* The log file must be a regular file owned by us */
|
||||
if (S_ISLNK(logstat.st_mode)) {
|
||||
syslog(LOG_ERR, "Log file is a symlink. Will not log\n");
|
||||
fclose(tmon_log);
|
||||
tmon_log = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (logstat.st_uid != getuid()) {
|
||||
syslog(LOG_ERR, "We don't own the log file. Not logging\n");
|
||||
fclose(tmon_log);
|
||||
tmon_log = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n");
|
||||
for (i = 0; i < ptdata.nr_tz_sensor; i++) {
|
||||
char binding_str[33]; /* size of long + 1 */
|
||||
|
@ -331,7 +355,7 @@ static void start_daemon_mode()
|
|||
disable_tui();
|
||||
|
||||
/* change the file mode mask */
|
||||
umask(0);
|
||||
umask(S_IWGRP | S_IWOTH);
|
||||
|
||||
/* new SID for the daemon process */
|
||||
sid = setsid();
|
||||
|
|
Загрузка…
Ссылка в новой задаче