[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 5 May 2017 21:13:39 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Rob Herring <robh+dt@...nel.org>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>,
Frank Rowand <frowand.list@...il.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Wolfram Sang <wsa@...-dreams.de>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [RFC] of/platform: Make of_dev_node_match() helper public
Hi Rob,
On Fri, May 5, 2017 at 8:50 PM, Rob Herring <robh+dt@...nel.org> wrote:
> On Fri, May 5, 2017 at 9:52 AM, Geert Uytterhoeven
> <geert+renesas@...der.be> wrote:
>> Several drivers provide their own match functions, identical to
>> of_dev_node_match() in the OF platform core.
>>
>> Reduce duplication by making of_dev_node_match() public.
>> To avoid conflicts, the duplicates in coresight and i2c must be removed
>> at the same time.
>
> I think you are down one level too far. At least the 2 users here are
> just for calls to bus_find_device. We already have a function for that
There are more of them, some used with driver_find_device().
class_find_device() need a slightly different version, as the data pointer
is const. E.g. drivers/spi/spi.c uses both variants...
device_find_child() can use the same callback.
> with of_find_device_by_node at least for platform devices. Perhaps
> rework that to be "struct device *of_find_bus_device_by_node(struct
> bus_type *b, struct device_node *np)" and then wrappers for each bus
> type. And perhaps make a class variant as well. However, we should
> also consider if OF is the right level. Maybe it should be fwnode
> functions?
There are only 2 of these:
$ git grep 'dev->fwnode == data'
drivers/iommu/arm-smmu-v3.c: return dev->fwnode == data;
drivers/iommu/arm-smmu.c: return dev->fwnode == data;
$
while you can find a few dozen of the OF callbacks.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists