Re: [PATCH v5 2/9] serdev: Add an API to find the serdev controller associated with the devicetree node
From: Bartosz Golaszewski
Date: Tue Feb 24 2026 - 05:55:50 EST
On Tue, 24 Feb 2026 11:29:36 +0100, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> said:
> On Tue, Feb 24, 2026 at 02:16:17AM -0800, Bartosz Golaszewski wrote:
>> On Tue, 24 Feb 2026 06:30:48 +0100, Manivannan Sadhasivam via B4 Relay
>> <devnull+manivannan.sadhasivam.oss.qualcomm.com@xxxxxxxxxx> said:
>> >
>> > Add of_find_serdev_controller_by_node() API to find the serdev controller
>> > device associated with the devicetree node.
>
> ...
>
>> > +struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node)
>> > +{
>> > + struct device *dev = bus_find_device_by_of_node(&serdev_bus_type, node);
>> > +
>> > + return (dev && dev->type == &serdev_ctrl_type) ? to_serdev_controller(dev) : NULL;
>> > +}
>> > +EXPORT_SYMBOL_GPL(of_find_serdev_controller_by_node);
>>
>> I'm not sure if I commented on it before but there's no reason for this to be
>> OF-centric. It would work equally well as (I think the same should keep the
>> "serdev" prefix too for correct namespacing):
>>
>> struct serdev_controller *serdev_find_controller_by_fwnode(struct
>> fwnode_handle *fwnode)
>> {
>> struct device *dev = bus_find_device_by_fwnode();
>>
>> ...
>> }
>>
>> It would be more flexible and users can always use to_of_node().
>
> IIRC it was discussed already and the fact of use only in DT overlays and
> absence of the user for all this time makes it feel like solving non-existing
> problem. So OF-centric in this case seems to be fine.
>
Ok then.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>