[PATCH 4/4] gpiolib: of: clean up formatting to pass checkpatch

From: Dmitry Torokhov

Date: Sat Jul 18 2026 - 00:14:18 EST


Clean up parameter alignment, line wrapping, and parenthesis formatting
in drivers/gpio/gpiolib-of.c to make the module pass checkpatch --strict
without warnings or checks. This helps when one has checkpach configured
as a linter for their editor.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/gpio/gpiolib-of.c | 46 +++++++++++++++++----------------------
1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 67a36e3851a4..fb3b362744ec 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -135,8 +135,8 @@ of_find_gpio_device_by_xlate(const struct of_phandle_args *gpiospec)
}

static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip,
- struct of_phandle_args *gpiospec,
- enum of_gpio_flags *flags)
+ struct of_phandle_args *gpiospec,
+ enum of_gpio_flags *flags)
{
int ret;

@@ -333,7 +333,7 @@ static void of_gpio_set_polarity_by_property(const struct device_node *np,
if (of_device_is_compatible(np_compat, gpios[i].compatible) &&
!strcmp(propname, gpios[i].gpio_propname)) {
active_high = of_property_read_bool(np_propname,
- gpios[i].polarity_propname);
+ gpios[i].polarity_propname);
of_gpio_quirk_polarity(np, active_high, flags);
break;
}
@@ -415,7 +415,8 @@ static void of_gpio_flags_quirks(const struct device_node *np,
* in flags for the GPIO.
*/
static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np,
- const char *propname, int index, enum of_gpio_flags *flags)
+ const char *propname, int index,
+ enum of_gpio_flags *flags)
{
struct of_phandle_args gpiospec;
struct gpio_desc *desc;
@@ -425,7 +426,7 @@ static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np,
&gpiospec);
if (ret) {
pr_debug("%s: can't parse '%s' property of node '%pOF[%d]'\n",
- __func__, propname, np, index);
+ __func__, propname, np, index);
return ERR_PTR(ret);
}

@@ -967,8 +968,8 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
* This is why we parse chip->of_gpio_n_cells + 1 cells
*/
ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges",
- chip->of_gpio_n_cells + 1,
- index, &pinspec);
+ chip->of_gpio_n_cells + 1,
+ index, &pinspec);
if (ret)
break;

@@ -993,7 +994,7 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
* right instance.
*/
if (chip->of_node_instance_match &&
- (chip->of_gpio_n_cells == 3) &&
+ chip->of_gpio_n_cells == 3 &&
!chip->of_node_instance_match(chip, pinspec.args[0]))
continue;

@@ -1006,12 +1007,11 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
if (count) {
/* npins != 0: linear range */
if (has_group_names) {
- of_property_read_string_index(np,
- group_names_propname,
- index, &name);
+ of_property_read_string_index(np, group_names_propname,
+ index, &name);
if (strlen(name)) {
pr_err("%pOF: Group name of numeric GPIO ranges must be the empty string.\n",
- np);
+ np);
break;
}
}
@@ -1028,41 +1028,35 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
if ((offset + count) > chip->ngpio)
count = chip->ngpio - offset;

- ret = gpiochip_add_pin_range(chip,
- pinctrl_dev_get_devname(pctldev),
- offset,
- pin,
- count);
+ ret = gpiochip_add_pin_range(chip, pinctrl_dev_get_devname(pctldev),
+ offset, pin, count);
if (ret)
return ret;
} else {
/* npins == 0: special range */
if (pin) {
- pr_err("%pOF: Illegal gpio-range format.\n",
- np);
+ pr_err("%pOF: Illegal gpio-range format.\n", np);
break;
}

if (!has_group_names) {
pr_err("%pOF: GPIO group range requested but no %s property.\n",
- np, group_names_propname);
+ np, group_names_propname);
break;
}

- ret = of_property_read_string_index(np,
- group_names_propname,
- index, &name);
+ ret = of_property_read_string_index(np, group_names_propname,
+ index, &name);
if (ret)
break;

if (!strlen(name)) {
pr_err("%pOF: Group name of GPIO group range cannot be the empty string.\n",
- np);
+ np);
break;
}

- ret = gpiochip_add_pingroup_range(chip, pctldev,
- offset, name);
+ ret = gpiochip_add_pingroup_range(chip, pctldev, offset, name);
if (ret)
return ret;
}
--
2.55.0.229.g6434b31f56-goog