diff mbox

ftsteutates: fix clear alarm sysfs entries

Message ID 20170803094351.10325-1-thilo.cestonaro@ts.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Thilo Cestonaro Aug. 3, 2017, 9:43 a.m. UTC
sysfs store functions should return the "written" bytes.
Returning zero ends in an endless loop, so fix this by
returning the count of bytes got.

Signed-off-by: Thilo Cestonaro <thilo.cestonaro@ts.fujitsu.com>
---
 Documentation/hwmon/ftsteutates | 4 ++++
 drivers/hwmon/ftsteutates.c     | 2 ++
 2 files changed, 6 insertions(+)

Comments

Guenter Roeck Aug. 8, 2017, 1:54 p.m. UTC | #1
On Thu, Aug 03, 2017 at 11:43:51AM +0200, Thilo Cestonaro wrote:
> sysfs store functions should return the "written" bytes.
> Returning zero ends in an endless loop, so fix this by
> returning the count of bytes got.
> 
> Signed-off-by: Thilo Cestonaro <thilo.cestonaro@ts.fujitsu.com>

Applied, thanks (fixed documentation change and description).

Guenter

> ---
>  Documentation/hwmon/ftsteutates | 4 ++++
>  drivers/hwmon/ftsteutates.c     | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/Documentation/hwmon/ftsteutates b/Documentation/hwmon/ftsteutates
> index 8c10a916de20..6b5992f6072a 100644
> --- a/Documentation/hwmon/ftsteutates
> +++ b/Documentation/hwmon/ftsteutates
> @@ -21,3 +21,7 @@ implemented in this driver.
>  Specification of the chip can be found here:
>  ftp://ftp.ts.fujitsu.com/pub/Mainboard-OEM-Sales/Services/Software&Tools/Linux_SystemMonitoring&Watchdog&GPIO/BMC-Teutates_Specification_V1.21.pdf
>  ftp://ftp.ts.fujitsu.com/pub/Mainboard-OEM-Sales/Services/Software&Tools/Linux_SystemMonitoring&Watchdog&GPIO/Fujitsu_mainboards-1-Sensors_HowTo-en-US.pdf
> +
> +to clear a temprature or fan alarm execute the following command with the
> +correct path to the alarm file:
> +echo 0 >XXXX_alarm
> diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
> index 0f0277e7aae5..a0fb9e9291f0 100644
> --- a/drivers/hwmon/ftsteutates.c
> +++ b/drivers/hwmon/ftsteutates.c
> @@ -435,6 +435,7 @@ clear_temp_alarm(struct device *dev, struct device_attribute *devattr,
>  		goto error;
>  
>  	data->valid = false;
> +	ret = count;
>  error:
>  	mutex_unlock(&data->update_lock);
>  	return ret;
> @@ -508,6 +509,7 @@ clear_fan_alarm(struct device *dev, struct device_attribute *devattr,
>  		goto error;
>  
>  	data->valid = false;
> +	ret = count;
>  error:
>  	mutex_unlock(&data->update_lock);
>  	return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/hwmon/ftsteutates b/Documentation/hwmon/ftsteutates
index 8c10a916de20..6b5992f6072a 100644
--- a/Documentation/hwmon/ftsteutates
+++ b/Documentation/hwmon/ftsteutates
@@ -21,3 +21,7 @@  implemented in this driver.
 Specification of the chip can be found here:
 ftp://ftp.ts.fujitsu.com/pub/Mainboard-OEM-Sales/Services/Software&Tools/Linux_SystemMonitoring&Watchdog&GPIO/BMC-Teutates_Specification_V1.21.pdf
 ftp://ftp.ts.fujitsu.com/pub/Mainboard-OEM-Sales/Services/Software&Tools/Linux_SystemMonitoring&Watchdog&GPIO/Fujitsu_mainboards-1-Sensors_HowTo-en-US.pdf
+
+to clear a temprature or fan alarm execute the following command with the
+correct path to the alarm file:
+echo 0 >XXXX_alarm
diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
index 0f0277e7aae5..a0fb9e9291f0 100644
--- a/drivers/hwmon/ftsteutates.c
+++ b/drivers/hwmon/ftsteutates.c
@@ -435,6 +435,7 @@  clear_temp_alarm(struct device *dev, struct device_attribute *devattr,
 		goto error;
 
 	data->valid = false;
+	ret = count;
 error:
 	mutex_unlock(&data->update_lock);
 	return ret;
@@ -508,6 +509,7 @@  clear_fan_alarm(struct device *dev, struct device_attribute *devattr,
 		goto error;
 
 	data->valid = false;
+	ret = count;
 error:
 	mutex_unlock(&data->update_lock);
 	return ret;