gpio: mxc: Shift generic request/free after gpiochip registration
Subsystems (2)
PATCH 1/1 gpio: mxc: Shift generic request/free after gpiochip registration
generic gpio request/free should be added after gpiocip registration to validate mapping of gpiochip with pinctrl subsystem.
gpiochip->pin_ranges list contains the information used by pinctrl subsystem to configure corresponding pins for gpio usage. This list will be empty if gpiochip fails to map with pinctrl subsystem for any reason.
For Ex.:-
generic gpio request/free should not be used if IOMUX pin controller device node is disabled in device tree.
This commit checks above list and skips adding generic gpio request/free if list is found empty.
--- drivers/gpio/gpio-mxc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpio/gpio-mxc.c +5 -5
@@ -458,11 +458,6 @@ static int mxc_gpio_probe(struct platform_device *pdev)if (err) goto out_bgio; -if (of_property_read_bool (np,"gpio-ranges" )) { - port->gc.request = gpiochip_generic_request; - port->gc.free = gpiochip_generic_free; - } - port->gc.to_irq = mxc_gpio_to_irq; port->gc.base = (pdev->id <0 ) ?of_alias_get_id (np,"gpio" ) *32 : pdev->id *32 ;
@@ -471,6 +466,11 @@ static int mxc_gpio_probe(struct platform_device *pdev)if (err) goto out_bgio; +if (!list_empty (&port->gc.pin_ranges)) { + port->gc.request = gpiochip_generic_request; + port->gc.free = gpiochip_generic_free; + } + irq_base =irq_alloc_descs (-1 ,0 ,32 ,numa_node_id ());if (irq_base <0 ) { err = irq_base;
Signature · 1 line
1.9.1
Quoted 11 lines · Deepak Das
generic gpio request/free should be added after gpiocip registration to validate mapping of gpiochip with pinctrl subsystem.
gpiochip->pin_rangeslist contains the information used by pinctrl subsystem to configure corresponding pins for gpio usage. This list will be empty if gpiochip fails to map with pinctrl subsystem for any reason.
For Ex.:-
generic gpio request/free should not be used if IOMUX pin controller device node is disabled in device tree.
Quoted 5 lines
This commit checks above list and skips adding generic gpio request/free if list is found empty.
Signed-off-by Deepak Das <[email protected]>Signed-off-by Vladimir Zapolskiy <[email protected]>
Third time I find this in my inbox and it still doesn't apply.
Yours,
Linus Walleij
Quoted 16 lines · Linus Walleij
Quoted 14 lines · Deepak Das
generic gpio request/free should be added after gpiocip registration to validate mapping of gpiochip with pinctrl subsystem.
gpiochip->pin_rangeslist contains the information used by pinctrl subsystem to configure corresponding pins for gpio usage. This list will be empty if gpiochip fails to map with pinctrl subsystem for any reason.
For Ex.:-
generic gpio request/free should not be used if IOMUX pin controller device node is disabled in device tree.This commit checks above list and skips adding generic gpio request/free if list is found empty.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Deepak Das <[email protected]>Signed-off-by Vladimir Zapolskiy <[email protected]>Third time I find this in my inbox and it still doesn't apply.
Yours,
Linus Walleij
Hi Linus,
Sorry for the trouble. Three patches were sent by mistake. I am rebasing this patch on top of your gpio fixes branch. This might not be required for stable branch since the original patch
4c806c9 "gpio: mxc: add generic gpio request/free callbacks to pinctrl" was included in v4.9 so this cane be added in v4.9 fixes.
with warm regards,
Deepak Das