[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fe6f68a-786c-4e3d-b97d-847d6965d1d3@web.de>
Date: Mon, 18 Mar 2024 18:58:10 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Ayush Singh <ayushdevel1325@...il.com>,
Vaishnav M A <vaishnav@...gleboard.org>, devicetree@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-spi@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, lorforlinux@...gleboard.org,
greybus-dev@...ts.linaro.org
Cc: LKML <linux-kernel@...r.kernel.org>, Alex Elder <elder@...nel.org>,
Arnd Bergmann <arnd@...db.de>, Conor Dooley <conor+dt@...nel.org>,
Derek Kiernan <derek.kiernan@....com>, Dragan Cvetic
<dragan.cvetic@....com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jason Kridner <jkridner@...gleboard.org>, Johan Hovold <johan@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Mark Brown <broonie@...nel.org>, Nishanth Menon <nm@...com>,
Rob Herring <robh@...nel.org>, Robert Nelson
<robertcnelson@...gleboard.org>, Tero Kristo <kristo@...nel.org>,
Vaishnav M A <vaishnav.a@...com>, Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [PATCH v4 4/5] mikrobus: Add mikroBUS driver
…
> +++ b/drivers/misc/mikrobus/mikrobus_core.c
…
> +static int mikrobus_pinctrl_setup(struct mikrobus_port *port,
> + struct addon_board_info *board)
> +{
> + int ret;
> +
> + if (!board || board->pin_state[MIKROBUS_PIN_PWM] == MIKROBUS_STATE_PWM)
> + ret = mikrobus_pinctrl_select(port, "pwm_default");
> + else
> + ret = mikrobus_pinctrl_select(port, "pwm_gpio");
…
How do you think about to avoid the specification of a bit of duplicate source code here
by using conditional operator expressions?
ret = mikrobus_pinctrl_select(port,
((!board ||
board->pin_state[MIKROBUS_PIN_PWM] == MIKROBUS_STATE_PWM)
? "pwm_default"
: "pwm_gpio"));
Regards,
Markus
Powered by blists - more mailing lists