Platform-driver-x86 archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] platform/x86: silicom-platform: clean up a check
@ 2024-01-12  6:56 Dan Carpenter
  2024-01-12  8:29 ` Ilpo Järvinen
  2024-01-24 11:02 ` Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-01-12  6:56 UTC (permalink / raw
  To: Hans de Goede, Henry Shi
  Cc: Ilpo Järvinen, platform-driver-x86, linux-kernel,
	kernel-janitors

The error message in this code can't be reached because value is either
zero or non-zero.  There isn't a third option.  Really, it's nicer to
write this as a one liner.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/platform/x86/silicom-platform.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
index 6ce43ccb3112..c0910af16a3a 100644
--- a/drivers/platform/x86/silicom-platform.c
+++ b/drivers/platform/x86/silicom-platform.c
@@ -256,12 +256,7 @@ static void silicom_gpio_set(struct gpio_chip *gc,
 	if (direction == GPIO_LINE_DIRECTION_IN)
 		return;
 
-	if (value)
-		silicom_mec_port_set(channel, 0);
-	else if (value == 0)
-		silicom_mec_port_set(channel, 1);
-	else
-		pr_err("Wrong argument value: %d\n", value);
+	silicom_mec_port_set(channel, !value);
 }
 
 static int silicom_gpio_direction_output(struct gpio_chip *gc,
-- 
2.43.0


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

* Re: [PATCH v2] platform/x86: silicom-platform: clean up a check
  2024-01-12  6:56 [PATCH v2] platform/x86: silicom-platform: clean up a check Dan Carpenter
@ 2024-01-12  8:29 ` Ilpo Järvinen
  2024-01-24 11:02 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2024-01-12  8:29 UTC (permalink / raw
  To: Dan Carpenter
  Cc: Hans de Goede, Henry Shi, platform-driver-x86, LKML,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

On Fri, 12 Jan 2024, Dan Carpenter wrote:

> The error message in this code can't be reached because value is either
> zero or non-zero.  There isn't a third option.  Really, it's nicer to
> write this as a one liner.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/platform/x86/silicom-platform.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
> index 6ce43ccb3112..c0910af16a3a 100644
> --- a/drivers/platform/x86/silicom-platform.c
> +++ b/drivers/platform/x86/silicom-platform.c
> @@ -256,12 +256,7 @@ static void silicom_gpio_set(struct gpio_chip *gc,
>  	if (direction == GPIO_LINE_DIRECTION_IN)
>  		return;
>  
> -	if (value)
> -		silicom_mec_port_set(channel, 0);
> -	else if (value == 0)
> -		silicom_mec_port_set(channel, 1);
> -	else
> -		pr_err("Wrong argument value: %d\n", value);
> +	silicom_mec_port_set(channel, !value);
>  }
>  
>  static int silicom_gpio_direction_output(struct gpio_chip *gc,
> 

Thanks for the update,

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

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

* Re: [PATCH v2] platform/x86: silicom-platform: clean up a check
  2024-01-12  6:56 [PATCH v2] platform/x86: silicom-platform: clean up a check Dan Carpenter
  2024-01-12  8:29 ` Ilpo Järvinen
@ 2024-01-24 11:02 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2024-01-24 11:02 UTC (permalink / raw
  To: Hans de Goede, Henry Shi, Dan Carpenter
  Cc: platform-driver-x86, linux-kernel, kernel-janitors

On Fri, 12 Jan 2024 09:56:25 +0300, Dan Carpenter wrote:

> The error message in this code can't be reached because value is either
> zero or non-zero.  There isn't a third option.  Really, it's nicer to
> write this as a one liner.
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: silicom-platform: clean up a check
      commit: 890a48ca7b05406c538505a92148de7ab0d50591

--
 i.


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

end of thread, other threads:[~2024-01-24 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-12  6:56 [PATCH v2] platform/x86: silicom-platform: clean up a check Dan Carpenter
2024-01-12  8:29 ` Ilpo Järvinen
2024-01-24 11:02 ` Ilpo Järvinen

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 read-only IMAP folder(s) and NNTP newsgroup(s).