Skip to content

Commit 58e772f

Browse files
author
Bartosz Golaszewski
committed
pinctrl: change the signature of pinctrl_match_gpio_range()
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]>
1 parent 82059c3 commit 58e772f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/pinctrl/core.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,24 @@ static inline int gpio_to_pin(struct pinctrl_gpio_range *range,
292292
/**
293293
* pinctrl_match_gpio_range() - check if a certain GPIO pin is in range
294294
* @pctldev: pin controller device to check
295-
* @gpio: gpio pin to check taken from the global GPIO pin space
295+
* @gc: GPIO chip structure from the GPIO subsystem
296+
* @offset: hardware offset of the GPIO relative to the controller
296297
*
297298
* Tries to match a GPIO pin number to the ranges handled by a certain pin
298299
* controller, return the range or NULL
299300
*/
300301
static struct pinctrl_gpio_range *
301-
pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
302+
pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, struct gpio_chip *gc,
303+
unsigned int offset)
302304
{
303305
struct pinctrl_gpio_range *range;
304306

305307
mutex_lock(&pctldev->mutex);
306308
/* Loop over the ranges */
307309
list_for_each_entry(range, &pctldev->gpio_ranges, node) {
308310
/* Check if we're in the valid range */
309-
if (gpio >= range->base &&
310-
gpio < range->base + range->npins) {
311+
if ((gc->base + offset) >= range->base &&
312+
(gc->base + offset) < range->base + range->npins) {
311313
mutex_unlock(&pctldev->mutex);
312314
return range;
313315
}
@@ -395,7 +397,7 @@ static int pinctrl_get_device_gpio_range(struct gpio_chip *gc,
395397
list_for_each_entry(pctldev, &pinctrldev_list, node) {
396398
struct pinctrl_gpio_range *range;
397399

398-
range = pinctrl_match_gpio_range(pctldev, gc->base + offset);
400+
range = pinctrl_match_gpio_range(pctldev, gc, offset);
399401
if (range) {
400402
*outdev = pctldev;
401403
*outrange = range;

0 commit comments

Comments
 (0)