linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hwmon: (oxp-sensors) Minor cleanup of driver code
@ 2023-06-17 18:11 Joaquín Ignacio Aramendía
  2023-06-17 18:11 ` [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header Joaquín Ignacio Aramendía
  2023-06-17 18:11 ` [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return Joaquín Ignacio Aramendía
  0 siblings, 2 replies; 5+ messages in thread
From: Joaquín Ignacio Aramendía @ 2023-06-17 18:11 UTC (permalink / raw)
  To: linux
  Cc: Joaquín Ignacio Aramendía, derekjohn.clark, jdelvare,
	linux-hwmon, linux-kernel

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(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header
  2023-06-17 18:11 [PATCH 0/2] hwmon: (oxp-sensors) Minor cleanup of driver code Joaquín Ignacio Aramendía
@ 2023-06-17 18:11 ` Joaquín Ignacio Aramendía
  2023-06-18 15:54   ` Guenter Roeck
  2023-06-17 18:11 ` [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return Joaquín Ignacio Aramendía
  1 sibling, 1 reply; 5+ messages in thread
From: Joaquín Ignacio Aramendía @ 2023-06-17 18:11 UTC (permalink / raw)
  To: linux
  Cc: Joaquín Ignacio Aramendía, derekjohn.clark, jdelvare,
	linux-hwmon, linux-kernel

We are not using <dev_printk.h>, remove that.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
---
 drivers/hwmon/oxp-sensors.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
index be36d38f13d9..584e48d8106e 100644
--- a/drivers/hwmon/oxp-sensors.c
+++ b/drivers/hwmon/oxp-sensors.c
@@ -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>
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return
  2023-06-17 18:11 [PATCH 0/2] hwmon: (oxp-sensors) Minor cleanup of driver code Joaquín Ignacio Aramendía
  2023-06-17 18:11 ` [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header Joaquín Ignacio Aramendía
@ 2023-06-17 18:11 ` Joaquín Ignacio Aramendía
  2023-06-18 15:54   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Joaquín Ignacio Aramendía @ 2023-06-17 18:11 UTC (permalink / raw)
  To: linux
  Cc: Joaquín Ignacio Aramendía, derekjohn.clark, jdelvare,
	linux-hwmon, linux-kernel

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 <samsagax@gmail.com>
---
 drivers/hwmon/oxp-sensors.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
index 584e48d8106e..1e59d97219c4 100644
--- a/drivers/hwmon/oxp-sensors.c
+++ b/drivers/hwmon/oxp-sensors.c
@@ -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;
 }
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header
  2023-06-17 18:11 ` [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header Joaquín Ignacio Aramendía
@ 2023-06-18 15:54   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-06-18 15:54 UTC (permalink / raw)
  To: Joaquín Ignacio Aramendía
  Cc: derekjohn.clark, jdelvare, linux-hwmon, linux-kernel

On Sat, Jun 17, 2023 at 03:11:42PM -0300, Joaquín Ignacio Aramendía wrote:
> We are not using <dev_printk.h>, remove that.
> 
> Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/oxp-sensors.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
> index be36d38f13d9..584e48d8106e 100644
> --- a/drivers/hwmon/oxp-sensors.c
> +++ b/drivers/hwmon/oxp-sensors.c
> @@ -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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return
  2023-06-17 18:11 ` [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return Joaquín Ignacio Aramendía
@ 2023-06-18 15:54   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-06-18 15:54 UTC (permalink / raw)
  To: Joaquín Ignacio Aramendía
  Cc: derekjohn.clark, jdelvare, linux-hwmon, linux-kernel

On Sat, Jun 17, 2023 at 03:11:43PM -0300, Joaquín Ignacio Aramendía wrote:
> 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 <samsagax@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/oxp-sensors.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
> index 584e48d8106e..1e59d97219c4 100644
> --- a/drivers/hwmon/oxp-sensors.c
> +++ b/drivers/hwmon/oxp-sensors.c
> @@ -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;
>  }
>  

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-18 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-17 18:11 [PATCH 0/2] hwmon: (oxp-sensors) Minor cleanup of driver code Joaquín Ignacio Aramendía
2023-06-17 18:11 ` [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header Joaquín Ignacio Aramendía
2023-06-18 15:54   ` Guenter Roeck
2023-06-17 18:11 ` [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return Joaquín Ignacio Aramendía
2023-06-18 15:54   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).