lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3eb9d5c2-149c-460c-9684-3fdaf946c400@ieee.org>
Date: Mon, 18 Mar 2024 13:41:38 -0500
From: Alex Elder <elder@...e.org>
To: Markus Elfring <Markus.Elfring@....de>,
 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

On 3/18/24 12:58 PM, Markus Elfring wrote:
> …
>> +++ 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"));

No.

It's a complex enough bit of logic without trying to bury
it inside the parameters passed to the function.

					-Alex

> 
> 
> Regards,
> Markus
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ