lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHCEehKfnUtuzoHQ=XSAzm5n0JqUHmYmjMCyLo2uRvYXc=GwYA@mail.gmail.com>
Date:   Fri, 6 Nov 2020 19:00:00 +0800
From:   Greentime Hu <greentime.hu@...ive.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        linux-riscv <linux-riscv@...ts.infradead.org>,
        Palmer Dabbelt <palmer@...belt.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Yash Shah <yash.shah@...ive.com>
Subject: Re: [RFC PATCH 1/1] gpio: sifive: To get gpio irq offset from device
 tree data

Andy Shevchenko <andy.shevchenko@...il.com> 於 2020年11月6日 週五 下午5:25寫道:
>
> On Fri, Nov 6, 2020 at 4:59 AM Greentime Hu <greentime.hu@...ive.com> wrote:
> >
> > We can get hwirq number of the gpio by its irq_data->hwirq so that we don't
> > need to add more macros for different platforms. This patch is tested in
> > SiFive Unleashed board and SiFive Unmatched board.
>
> ...
>
> > +       struct sifive_gpio *chip = gpiochip_get_data(gc);
> > +       struct irq_data *d = irq_get_irq_data(chip->irq_number[child]);
>
> > +       *parent = d->hwirq;
>
> There is an API to get hwirq.
>
> ...
>
> > +       for (i = 0; i < ngpio; i++)
> > +               chip->irq_number[i] = irq_of_parse_and_map(node, i);
>
> Can't you use platform_get_irq_optional()?
>

Thank you for reviewing.
I would change it like this.

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index e8cd8741dbae..bfb915bf5d78 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -145,7 +145,7 @@ static int
sifive_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
 {
        struct sifive_gpio *chip = gpiochip_get_data(gc);
        struct irq_data *d = irq_get_irq_data(chip->irq_number[child]);
-       *parent = d->hwirq;
+       *parent = irqd_to_hwirq(d);
        *parent_type = IRQ_TYPE_NONE;
        return 0;
 }
@@ -202,7 +202,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
        }

        for (i = 0; i < ngpio; i++)
-               chip->irq_number[i] = irq_of_parse_and_map(node, i);
+               chip->irq_number[i] = platform_get_irq(pdev, i);

        ret = bgpio_init(&chip->gc, dev, 4,
                         chip->base + SIFIVE_GPIO_INPUT_VAL,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ