[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXt69AywBVsY3DKH+cS52=Cw1xsvvBDBV3MXirZ+LYj+A@mail.gmail.com>
Date: Mon, 19 Jan 2026 20:23:21 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, "Christophe Leroy (CS GROUP)" <chleroy@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>, Chen-Yu Tsai <wens@...nel.org>,
Jernej Skrabec <jernej.skrabec@...il.com>, Samuel Holland <samuel@...lland.org>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-arm-kernel@...ts.infradead.org,
imx@...ts.linux.dev, linux-renesas-soc@...r.kernel.org,
linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH 3/8] base: soc: export soc_device_get_machine()
Hi Bartosz,
On Mon, 19 Jan 2026 at 11:40, Bartosz Golaszewski
<bartosz.golaszewski@....qualcomm.com> 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 <bartosz.golaszewski@....qualcomm.com>
Thanks for your patch!
> --- a/drivers/base/soc.c
> +++ b/drivers/base/soc.c
> @@ -5,6 +5,7 @@
> * Author: Lee Jones <lee.jones@...aro.org> 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 -- geert@...ux-m68k.org
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
Powered by blists - more mailing lists