From 748e4f3d702def1a4bff191e0cf93b6a05340f01 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Fri, 10 May 2024 07:41:34 +0000 Subject: [PATCH] add gpio led uart --- kernel/drivers/hwmon/sht21.c | 39 +++++++++++---------------------------- 1 files changed, 11 insertions(+), 28 deletions(-) diff --git a/kernel/drivers/hwmon/sht21.c b/kernel/drivers/hwmon/sht21.c index 2c7ba70..7d18ce5 100644 --- a/kernel/drivers/hwmon/sht21.c +++ b/kernel/drivers/hwmon/sht21.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* Sensirion SHT21 humidity and temperature sensor driver * * Copyright (C) 2010 Urs Fleisch <urs.fleisch@sensirion.com> * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA - * - * Data sheet available at http://www.sensirion.com/file/datasheet_sht21 + * Data sheet available at https://www.sensirion.com/file/datasheet_sht21 */ #include <linux/module.h> @@ -135,9 +122,9 @@ * Will be called on read access to temp1_input sysfs attribute. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht21_show_temperature(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t sht21_temperature_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct sht21 *sht21 = dev_get_drvdata(dev); int ret; @@ -157,9 +144,8 @@ * Will be called on read access to humidity1_input sysfs attribute. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht21_show_humidity(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t sht21_humidity_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct sht21 *sht21 = dev_get_drvdata(dev); int ret; @@ -251,10 +237,8 @@ } /* sysfs attributes */ -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, sht21_show_temperature, - NULL, 0); -static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO, sht21_show_humidity, - NULL, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, sht21_temperature, 0); +static SENSOR_DEVICE_ATTR_RO(humidity1_input, sht21_humidity, 0); static DEVICE_ATTR_RO(eic); static struct attribute *sht21_attrs[] = { @@ -266,8 +250,7 @@ ATTRIBUTE_GROUPS(sht21); -static int sht21_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int sht21_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct device *hwmon_dev; @@ -302,7 +285,7 @@ static struct i2c_driver sht21_driver = { .driver.name = "sht21", - .probe = sht21_probe, + .probe_new = sht21_probe, .id_table = sht21_id, }; -- Gitblit v1.6.2