From f70575805708cabdedea7498aaa3f710fde4d920 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 31 Jan 2024 03:29:01 +0000 Subject: [PATCH] add lvds1024*800 --- kernel/drivers/hwmon/lm77.c | 56 ++++++++++++++++++++++---------------------------------- 1 files changed, 22 insertions(+), 34 deletions(-) diff --git a/kernel/drivers/hwmon/lm77.c b/kernel/drivers/hwmon/lm77.c index 69b05cc..7570c9d 100644 --- a/kernel/drivers/hwmon/lm77.c +++ b/kernel/drivers/hwmon/lm77.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * lm77.c - Part of lm_sensors, Linux kernel modules for hardware * monitoring @@ -9,16 +10,6 @@ * resolution made by National Semiconductor. Complete datasheet can be * obtained at their site: * http://www.national.com/pf/LM/LM77.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include <linux/module.h> @@ -137,7 +128,7 @@ /* sysfs stuff */ -static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, +static ssize_t temp_show(struct device *dev, struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); @@ -146,7 +137,7 @@ return sprintf(buf, "%d\n", data->temp[attr->index]); } -static ssize_t show_temp_hyst(struct device *dev, +static ssize_t temp_hyst_show(struct device *dev, struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); @@ -160,8 +151,9 @@ return sprintf(buf, "%d\n", temp); } -static ssize_t set_temp(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) +static ssize_t temp_store(struct device *dev, + struct device_attribute *devattr, const char *buf, + size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct lm77_data *data = dev_get_drvdata(dev); @@ -186,9 +178,9 @@ * hysteresis is stored as a relative value on the chip, so it has to be * converted first. */ -static ssize_t set_temp_hyst(struct device *dev, - struct device_attribute *devattr, - const char *buf, size_t count) +static ssize_t temp_hyst_store(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) { struct lm77_data *data = dev_get_drvdata(dev); struct i2c_client *client = data->client; @@ -208,7 +200,7 @@ return count; } -static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, +static ssize_t alarm_show(struct device *dev, struct device_attribute *attr, char *buf) { int bitnr = to_sensor_dev_attr(attr)->index; @@ -216,22 +208,18 @@ return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, t_input); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_crit); -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_min); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_max); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, t_input); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp, t_crit); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, t_min); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, t_max); -static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst, - set_temp_hyst, t_crit); -static SENSOR_DEVICE_ATTR(temp1_min_hyst, S_IRUGO, show_temp_hyst, NULL, t_min); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp_hyst, NULL, t_max); +static SENSOR_DEVICE_ATTR_RW(temp1_crit_hyst, temp_hyst, t_crit); +static SENSOR_DEVICE_ATTR_RO(temp1_min_hyst, temp_hyst, t_min); +static SENSOR_DEVICE_ATTR_RO(temp1_max_hyst, temp_hyst, t_max); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 1); static struct attribute *lm77_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, @@ -327,7 +315,7 @@ lm77_write_value(client, LM77_REG_CONF, conf & 0xfe); } -static int lm77_probe(struct i2c_client *client, const struct i2c_device_id *id) +static int lm77_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct device *hwmon_dev; @@ -360,7 +348,7 @@ .driver = { .name = "lm77", }, - .probe = lm77_probe, + .probe_new = lm77_probe, .id_table = lm77_id, .detect = lm77_detect, .address_list = normal_i2c, -- Gitblit v1.6.2