lkml.org 
[lkml]   [2022]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 4/5] device property: Constify fwnode_handle_get()
On Wed, Apr 13, 2022 at 05:35:46PM +0300, Sakari Ailus wrote:
> On Sun, Apr 10, 2022 at 05:10:23PM +0300, Andy Shevchenko wrote:
> > On Sat, Apr 9, 2022 at 2:35 AM Sakari Ailus
> > <sakari.ailus@linux.intel.com> wrote:
> > > On Fri, Apr 08, 2022 at 09:48:43PM +0300, Andy Shevchenko wrote:
> > > > As to_of_node() suggests and the way the code in the OF and software node
> > > > back ends actually uses the fwnode handle, it may be constified. Do this
> > > > for good.
> > >
> > > How?
> > >
> > > If the fwnode is const, then the struct it contains must be presumed to be
> > > const, too.
> >
> > Why? The idea is that we are not updating the fwnode, but the container.
> > The container may or may not be const. It's orthogonal, no?
>
> As you wrote: may or may not. The stricter requirement, i.e. const, must be
> thus followed. I think it would be fine (after adding a comment on what is
> being done) if you *know* the container struct is not const. But that is
> not the case here.

But even with the original code one may not guarantee that. How the original
code works or prevents of using a const container against non-const fwnode
pointer?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-04-13 18:59    [W:0.111 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site