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/max1619.c | 49 ++++++++++++++++++------------------------------- 1 files changed, 18 insertions(+), 31 deletions(-) diff --git a/kernel/drivers/hwmon/max1619.c b/kernel/drivers/hwmon/max1619.c index 76d9669..8bd941c 100644 --- a/kernel/drivers/hwmon/max1619.c +++ b/kernel/drivers/hwmon/max1619.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * max1619.c - Part of lm_sensors, Linux kernel modules for hardware * monitoring @@ -9,16 +10,6 @@ * one external one). Complete datasheet can be * obtained from Maxim's website at: * http://pdfserv.maxim-ic.com/en/ds/MAX1619.pdf - * - * 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> @@ -145,7 +136,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); @@ -154,8 +145,9 @@ return sprintf(buf, "%d\n", temp_from_reg(data->temp[attr->index])); } -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 max1619_data *data = dev_get_drvdata(dev); @@ -180,7 +172,7 @@ return sprintf(buf, "%d\n", data->alarms); } -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; @@ -188,22 +180,18 @@ return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, t_input1); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, t_input2); -static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_low2); -static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_high2); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_crit2); -static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp, - set_temp, t_hyst2); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, t_input1); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, t_input2); +static SENSOR_DEVICE_ATTR_RW(temp2_min, temp, t_low2); +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp, t_high2); +static SENSOR_DEVICE_ATTR_RW(temp2_crit, temp, t_crit2); +static SENSOR_DEVICE_ATTR_RW(temp2_crit_hyst, temp, t_hyst2); static DEVICE_ATTR_RO(alarms); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 4); static struct attribute *max1619_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, @@ -273,8 +261,7 @@ config & 0xBF); /* run */ } -static int max1619_probe(struct i2c_client *new_client, - const struct i2c_device_id *id) +static int max1619_probe(struct i2c_client *new_client) { struct max1619_data *data; struct device *hwmon_dev; @@ -318,7 +305,7 @@ .name = "max1619", .of_match_table = of_match_ptr(max1619_of_match), }, - .probe = max1619_probe, + .probe_new = max1619_probe, .id_table = max1619_id, .detect = max1619_detect, .address_list = normal_i2c, -- Gitblit v1.6.2