On Fri, Feb 26, 2016 at 4:44 AM, Joachim Eastwood <manabian@xxxxxxxxx> wrote: > Add support for setting up GPIO pin interrupts in the lpc18xx pinctrl > driver. The LPC18xx SCU contain two registers that sets up the signal > routing to the GPIO pin interrupt (PINT) block. The routing uses the > GPIO namespace and not the pin namespace so a lookup is preformed on > the pin. > > Routing configuration is done in the device tree by using the new > nxp,gpio-pin-interrupt property. This property takes single parameter > which sets the PINT hwirq for the GPIO. > > Signed-off-by: Joachim Eastwood <manabian@xxxxxxxxx> Patch applied. Best way to solve this as of now. > +static int lpc18xx_pin_to_gpio(struct pinctrl_dev *pctldev, unsigned pin) > +{ > + struct pinctrl_gpio_range *range; > + > + range = pinctrl_find_gpio_range_from_pin_nolock(pctldev, pin); > + if (!range) > + return -EINVAL; > + > + return pin - range->pin_base + range->base; > +} It seems this pattern is appearing in a few drivers now, what do you think about factoring this into the core or as a static inline in core.h (so we can avoid EXPORTing)? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html