lkml.org 
[lkml]   [2023]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 50/73] pinctrl: change the signature of pinctrl_match_gpio_range()
    Date
    From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

    Modify pinctrl_match_gpio_range() to be in line with public GPIO
    helpers and take a pair of GPIO chip & offset as arguments.

    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    ---
    drivers/pinctrl/core.c | 12 +++++++-----
    1 file changed, 7 insertions(+), 5 deletions(-)

    diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
    index 80f1db0ec074..ec78a75a5d7c 100644
    --- a/drivers/pinctrl/core.c
    +++ b/drivers/pinctrl/core.c
    @@ -292,13 +292,15 @@ static inline int gpio_to_pin(struct pinctrl_gpio_range *range,
    /**
    * pinctrl_match_gpio_range() - check if a certain GPIO pin is in range
    * @pctldev: pin controller device to check
    - * @gpio: gpio pin to check taken from the global GPIO pin space
    + * @gc: GPIO chip structure from the GPIO subsystem
    + * @offset: hardware offset of the GPIO relative to the controller
    *
    * Tries to match a GPIO pin number to the ranges handled by a certain pin
    * controller, return the range or NULL
    */
    static struct pinctrl_gpio_range *
    -pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
    +pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, struct gpio_chip *gc,
    + unsigned int offset)
    {
    struct pinctrl_gpio_range *range;

    @@ -306,8 +308,8 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
    /* Loop over the ranges */
    list_for_each_entry(range, &pctldev->gpio_ranges, node) {
    /* Check if we're in the valid range */
    - if (gpio >= range->base &&
    - gpio < range->base + range->npins) {
    + if ((gc->base + offset) >= range->base &&
    + (gc->base + offset) < range->base + range->npins) {
    mutex_unlock(&pctldev->mutex);
    return range;
    }
    @@ -395,7 +397,7 @@ static int pinctrl_get_device_gpio_range(struct gpio_chip *gc,
    list_for_each_entry(pctldev, &pinctrldev_list, node) {
    struct pinctrl_gpio_range *range;

    - range = pinctrl_match_gpio_range(pctldev, gc->base + offset);
    + range = pinctrl_match_gpio_range(pctldev, gc, offset);
    if (range) {
    *outdev = pctldev;
    *outrange = range;
    --
    2.39.2
    \
     
     \ /
      Last update: 2023-10-17 14:09    [W:2.313 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site