lkml.org 
[lkml]   [2016]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 1/2] gpio: dwapb: convert device node to fwnode
From
On Fri, Mar 25, 2016 at 9:31 PM, qiujiang <qiujiang@huawei.com> wrote:

> - 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 &&
> + fwnode_property_read_bool(fwnode,
> + "interrupt-controller")) {
> + pp->irq = irq_of_parse_and_map(to_of_node(fwnode), 0);
> 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;
> + if (dev->of_node)
> + pp->name = to_of_node(fwnode)->full_name;

Hi Jiang,

I tested lightly on a CycloneV and it worked fine (with device tree).

One suggestion for both patches: you could remove name from struct
dwapb_port_property and get rid of pp->name and nobody would miss it.
All it is used for is some dev_err's so the device info gets printed
anyway. For example (if I leave the irq out of the DT)

gpio-dwapb ff708000.gpio: no irq for bank /soc/gpio@ff708000/gpio-controller@0

is redundant. The only additional info here from the name is the port
index. That could be added to the messages without having to get the
name through the two property/of methods.

Alan

\
 
 \ /
  Last update: 2016-03-29 19:01    [W:0.075 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site