Hi Bartosz, On Mon, 19 Jan 2026 at 11:40, Bartosz Golaszewski <[email protected]> wrote: > Some SoC drivers reimplement the functionality of > soc_device_get_machine(). Make this function accessible through the > sys_soc.h header. Rework it slightly to return a negative error number > on failure to read the machine string (SoC core can keep on ignoring > it). While at it: make it use the __free() helper from cleanup.h. > > Signed-off-by: Bartosz Golaszewski <[email protected]>
Thanks for your patch! > --- a/drivers/base/soc.c > +++ b/drivers/base/soc.c > @@ -5,6 +5,7 @@ > * Author: Lee Jones <[email protected]> for ST-Ericsson. > */ > > +#include <linux/cleanup.h> > #include <linux/err.h> > #include <linux/glob.h> > #include <linux/idr.h> > @@ -111,17 +112,18 @@ static void soc_release(struct device *dev) > kfree(soc_dev); > } > > -static void soc_device_get_machine(struct soc_device_attribute *soc_dev_attr) > +int soc_device_get_machine(struct soc_device_attribute *soc_dev_attr) > { > - struct device_node *np; > - > if (soc_dev_attr->machine) > - return; > + return -EBUSY; > + > + struct device_node *np __free(device_node) = > of_find_node_by_path("/"); > + if (!np) > + return -ENOENT; > > - np = of_find_node_by_path("/"); > - of_property_read_string(np, "model", &soc_dev_attr->machine); > - of_node_put(np); > + return of_property_read_string(np, "model", &soc_dev_attr->machine); I am not so fond of these of_find_node_by_path("/") + something replacements. What about adding an of_machine_get_model() helper? > } > +EXPORT_SYMBOL_GPL(soc_device_get_machine); > > static struct soc_device_attribute *early_soc_dev_attr; > Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
