Re: [PATCH v4 4/5] mikrobus: Add mikroBUS driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux