From: Baruch Siach <baruch@tkos.co.il>
To: "Pali Rohár" <pali@kernel.org>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Lee Jones" <lee.jones@linaro.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Andrew Lunn" <andrew@lunn.ch>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
"Marek Behún" <kabel@kernel.org>,
linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
Date: Thu, 14 Jul 2022 16:14:27 +0300 [thread overview]
Message-ID: <87lesvde6s.fsf@tarshish> (raw)
In-Reply-To: <20220714115515.5748-1-pali@kernel.org>
Hi Pali,
On Thu, Jul 14 2022, Pali Rohár wrote:
> pwm support incompatible with Armada 80x0/70x0 API is not only in
> Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
> platform. Fix check for pwm support appropriately.
>
> Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> drivers/gpio/gpio-mvebu.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 2db19cd640a4..70a22b68c034 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -793,8 +793,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
> u32 offset;
> u32 set;
>
> - if (of_device_is_compatible(mvchip->chip.of_node,
> - "marvell,armada-370-gpio")) {
> + if (mvchip->soc_variant != MVEBU_GPIO_SOC_VARIANT_A8K) {
The 'if' condition that follow the 'else' below become always true:
} else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
I would suggest to keep the '== MVEBU_GPIO_SOC_VARIANT_A8K' condition,
and reverse the if/else order, because positive logic is more readable.
There is also another 'else' below that is dead code with this patch.
baruch
> /*
> * There are only two sets of PWM configuration registers for
> * all the GPIO lines on those SoCs which this driver reserves
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
WARNING: multiple messages have this Message-ID (diff)
From: Baruch Siach <baruch@tkos.co.il>
To: "Pali Rohár" <pali@kernel.org>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Lee Jones" <lee.jones@linaro.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Andrew Lunn" <andrew@lunn.ch>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
"Marek Behún" <kabel@kernel.org>,
linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
Date: Thu, 14 Jul 2022 16:14:27 +0300 [thread overview]
Message-ID: <87lesvde6s.fsf@tarshish> (raw)
In-Reply-To: <20220714115515.5748-1-pali@kernel.org>
Hi Pali,
On Thu, Jul 14 2022, Pali Rohár wrote:
> pwm support incompatible with Armada 80x0/70x0 API is not only in
> Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
> platform. Fix check for pwm support appropriately.
>
> Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> drivers/gpio/gpio-mvebu.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 2db19cd640a4..70a22b68c034 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -793,8 +793,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
> u32 offset;
> u32 set;
>
> - if (of_device_is_compatible(mvchip->chip.of_node,
> - "marvell,armada-370-gpio")) {
> + if (mvchip->soc_variant != MVEBU_GPIO_SOC_VARIANT_A8K) {
The 'if' condition that follow the 'else' below become always true:
} else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
I would suggest to keep the '== MVEBU_GPIO_SOC_VARIANT_A8K' condition,
and reverse the if/else order, because positive logic is more readable.
There is also another 'else' below that is dead code with this patch.
baruch
> /*
> * There are only two sets of PWM configuration registers for
> * all the GPIO lines on those SoCs which this driver reserves
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-07-14 13:19 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
2022-07-14 11:55 ` Pali Rohár
2022-07-14 11:55 ` [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
2022-07-14 11:55 ` Pali Rohár
2022-07-14 11:55 ` [PATCH 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
2022-07-14 11:55 ` Pali Rohár
2022-07-14 11:55 ` [PATCH 4/4] ARM: dts: armada-39x: " Pali Rohár
2022-07-14 11:55 ` Pali Rohár
2022-07-14 13:14 ` Baruch Siach [this message]
2022-07-14 13:14 ` [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Baruch Siach
2022-07-14 13:19 ` Andrew Lunn
2022-07-14 13:19 ` Andrew Lunn
2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
2022-07-14 18:33 ` Pali Rohár
2022-07-14 18:33 ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
2022-07-14 18:33 ` Pali Rohár
2022-07-18 21:18 ` Rob Herring
2022-07-18 21:18 ` Rob Herring
2022-07-14 18:33 ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
2022-07-14 18:33 ` Pali Rohár
2022-07-16 14:40 ` Uwe Kleine-König
2022-07-16 14:40 ` Uwe Kleine-König
2022-07-16 14:50 ` Pali Rohár
2022-07-16 14:50 ` Pali Rohár
2022-07-16 15:07 ` Uwe Kleine-König
2022-07-16 15:07 ` Uwe Kleine-König
2022-07-16 16:09 ` Pali Rohár
2022-07-16 16:09 ` Pali Rohár
2022-07-25 20:04 ` Uwe Kleine-König
2022-07-25 20:04 ` Uwe Kleine-König
2022-08-31 14:30 ` Pali Rohár
2022-08-31 14:30 ` Pali Rohár
2022-09-30 23:34 ` Pali Rohár
2022-09-30 23:34 ` Pali Rohár
2022-10-09 12:05 ` Pali Rohár
2022-10-09 12:05 ` Pali Rohár
2022-11-01 22:44 ` Pali Rohár
2022-11-01 22:44 ` Pali Rohár
2022-11-28 0:05 ` Gregory CLEMENT
2022-11-28 0:05 ` Gregory CLEMENT
2022-12-31 7:18 ` Klaus Kudielka
2022-12-31 7:18 ` Klaus Kudielka
2022-11-28 20:24 ` Chris Packham
2022-11-28 20:24 ` Chris Packham
2022-07-14 18:33 ` [PATCH v2 4/4] ARM: dts: armada-39x: " Pali Rohár
2022-07-14 18:33 ` Pali Rohár
2022-11-28 0:05 ` Gregory CLEMENT
2022-11-28 0:05 ` Gregory CLEMENT
2022-09-24 10:34 ` [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
2022-09-24 10:34 ` Pali Rohár
2022-09-26 7:20 ` Bartosz Golaszewski
2022-09-26 7:20 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lesvde6s.fsf@tarshish \
--to=baruch@tkos.co.il \
--cc=andrew@lunn.ch \
--cc=brgl@bgdev.pl \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=kabel@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=pali@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.