* [PATCH] platform/x86: silicom-platform: clean up a check
@ 2024-01-10 18:53 Dan Carpenter
2024-01-11 11:56 ` Ilpo Järvinen
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-01-10 18:53 UTC (permalink / raw)
To: Hans de Goede, Henry Shi
Cc: Ilpo Järvinen, platform-driver-x86, linux-kernel,
kernel-janitors
"value" is either non-zero, or zero. There isn't a third option.
Delete the unnecessary code.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/platform/x86/silicom-platform.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
index 6ce43ccb3112..5cac698bf98d 100644
--- a/drivers/platform/x86/silicom-platform.c
+++ b/drivers/platform/x86/silicom-platform.c
@@ -258,10 +258,8 @@ static void silicom_gpio_set(struct gpio_chip *gc,
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, 1);
}
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] platform/x86: silicom-platform: clean up a check
2024-01-10 18:53 [PATCH] platform/x86: silicom-platform: clean up a check Dan Carpenter
@ 2024-01-11 11:56 ` Ilpo Järvinen
2024-01-11 12:34 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2024-01-11 11:56 UTC (permalink / raw)
To: Dan Carpenter
Cc: Hans de Goede, Henry Shi, platform-driver-x86, LKML,
kernel-janitors
On Wed, 10 Jan 2024, Dan Carpenter wrote:
> "value" is either non-zero, or zero. There isn't a third option.
> Delete the unnecessary code.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/platform/x86/silicom-platform.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
> index 6ce43ccb3112..5cac698bf98d 100644
> --- a/drivers/platform/x86/silicom-platform.c
> +++ b/drivers/platform/x86/silicom-platform.c
> @@ -258,10 +258,8 @@ static void silicom_gpio_set(struct gpio_chip *gc,
>
> 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, 1);
This covers both cases without if:
silicom_mec_port_set(channel, !value);
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: silicom-platform: clean up a check
2024-01-11 11:56 ` Ilpo Järvinen
@ 2024-01-11 12:34 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-01-11 12:34 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Hans de Goede, Henry Shi, platform-driver-x86, LKML,
kernel-janitors
On Thu, Jan 11, 2024 at 01:56:28PM +0200, Ilpo Järvinen wrote:
> On Wed, 10 Jan 2024, Dan Carpenter wrote:
>
> > "value" is either non-zero, or zero. There isn't a third option.
> > Delete the unnecessary code.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > drivers/platform/x86/silicom-platform.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
> > index 6ce43ccb3112..5cac698bf98d 100644
> > --- a/drivers/platform/x86/silicom-platform.c
> > +++ b/drivers/platform/x86/silicom-platform.c
> > @@ -258,10 +258,8 @@ static void silicom_gpio_set(struct gpio_chip *gc,
> >
> > 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, 1);
>
> This covers both cases without if:
>
> silicom_mec_port_set(channel, !value);
>
True. Let me resend it that way.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-11 12:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 18:53 [PATCH] platform/x86: silicom-platform: clean up a check Dan Carpenter
2024-01-11 11:56 ` Ilpo Järvinen
2024-01-11 12:34 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox