Re: [RFC PATCH 68/77] libfdt: Introduce fdt_getprop_by_offset_w()
David Gibson <[email protected]> Thu, 15 Jan 2026 18:05:06 +1100
| Newsgroups | org.kernel.vger.devicetree-spec,org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aWiRomw0BdWPddZ1@zatzit> |
On Mon, Jan 12, 2026 at 03:19:58PM +0100, Herve Codina wrote: > The future support for applying a addon on a base device-tree needs to > modify properties retrieved by their offset. > > fdt_getprop_by_offset() already exists to get a preperty by its offset > but the property returned is read-only. A writable returned property is > needed. > > Fill the lack and introduce fdt_getprop_by_offset_w(), the write enabled > variant of fdt_getprop_by_offset(). > > Signed-off-by: Herve Codina <[email protected]> Add a testcase, and this could be merged regardless of the rest of the series. > --- > libfdt/libfdt.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h > index 37459a6..0c654b1 100644 > --- a/libfdt/libfdt.h > +++ b/libfdt/libfdt.h > @@ -858,6 +858,12 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, > #ifndef SWIG /* This function is not useful in Python */ > const void *fdt_getprop_by_offset(const void *fdt, int offset, > const char **namep, int *lenp); > +static inline void *fdt_getprop_by_offset_w(const void *fdt, int offset, > + const char **namep, int *lenp) > +{ > + return (void *)(uintptr_t)fdt_getprop_by_offset(fdt, offset, namep, > + lenp); > +} > #endif > > /** > -- > 2.52.0 > > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmlokaEACgkQzQJF27ox 2GfL+w//Y7Ye9X8sukmMAsKoBLRlzCDDoO9VJFGEw+hNH6klsCuS3ZnV8h/p6hhr CUQnspBNXArVL+VCOQPaogNlmPHrvwjS+ScJuesoBbB8Cao+4hfO5WHMzaYmyPyC lsygOuiOPTFrlssDEf1dF2OKIqlaTAPVlC08p31sndcDjcfDg1WnPl0/KpmhV+Qe kCJgXFHIK1l9w5BxKYHbIfkppx0gvLWIrKaI5PEuQIzzFW7/HSx2sI69qTDyHZvy Uu27+QSc7LZm9zIlwmSAnohLY+GDIujG0P5mQ9EPN76o+QC7dfflJi1vzejELofT 5pScfBPiLMACPZ8WUSpuVtUt61UulpCYnJRH1p1gK8cZa6Dxh+UcKDuPl/02g71b cv3wMJiNNFBHDqDqWhlAkRpb6gU/GZgH2JZAoQa9roLuPdmIVPnk0OnFoHdnJSng hvv0MLxddRCEBsYPGsOz9nmUcIValI/sgISdPInDvff4yvtDlEnEBQT8VLAzIbHt RcNNnKrKA6oEalsB967R33l0YXrBAnfjE4bbqW6B8GI0m7yh6RD7eiKp6Zj6Ay8G JCn2hN0leXHStPasA8NnU2b30XxRWa3qr6rfnPlSQS3RpDD+RghZv/IOYdlydaLy zdSFa/MDGLet02zPeu2BV+j0qBJRazpa7PyQJLkwaFfWw7548Ig= =BUav -----END PGP SIGNATURE-----