diff mbox series

mmc: atmel-mci: Remove preprocessor directive

Message ID 20230828100421.19758-1-balamanikandan.gunasundar@microchip.com
State New
Headers show
Series mmc: atmel-mci: Remove preprocessor directive | expand

Commit Message

Balamanikandan Gunasundar Aug. 28, 2023, 10:04 a.m. UTC
Remove the preprocessor directive IS_ENABLED(CONFIG_MMC_ATMELMCI) while
checking if the device is compatible with atmel,hsmci. Instead handle it in
the if() condition. The compiler optimizes out the entire if() clause if
the first expression in the if() clause is constant false.

Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
Suggested-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpiolib-of.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Ulf Hansson Sept. 14, 2023, 12:16 p.m. UTC | #1
On Tue, 29 Aug 2023 at 09:18, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Mon, Aug 28, 2023 at 12:04 PM Balamanikandan Gunasundar
> <balamanikandan.gunasundar@microchip.com> wrote:
>
> > Remove the preprocessor directive IS_ENABLED(CONFIG_MMC_ATMELMCI) while
> > checking if the device is compatible with atmel,hsmci. Instead handle it in
> > the if() condition. The compiler optimizes out the entire if() clause if
> > the first expression in the if() clause is constant false.
> >
> > Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
> > Suggested-by: Linus Walleij <linus.walleij@linaro.org>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Thanks for tidying this up Balamanikandan!

Linus, we didn't manage to get this into v6.6. So, it's probably
better if you pick up this via your tree for v6.7.

Note that the commit message header may be a bit misleading, as this
is really a gpio patch. Maybe you can amend that when applying?

Kind regards
Uffe
Linus Walleij Sept. 14, 2023, 1:49 p.m. UTC | #2
On Thu, Sep 14, 2023 at 2:16 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Tue, 29 Aug 2023 at 09:18, Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Mon, Aug 28, 2023 at 12:04 PM Balamanikandan Gunasundar
> > <balamanikandan.gunasundar@microchip.com> wrote:
> >
> > > Remove the preprocessor directive IS_ENABLED(CONFIG_MMC_ATMELMCI) while
> > > checking if the device is compatible with atmel,hsmci. Instead handle it in
> > > the if() condition. The compiler optimizes out the entire if() clause if
> > > the first expression in the if() clause is constant false.
> > >
> > > Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
> > > Suggested-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Thanks for tidying this up Balamanikandan!
>
> Linus, we didn't manage to get this into v6.6. So, it's probably
> better if you pick up this via your tree for v6.7.

Oh it's actually Bartosz managing the GPIO tree these days.
(Which I am very happy about!)

The best is to resend the patch to the GPIO maintainers and
linux-gpio@vger.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 9694eb5afa21..9a191940d5af 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -262,16 +262,15 @@  static void of_gpio_set_polarity_by_property(const struct device_node *np,
 	unsigned int i;
 	bool active_high;
 
-#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
 	/*
 	 * The Atmel HSMCI has compatible property in the parent node and
 	 * gpio property in a child node
 	 */
-	if (of_device_is_compatible(np->parent, "atmel,hsmci")) {
+	if (IS_ENABLED(CONFIG_MMC_ATMELMCI) &&
+	    of_device_is_compatible(np->parent, "atmel,hsmci")) {
 		np_compat = np->parent;
 		np_propname = np;
 	}
-#endif
 
 	for (i = 0; i < ARRAY_SIZE(gpios); i++) {
 		if (of_device_is_compatible(np_compat, gpios[i].compatible) &&