Re: [PATCH v8 04/10] reset: eyeq5: add platform driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 29, 2024 at 01:18:08PM +0100, Théo Lebrun wrote:
> On Thu Feb 29, 2024 at 12:22 PM CET, Andy Shevchenko wrote:
> > On Wed, Feb 28, 2024 at 06:04:47PM +0100, Théo Lebrun wrote:
> > > On Tue Feb 27, 2024 at 6:27 PM CET, Andy Shevchenko wrote:
> > > > On Tue, Feb 27, 2024 at 03:55:25PM +0100, Théo Lebrun wrote:

...

> > > > > +	priv->rcdev.of_node = np;
> > > >
> > > > It's better to use device_set_node().
> > > 
> > > I don't see how device_set_node() can help? It works on struct device
> > > pointers. Here priv->rcdev is a reset_controller_dev struct. There are
> > > no users of device_set_node() in drivers/reset/.
> >
> > No users doesn't mean it's good. The API is relatively "new" and takes
> > care of two things:
> > 1) it uses agnostic interface;
> > 2) it doesn't require any firmware node direct dereference.
> >
> > The 2) is most important here as allows us to refactor (firmware node) code
> > in the future.
> 
> I think I get the point of device_set_node(). I still do not understand
> how it could help me fill the ->of_node field in a reset_controller_dev
> structure?

Exactly why I put the above comment as recommendation. And then I elaborated
that entire reset framework should rather move towards fwnode.

> Should I be using device_set_node() to fill the struct device pointer
> and the reset subsystem, by some magic, will pick this up and use it
> for its own of_node field? I've not seen any magic/code doing that.

At bare minimum it will give beneficial things:
1) less burden in the drivers conversion in case fwnode happens (and I believe
   it's just matter of time) in reset framework;
2) hiding fwnode/of_node implemetation details (which is currently is layering
   violation to some extend (as we have a lot of *of_*() APIs to avoid direct
   access to of_node field in struct device).

The downside is that you will need to include property.h for this only thing.
And I don't see other code that can be converted to fwnode right away here.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux