Skip to contentSkip to conversation

pinctrl: qcom: spmi-gpio: Assign boolean values to a bool variable

PATCH In review Jiapeng Zhong 3 participants 3 messages Jan 20, 2021 – Jan 22, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: qcom: spmi-gpio: Assign boolean values to a bool variable

Fix the following coccicheck warnings:

./drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c:340:3-15: WARNING:
Assignment of 0/1 to bool variable.

---
 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +4 -4
index b5949f7..eb0b60c 100644
@@ -331,13 +331,13 @@ static int pm8xxx_pin_config_set(struct pinctrl_dev *pctldev,
 		case PIN_CONFIG_BIAS_DISABLE:
 			pin->bias = PM8XXX_GPIO_BIAS_NP;
 			banks |= BIT(2);
-			pin->disable = 0;
+			pin->disable = false;
 			banks |= BIT(3);
 			break;
 		case PIN_CONFIG_BIAS_PULL_DOWN:
 			pin->bias = PM8XXX_GPIO_BIAS_PD;
 			banks |= BIT(2);
-			pin->disable = 0;
+			pin->disable = false;
 			banks |= BIT(3);
 			break;
 		case PM8XXX_QCOM_PULL_UP_STRENGTH:
@@ -350,11 +350,11 @@ static int pm8xxx_pin_config_set(struct pinctrl_dev *pctldev,
 		case PIN_CONFIG_BIAS_PULL_UP:
 			pin->bias = pin->pull_up_strength;
 			banks |= BIT(2);
-			pin->disable = 0;
+			pin->disable = false;
 			banks |= BIT(3);
 			break;
 		case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
-			pin->disable = 1;
+			pin->disable = true;
 			banks |= BIT(3);
 			break;
 		case PIN_CONFIG_INPUT_ENABLE:
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jiapeng Zhong

Fix the following coccicheck warnings:

./drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c:340:3-15: WARNING:
Assignment of 0/1 to bool variable.

Although we're mixing bool/int on line 417 and 637 as well, with:

	val |= pin->disable;

and

	pin->disable = val & BIT(0);

respectively. The latter could be dealt with using !!(val & BIT(0)); I guess the appropriate for for the prior is:

	if (pin->disable)
		val |= BIT(0);

If you would like to update your patch with these as well I'd be happy to review this.

Thanks,
Bjorn

Quoted 41 lines
---
 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +4 -4
index b5949f7..eb0b60c 100644
@@ -331,13 +331,13 @@ static int pm8xxx_pin_config_set(struct pinctrl_dev *pctldev,
 		case PIN_CONFIG_BIAS_DISABLE:
 			pin->bias = PM8XXX_GPIO_BIAS_NP;
 			banks |= BIT(2);
-			pin->disable = 0;
+			pin->disable = false;
 			banks |= BIT(3);
 			break;
 		case PIN_CONFIG_BIAS_PULL_DOWN:
 			pin->bias = PM8XXX_GPIO_BIAS_PD;
 			banks |= BIT(2);
-			pin->disable = 0;
+			pin->disable = false;
 			banks |= BIT(3);
 			break;
 		case PM8XXX_QCOM_PULL_UP_STRENGTH:
@@ -350,11 +350,11 @@ static int pm8xxx_pin_config_set(struct pinctrl_dev *pctldev,
 		case PIN_CONFIG_BIAS_PULL_UP:
 			pin->bias = pin->pull_up_strength;
 			banks |= BIT(2);
-			pin->disable = 0;
+			pin->disable = false;
 			banks |= BIT(3);
 			break;
 		case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
-			pin->disable = 1;
+			pin->disable = true;
 			banks |= BIT(3);
 			break;
 		case PIN_CONFIG_INPUT_ENABLE:
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 20 lines · Bjorn Andersson
Quoted 7 lines · Jiapeng Zhong

Fix the following coccicheck warnings:

./drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c:340:3-15: WARNING:
Assignment of 0/1 to bool variable.

Although we're mixing bool/int on line 417 and 637 as well, with:

        val |= pin->disable;

and

        pin->disable = val & BIT(0);
Quoted 8 lines

respectively. The latter could be dealt with using !!(val & BIT(0)); I guess the appropriate for for the prior is:

        if (pin->disable)
                val |= BIT(0);

If you would like to update your patch with these as well I'd be happy to review this.

I would opt for a respin with the above when we are anyways at it, no hurry as it is no regression anyway.

Yours,
Linus Walleij