Re: [PATCH RFC] driver core: Ensure DT devices always have fwnode set

From: Mark Brown
Date: Fri Nov 06 2020 - 14:23:18 EST


On Fri, Nov 06, 2020 at 11:09:17AM -0800, Saravana Kannan wrote:

> If you want to do this in "one common place", then I think the way to
> do this is have include/linux/of.h provide something like:

> void of_set_device_of_node(dev, of_node)
> {
> dev->of_node = of_node;
> dev->fw_node = &of_node->fwnode;
> /* bunch of other housekeeping like setting OF_POPULATED and doing
> proper of_node_get() */
> // Passing NULL for of_node could undo all the above for dev->of_node.
> }

That also sounds good, particularly if we have a coccinelle spatch or
some other mechanism that enforced the usage of the function where
appropriate, my main concern is making sure that we do something which
ensures that the boilerplate stuff is handled.

Attachment: signature.asc
Description: PGP signature