Re: [PATCH v2] libfdt: overlay: ensure that existing phandles are not overwritten

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

On Fri, Feb 23, 2024 at 03:41:40PM +1100, David Gibson wrote:
> On Thu, Feb 22, 2024 at 10:38:54AM +0100, Uwe Kleine-König wrote:
> > On Thu, Feb 22, 2024 at 05:32:10PM +1100, David Gibson wrote:
> > > And here you can use fdt32_st() on (tree_val + poffset), avoiding
> > > quite some complexity.
> > 
> > There is some complexity because tree_val is a const char * (as this is
> > what fdt_getprop() returns) and fdt32_st() obviously doens't take a
> > const pointer.
> Ah, right.  You can use fdt_getprop_w() to get a writable pointer
> instead.  If there was a way to have fdt_getprop() return a const
> pointer only if the fdt pointer it was given was const, I'd do that.

Look at how container_of_const() is defined in the kernel[1], this
requires C11 though. See for some docs.

> > If you want to play around with that, the code is mostly a copy of
> > overlay_update_local_node_references() which could benefit from your
> > suggestions in the same way.
> That's quite plausible.
> > Can I lure you in improving overlay_update_local_node_references()? Then
> Fair point..

I gave feedback on that one. Looks good.

> > I could copy from the improved function for my patch. (Or maybe refactor
> > the function to take a function as parameter which is
> Eh... I'd prefer to avoid higher order functions in something this low
> level.


Best regards

Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | |

Attachment: signature.asc
Description: PGP signature

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

  Powered by Linux