.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * sht15.c - support for the SHT15 Temperature and Humidity Sensor |
---|
3 | 4 | * |
---|
.. | .. |
---|
9 | 10 | * |
---|
10 | 11 | * Copyright (c) 2007 Wouter Horre |
---|
11 | 12 | * |
---|
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. |
---|
17 | 14 | */ |
---|
18 | 15 | |
---|
19 | 16 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
680 | 677 | * and heater_enable sysfs attributes. |
---|
681 | 678 | * Returns number of bytes written into buffer, negative errno on error. |
---|
682 | 679 | */ |
---|
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) |
---|
686 | 682 | { |
---|
687 | 683 | int ret; |
---|
688 | 684 | struct sht15_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
703 | 699 | * Will be called on write access to heater_enable sysfs attribute. |
---|
704 | 700 | * Returns number of bytes actually decoded, negative errno on error. |
---|
705 | 701 | */ |
---|
706 | | -static ssize_t sht15_store_heater(struct device *dev, |
---|
| 702 | +static ssize_t sht15_status_store(struct device *dev, |
---|
707 | 703 | struct device_attribute *attr, |
---|
708 | 704 | const char *buf, size_t count) |
---|
709 | 705 | { |
---|
.. | .. |
---|
737 | 733 | * Will be called on read access to temp1_input sysfs attribute. |
---|
738 | 734 | * Returns number of bytes written into buffer, negative errno on error. |
---|
739 | 735 | */ |
---|
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) |
---|
743 | 738 | { |
---|
744 | 739 | int ret; |
---|
745 | 740 | struct sht15_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
760 | 755 | * Will be called on read access to humidity1_input sysfs attribute. |
---|
761 | 756 | * Returns number of bytes written into buffer, negative errno on error. |
---|
762 | 757 | */ |
---|
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) |
---|
766 | 760 | { |
---|
767 | 761 | int ret; |
---|
768 | 762 | struct sht15_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
780 | 774 | return sprintf(buf, "%s\n", pdev->name); |
---|
781 | 775 | } |
---|
782 | 776 | |
---|
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); |
---|
793 | 784 | static DEVICE_ATTR_RO(name); |
---|
794 | 785 | static struct attribute *sht15_attrs[] = { |
---|
795 | 786 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
---|