hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/hwmon/sht15.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * sht15.c - support for the SHT15 Temperature and Humidity Sensor
34 *
....@@ -9,11 +10,7 @@
910 *
1011 * Copyright (c) 2007 Wouter Horre
1112 *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License version 2 as
14
- * published by the Free Software Foundation.
15
- *
16
- * For further information, see the Documentation/hwmon/sht15 file.
13
+ * For further information, see the Documentation/hwmon/sht15.rst file.
1714 */
1815
1916 #include <linux/interrupt.h>
....@@ -680,9 +677,8 @@
680677 * and heater_enable sysfs attributes.
681678 * Returns number of bytes written into buffer, negative errno on error.
682679 */
683
-static ssize_t sht15_show_status(struct device *dev,
684
- struct device_attribute *attr,
685
- char *buf)
680
+static ssize_t sht15_status_show(struct device *dev,
681
+ struct device_attribute *attr, char *buf)
686682 {
687683 int ret;
688684 struct sht15_data *data = dev_get_drvdata(dev);
....@@ -703,7 +699,7 @@
703699 * Will be called on write access to heater_enable sysfs attribute.
704700 * Returns number of bytes actually decoded, negative errno on error.
705701 */
706
-static ssize_t sht15_store_heater(struct device *dev,
702
+static ssize_t sht15_status_store(struct device *dev,
707703 struct device_attribute *attr,
708704 const char *buf, size_t count)
709705 {
....@@ -737,9 +733,8 @@
737733 * Will be called on read access to temp1_input sysfs attribute.
738734 * Returns number of bytes written into buffer, negative errno on error.
739735 */
740
-static ssize_t sht15_show_temp(struct device *dev,
741
- struct device_attribute *attr,
742
- char *buf)
736
+static ssize_t sht15_temp_show(struct device *dev,
737
+ struct device_attribute *attr, char *buf)
743738 {
744739 int ret;
745740 struct sht15_data *data = dev_get_drvdata(dev);
....@@ -760,9 +755,8 @@
760755 * Will be called on read access to humidity1_input sysfs attribute.
761756 * Returns number of bytes written into buffer, negative errno on error.
762757 */
763
-static ssize_t sht15_show_humidity(struct device *dev,
764
- struct device_attribute *attr,
765
- char *buf)
758
+static ssize_t sht15_humidity_show(struct device *dev,
759
+ struct device_attribute *attr, char *buf)
766760 {
767761 int ret;
768762 struct sht15_data *data = dev_get_drvdata(dev);
....@@ -780,16 +774,13 @@
780774 return sprintf(buf, "%s\n", pdev->name);
781775 }
782776
783
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
784
- sht15_show_temp, NULL, 0);
785
-static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO,
786
- sht15_show_humidity, NULL, 0);
787
-static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, sht15_show_status, NULL,
788
- SHT15_STATUS_LOW_BATTERY);
789
-static SENSOR_DEVICE_ATTR(humidity1_fault, S_IRUGO, sht15_show_status, NULL,
790
- SHT15_STATUS_LOW_BATTERY);
791
-static SENSOR_DEVICE_ATTR(heater_enable, S_IRUGO | S_IWUSR, sht15_show_status,
792
- sht15_store_heater, SHT15_STATUS_HEATER);
777
+static SENSOR_DEVICE_ATTR_RO(temp1_input, sht15_temp, 0);
778
+static SENSOR_DEVICE_ATTR_RO(humidity1_input, sht15_humidity, 0);
779
+static SENSOR_DEVICE_ATTR_RO(temp1_fault, sht15_status,
780
+ SHT15_STATUS_LOW_BATTERY);
781
+static SENSOR_DEVICE_ATTR_RO(humidity1_fault, sht15_status,
782
+ SHT15_STATUS_LOW_BATTERY);
783
+static SENSOR_DEVICE_ATTR_RW(heater_enable, sht15_status, SHT15_STATUS_HEATER);
793784 static DEVICE_ATTR_RO(name);
794785 static struct attribute *sht15_attrs[] = {
795786 &sensor_dev_attr_temp1_input.dev_attr.attr,