hwmon.c (8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17) | hwmon.c (ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * hwmon.c - part of lm_sensors, Linux kernel modules for hardware monitoring 4 * 5 * This file defines the sysfs class "hwmon", for use by sensors drivers. 6 * 7 * Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com> 8 */ --- 139 unchanged lines hidden (view full) --- 148 if (ret < 0) 149 return ret; 150 151 *temp = t; 152 153 return 0; 154} 155 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * hwmon.c - part of lm_sensors, Linux kernel modules for hardware monitoring 4 * 5 * This file defines the sysfs class "hwmon", for use by sensors drivers. 6 * 7 * Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com> 8 */ --- 139 unchanged lines hidden (view full) --- 148 if (ret < 0) 149 return ret; 150 151 *temp = t; 152 153 return 0; 154} 155 |
156static int hwmon_thermal_set_trips(void *data, int low, int high) 157{ 158 struct hwmon_thermal_data *tdata = data; 159 struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); 160 const struct hwmon_chip_info *chip = hwdev->chip; 161 const struct hwmon_channel_info **info = chip->info; 162 unsigned int i; 163 int err; 164 165 if (!chip->ops->write) 166 return 0; 167 168 for (i = 0; info[i] && info[i]->type != hwmon_temp; i++) 169 continue; 170 171 if (!info[i]) 172 return 0; 173 174 if (info[i]->config[tdata->index] & HWMON_T_MIN) { 175 err = chip->ops->write(tdata->dev, hwmon_temp, 176 hwmon_temp_min, tdata->index, low); 177 if (err && err != -EOPNOTSUPP) 178 return err; 179 } 180 181 if (info[i]->config[tdata->index] & HWMON_T_MAX) { 182 err = chip->ops->write(tdata->dev, hwmon_temp, 183 hwmon_temp_max, tdata->index, high); 184 if (err && err != -EOPNOTSUPP) 185 return err; 186 } 187 188 return 0; 189} 190 |
|
156static const struct thermal_zone_of_device_ops hwmon_thermal_ops = { 157 .get_temp = hwmon_thermal_get_temp, | 191static const struct thermal_zone_of_device_ops hwmon_thermal_ops = { 192 .get_temp = hwmon_thermal_get_temp, |
193 .set_trips = hwmon_thermal_set_trips, |
|
158}; 159 160static void hwmon_thermal_remove_sensor(void *data) 161{ 162 list_del(data); 163} 164 165static int hwmon_thermal_add_sensor(struct device *dev, int index) --- 589 unchanged lines hidden (view full) --- 755 hwdev->name = name; 756 hdev->class = &hwmon_class; 757 hdev->parent = dev; 758 hdev->of_node = dev ? dev->of_node : NULL; 759 hwdev->chip = chip; 760 dev_set_drvdata(hdev, drvdata); 761 dev_set_name(hdev, HWMON_ID_FORMAT, id); 762 err = device_register(hdev); | 194}; 195 196static void hwmon_thermal_remove_sensor(void *data) 197{ 198 list_del(data); 199} 200 201static int hwmon_thermal_add_sensor(struct device *dev, int index) --- 589 unchanged lines hidden (view full) --- 791 hwdev->name = name; 792 hdev->class = &hwmon_class; 793 hdev->parent = dev; 794 hdev->of_node = dev ? dev->of_node : NULL; 795 hwdev->chip = chip; 796 dev_set_drvdata(hdev, drvdata); 797 dev_set_name(hdev, HWMON_ID_FORMAT, id); 798 err = device_register(hdev); |
763 if (err) 764 goto free_hwmon; | 799 if (err) { 800 put_device(hdev); 801 goto ida_remove; 802 } |
765 766 INIT_LIST_HEAD(&hwdev->tzdata); 767 768 if (dev && dev->of_node && chip && chip->ops->read && 769 chip->info[0]->type == hwmon_chip && 770 (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) { 771 err = hwmon_thermal_register_sensors(hdev); 772 if (err) { --- 269 unchanged lines hidden --- | 803 804 INIT_LIST_HEAD(&hwdev->tzdata); 805 806 if (dev && dev->of_node && chip && chip->ops->read && 807 chip->info[0]->type == hwmon_chip && 808 (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) { 809 err = hwmon_thermal_register_sensors(hdev); 810 if (err) { --- 269 unchanged lines hidden --- |