Re: [PATCH v1 2/2] gpio: mlxbf3: Support add_pin_ranges()

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

 



On Wed, Aug 16, 2023 at 4:59 PM Asmaa Mnebhi <asmaa@xxxxxxxxxx> wrote:
>
> Support add_pin_ranges() so that pinctrl_gpio_request() can be called.
> The GPIO value is not modified when the user runs the "gpioset" tool.
> This is because when gpiochip_generic_request is invoked by the gpio-mlxbf3
> driver, "pin_ranges" is empty so it skips "pinctrl_gpio_request()".
> pinctrl_gpio_request() is essential in the code flow because it changes the
> mux value so that software has control over modifying the GPIO value.
> Adding add_pin_ranges() creates a dependency on the pinctrl-mlxbf3.c driver.

...

> +static int mlxbf3_gpio_add_pin_ranges(struct gpio_chip *chip)
> +{
> +       int ret;
> +       int id = 0;

Redundant assignment.

> +       id = !!(chip->ngpio % MLXBF3_GPIO_MAX_PINS_PER_BLOCK);

Using int as boolean. Seems to me you wanted something different here.

> +       ret = gpiochip_add_pin_range(chip,
> +                       "MLNXBF34:00",
> +                       chip->base,
> +                       id * MLXBF3_GPIO_MAX_PINS_PER_BLOCK,
> +                       chip->ngpio);
> +       if (ret)
> +               return ret;
> +
> +       return 0;

You can return directly:

  return gpiochip_add_pin_range(...);

> +}

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux