Commit 58e772f4 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

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: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 82059c3d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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;