From: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
To: Grygorii Strashko
<grygorii.strashko-l0cyMroinI0@public.gmane.org>,
Santosh Shilimkar
<santosh.shilimkar-l0cyMroinI0@public.gmane.org>,
Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs
Date: Sun, 22 Dec 2013 21:22:24 +0530 [thread overview]
Message-ID: <52B70AB8.6030503@ti.com> (raw)
In-Reply-To: <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote:
> The system may crash if:
> - there are more then 1 bank
s/then/than
> - unbanked irqs are enabled
> - someone will call gpio_to_irq() for GPIO from bank2 or above
>
> Hence, fix it by not creating irq_domain if unbanked irqs are enabled
> and correct gpio_to_irq_banked() to handle this properly.
>
> Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
>
> Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
> ---
> drivers/gpio/gpio-davinci.c | 34 +++++++++++++++++++---------------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 5d163c0..1b33806 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset)
> {
> struct davinci_gpio_controller *d = chip2controller(chip);
>
> - return irq_create_mapping(d->irq_domain, d->chip.base + offset);
> + if (d->irq_domain)
> + return irq_create_mapping(d->irq_domain, d->chip.base + offset);
> + else
> + return -ENXIO;
> }
>
> static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
> @@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
> struct davinci_gpio_controller *chips = platform_get_drvdata(pdev);
> struct davinci_gpio_platform_data *pdata = dev->platform_data;
> struct davinci_gpio_regs __iomem *g;
> - struct irq_domain *irq_domain;
> + struct irq_domain *irq_domain = NULL;
>
> ngpio = pdata->ngpio;
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> @@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
> }
> clk_prepare_enable(clk);
>
> - irq = irq_alloc_descs(-1, 0, ngpio, 0);
> - if (irq < 0) {
> - dev_err(dev, "Couldn't allocate IRQ numbers\n");
> - return irq;
> - }
> + if (!pdata->gpio_unbanked) {
> + irq = irq_alloc_descs(-1, 0, ngpio, 0);
> + if (irq < 0) {
> + dev_err(dev, "Couldn't allocate IRQ numbers\n");
> + return -ENODEV;
The code was correct before moving. Any objections to doing
return irq;
instead?
Thanks,
Sekhar
WARNING: multiple messages have this Message-ID (diff)
From: nsekhar@ti.com (Sekhar Nori)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs
Date: Sun, 22 Dec 2013 21:22:24 +0530 [thread overview]
Message-ID: <52B70AB8.6030503@ti.com> (raw)
In-Reply-To: <1387361272-20861-2-git-send-email-grygorii.strashko@ti.com>
On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote:
> The system may crash if:
> - there are more then 1 bank
s/then/than
> - unbanked irqs are enabled
> - someone will call gpio_to_irq() for GPIO from bank2 or above
>
> Hence, fix it by not creating irq_domain if unbanked irqs are enabled
> and correct gpio_to_irq_banked() to handle this properly.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
>
> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> drivers/gpio/gpio-davinci.c | 34 +++++++++++++++++++---------------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 5d163c0..1b33806 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset)
> {
> struct davinci_gpio_controller *d = chip2controller(chip);
>
> - return irq_create_mapping(d->irq_domain, d->chip.base + offset);
> + if (d->irq_domain)
> + return irq_create_mapping(d->irq_domain, d->chip.base + offset);
> + else
> + return -ENXIO;
> }
>
> static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
> @@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
> struct davinci_gpio_controller *chips = platform_get_drvdata(pdev);
> struct davinci_gpio_platform_data *pdata = dev->platform_data;
> struct davinci_gpio_regs __iomem *g;
> - struct irq_domain *irq_domain;
> + struct irq_domain *irq_domain = NULL;
>
> ngpio = pdata->ngpio;
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> @@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
> }
> clk_prepare_enable(clk);
>
> - irq = irq_alloc_descs(-1, 0, ngpio, 0);
> - if (irq < 0) {
> - dev_err(dev, "Couldn't allocate IRQ numbers\n");
> - return irq;
> - }
> + if (!pdata->gpio_unbanked) {
> + irq = irq_alloc_descs(-1, 0, ngpio, 0);
> + if (irq < 0) {
> + dev_err(dev, "Couldn't allocate IRQ numbers\n");
> + return -ENODEV;
The code was correct before moving. Any objections to doing
return irq;
instead?
Thanks,
Sekhar
WARNING: multiple messages have this Message-ID (diff)
From: Sekhar Nori <nsekhar@ti.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>
Cc: Rob Herring <rob.herring@calxeda.com>,
<prabhakar.csengg@gmail.com>,
<davinci-linux-open-source@linux.davincidsp.com>,
<linux-gpio@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs
Date: Sun, 22 Dec 2013 21:22:24 +0530 [thread overview]
Message-ID: <52B70AB8.6030503@ti.com> (raw)
In-Reply-To: <1387361272-20861-2-git-send-email-grygorii.strashko@ti.com>
On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote:
> The system may crash if:
> - there are more then 1 bank
s/then/than
> - unbanked irqs are enabled
> - someone will call gpio_to_irq() for GPIO from bank2 or above
>
> Hence, fix it by not creating irq_domain if unbanked irqs are enabled
> and correct gpio_to_irq_banked() to handle this properly.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
>
> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> drivers/gpio/gpio-davinci.c | 34 +++++++++++++++++++---------------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 5d163c0..1b33806 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -351,7 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset)
> {
> struct davinci_gpio_controller *d = chip2controller(chip);
>
> - return irq_create_mapping(d->irq_domain, d->chip.base + offset);
> + if (d->irq_domain)
> + return irq_create_mapping(d->irq_domain, d->chip.base + offset);
> + else
> + return -ENXIO;
> }
>
> static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
> @@ -429,7 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
> struct davinci_gpio_controller *chips = platform_get_drvdata(pdev);
> struct davinci_gpio_platform_data *pdata = dev->platform_data;
> struct davinci_gpio_regs __iomem *g;
> - struct irq_domain *irq_domain;
> + struct irq_domain *irq_domain = NULL;
>
> ngpio = pdata->ngpio;
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> @@ -453,18 +456,20 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
> }
> clk_prepare_enable(clk);
>
> - irq = irq_alloc_descs(-1, 0, ngpio, 0);
> - if (irq < 0) {
> - dev_err(dev, "Couldn't allocate IRQ numbers\n");
> - return irq;
> - }
> + if (!pdata->gpio_unbanked) {
> + irq = irq_alloc_descs(-1, 0, ngpio, 0);
> + if (irq < 0) {
> + dev_err(dev, "Couldn't allocate IRQ numbers\n");
> + return -ENODEV;
The code was correct before moving. Any objections to doing
return irq;
instead?
Thanks,
Sekhar
next prev parent reply other threads:[~2013-12-22 15:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 10:07 [PATCH v2 0/2] gpio: davinci: reuse for keystone arch Grygorii Strashko
2013-12-18 10:07 ` Grygorii Strashko
2013-12-18 10:07 ` Grygorii Strashko
[not found] ` <1387361272-20861-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-12-18 10:07 ` [PATCH v2 1/2] gpio: davinci: don't create irq_domain in case of unbanked irqs Grygorii Strashko
2013-12-18 10:07 ` Grygorii Strashko
2013-12-18 10:07 ` Grygorii Strashko
2013-12-21 8:20 ` Prabhakar Lad
2013-12-21 8:20 ` Prabhakar Lad
[not found] ` <1387361272-20861-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-12-22 15:52 ` Sekhar Nori [this message]
2013-12-22 15:52 ` Sekhar Nori
2013-12-22 15:52 ` Sekhar Nori
2013-12-23 13:35 ` Grygorii Strashko
2013-12-23 13:35 ` Grygorii Strashko
2013-12-23 13:35 ` Grygorii Strashko
2013-12-18 10:07 ` [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC Grygorii Strashko
2013-12-18 10:07 ` Grygorii Strashko
2013-12-18 10:07 ` Grygorii Strashko
2013-12-21 8:21 ` Prabhakar Lad
2013-12-21 8:21 ` Prabhakar Lad
[not found] ` <1387361272-20861-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-12-22 15:35 ` Sekhar Nori
2013-12-22 15:35 ` Sekhar Nori
2013-12-22 15:35 ` Sekhar Nori
2013-12-22 15:41 ` Sekhar Nori
2013-12-22 15:41 ` Sekhar Nori
2013-12-22 15:41 ` Sekhar Nori
2013-12-23 13:35 ` Grygorii Strashko
2013-12-23 13:35 ` Grygorii Strashko
2013-12-23 13:35 ` Grygorii Strashko
2013-12-20 9:40 ` [PATCH v2 0/2] gpio: davinci: reuse for keystone arch Linus Walleij
2013-12-20 9:40 ` Linus Walleij
[not found] ` <CACRpkdYcvtWNgJ=JCgpZFdZmypLu7UmtpyTQusRshSGT=EqsVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-12-20 14:36 ` Santosh Shilimkar
2013-12-20 14:36 ` Santosh Shilimkar
2013-12-20 14:36 ` Santosh Shilimkar
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=52B70AB8.6030503@ti.com \
--to=nsekhar-l0cymroini0@public.gmane.org \
--cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=santosh.shilimkar-l0cyMroinI0@public.gmane.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: link
Be 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.