hwmon: (oxp-sensors) Minor cleanup of driver code
cover hwmon: (oxp-sensors) Minor cleanup of driver code
Make some cleanup of the driver removing unnecesary header and some duplicated return on error logic.
Joaquín Ignacio Aramendía (2):
hwmon: (oxp-sensors) Remove unused header
hwmon: (oxp-sensors) Simplify logic of error return
drivers/hwmon/oxp-sensors.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/2 hwmon: (oxp-sensors) Remove unused header
We are not using <dev_printk.h>, remove that.
--- drivers/hwmon/oxp-sensors.c | 1 - 1 file changed, 1 deletion(-)
drivers/hwmon/oxp-sensors.c +0 -1
@@ -16,7 +16,6 @@*/ #include <linux/acpi.h> -#include <linux/dev_printk.h> #include <linux/dmi.h> #include <linux/hwmon.h> #include <linux/init.h>
Signature · 1 line
2.41.0
Re: [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header
Quoted 3 lines · Joaquín Ignacio Aramendía
We are not using <
dev_printk.h>, remove that.Signed-off-by Joaquín Ignacio Aramendía <[email protected]>
Applied.
Thanks,
Guenter
Quoted 16 lines
--- drivers/hwmon/oxp-sensors.c | 1 - 1 file changed, 1 deletion(-)drivers/hwmon/oxp-sensors.c +0
-1@@ -16,7 +16,6 @@*/ #include <linux/acpi.h> -#include <linux/dev_printk.h> #include <linux/dmi.h> #include <linux/hwmon.h> #include <linux/init.h>
PATCH 2/2 hwmon: (oxp-sensors) Simplify logic of error return
In reply to Joaquín Ignacio AramendíaTake return logic on error out of if-else, eliminating duplicated code in tt_togle_store() function.
--- drivers/hwmon/oxp-sensors.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/hwmon/oxp-sensors.c +3 -4
@@ -226,13 +226,12 @@ static ssize_t tt_toggle_store(struct device *dev,if (value) { rval =tt_toggle_enable (); -if (rval) -return rval; }else { rval =tt_toggle_disable (); -if (rval) -return rval; } +if (rval) +return rval; +return count; }
Signature · 1 line
2.41.0
Re: [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return
Quoted 4 lines · Joaquín Ignacio Aramendía
Take return logic on error out of if-else, eliminating duplicated code in
tt_togle_store()function.Signed-off-by Joaquín Ignacio Aramendía <[email protected]>
Applied.
Thanks,
Guenter
Quoted 25 lines
--- drivers/hwmon/oxp-sensors.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/hwmon/oxp-sensors.c +3
-4@@ -226,13 +226,12 @@ static ssize_t tt_toggle_store(struct device *dev,if (value) { rval =tt_toggle_enable (); -if (rval) -return rval; }else { rval =tt_toggle_disable (); -if (rval) -return rval; } +if (rval) +return rval; +return count; }