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] [thread-next>] [day] [month] [year] [list]
Message-ID: <56E80688.3030407@huawei.com>
Date:	Tue, 15 Mar 2016 20:56:40 +0800
From:	Jiang Qiu <qiujiang@...wei.com>
To:	Andy Shevchenko <andy.shevchenko@...il.com>,
	Alan Tull <delicious.quinoa@...il.com>
CC:	Linus Walleij <linus.walleij@...aro.org>,
	Alexandre Courbot <gnurou@...il.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	<linuxarm@...wei.com>, <haifeng.wei@...wei.com>,
	<charles.chenxin@...wei.com>
Subject: Re: [PATCH v5 1/3] gpio: designware: convert device node to fwnode

在 2016/3/11 4:27, Andy Shevchenko 写道:
> On Thu, Mar 10, 2016 at 9:09 PM, Alan Tull <delicious.quinoa@...il.com> wrote:
>> On Fri, Mar 4, 2016 at 1:44 AM, qiujiang <qiujiang@...wei.com> wrote:
>>> This patch converts device node to fwnode in
>>> dwapb_port_property for designware gpio driver,
>>> so as to provide a unified data structure for DT
>>> and ACPI bindings.
>>>
>>> Acked-by: Andy Shevchenko <andy.shevchenko@...il.com>
>>> Signed-off-by: qiujiang <qiujiang@...wei.com>
>>> @@ -496,18 +492,19 @@ dwapb_gpio_get_pdata_of(struct device *dev)
>>>                  * Only port A can provide interrupts in all configurations of
>>>                  * the IP.
>>>                  */
>>> -               if (pp->idx == 0 &&
>>> -                   of_property_read_bool(port_np, "interrupt-controller")) {
>>> -                       pp->irq = irq_of_parse_and_map(port_np, 0);
>>> +               if (dev->of_node && pp->idx == 0 &&
>>> +                       of_property_read_bool(to_of_node(fwnode),
>>> +                               "interrupt-controller")) {
>> Hi Qiujiang,
>>
>> Is there a reason to use "of_property_read_bool" here instead of
>> "device_property_read_bool" or similar?
> Yeah, this patch looks unfinished.
>
> This should be
>      if (pp->idx == 0 &&  fwnode_property_read_bool(fwnode,
> "interrupt-controller")) { 
>> Alan
>>
>>> +                       pp->irq = irq_of_parse_and_map(to_of_node(fwnode), 0);
> But here should be common method called which takes fwnode on input.
Hi Alan, Andy,

There is some trouble to replace the interface irq_of_parse_and_map and take
fwnode on input.

As far as I know, there are two common APIs to parse interrupt resource:
1) irq_of_parse_and_map() - It is a DT specific API, and have to use of_node as
input.

2) platform_get_irq() - It could be used to DT as well as ACPI, It needs platform_
device as input. In this driver, the DTs is defined as this:

pc_gpio0: gpio@...e0000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "snps,dw-apb-gpio";
                        reg = <0x0 0x802e0000 0x0 0x10000>;

                        porta: gpio-controller@0 {
                                compatible = "snps,dw-apb-gpio-port";
                                gpio-controller;
                                #gpio-cells = <2>;
                                snps,nr-gpios = <32>;
                                reg = <0>;
                                interrupt-controller;
                                #interrupt-cells = <2>;
                                interrupts = <0 312 4>;
                       };
 };

The compatible string, which is "snps,dw-apb-gpio", is only for the parent node.
That is mean, there is no platform device for the child node, but the interrupt
resource is defined in child node.

Is there any other APIs can be used to parse interrupts resource using fwnode
as input?

Thanks, Jiang
>>>                         if (!pp->irq) {
>>>                                 dev_warn(dev, "no irq for bank %s\n",
>>> -                                        port_np->full_name);
>>> +                                        to_of_node(fwnode)->full_name);
>>>                         }
>>>                 }
>>>
>>>                 pp->irq_shared  = false;
>>>                 pp->gpio_base   = -1;
>>> -               pp->name        = port_np->full_name;
>>> +               pp->name        = to_of_node(fwnode)->full_name;
> Also those two should be device property source agnostic. That's what
> I tried to tell earlier.
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ