From: Deepak Das <deepak_das@mentor.com> To: Linus Walleij <linus.walleij@linaro.org>, shawnguo@kernel.org Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, Vladimir_Zapolskiy@mentor.com, fabio.estevam@nxp.com, kernel@pengutronix.de, p.zabel@pengutronix.de, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: [PATCH] gpio: mxc: Shift generic request/free after gpiochip registration Date: Tue, 25 Oct 2016 10:27:17 +0530 [thread overview] Message-ID: <580EE62D.4090704@mentor.com> (raw) 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. Signed-off-by: Deepak Das <deepak_das@mentor.com> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> --- drivers/gpio/gpio-mxc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index c1a1e00..9f79a9f 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -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; -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Deepak Das <deepak_das@mentor.com> To: Linus Walleij <linus.walleij@linaro.org>, <shawnguo@kernel.org> Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, <Vladimir_Zapolskiy@mentor.com>, <fabio.estevam@nxp.com>, <kernel@pengutronix.de>, <p.zabel@pengutronix.de>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: [PATCH] gpio: mxc: Shift generic request/free after gpiochip registration Date: Tue, 25 Oct 2016 10:27:17 +0530 [thread overview] Message-ID: <580EE62D.4090704@mentor.com> (raw) 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. Signed-off-by: Deepak Das <deepak_das@mentor.com> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> --- drivers/gpio/gpio-mxc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index c1a1e00..9f79a9f 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -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; -- 1.9.1
next reply other threads:[~2016-10-25 4:57 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-10-25 4:57 Deepak Das [this message] 2016-10-25 4:57 ` [PATCH] gpio: mxc: Shift generic request/free after gpiochip registration Deepak Das 2016-10-25 12:11 ` Linus Walleij 2016-10-25 12:20 ` Deepak Das -- strict thread matches above, loose matches on Subject: below -- 2016-10-24 16:18 Deepak Das 2016-10-25 12:05 ` Linus Walleij 2016-10-24 10:31 Deepak Das
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=580EE62D.4090704@mentor.com \ --to=deepak_das@mentor.com \ --cc=Vladimir_Zapolskiy@mentor.com \ --cc=fabio.estevam@nxp.com \ --cc=kernel@pengutronix.de \ --cc=linus.walleij@linaro.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=p.zabel@pengutronix.de \ --cc=shawnguo@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.