[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFSJ9QN6U81W.19R0VFKTEFZKR@kernel.org>
Date: Mon, 19 Jan 2026 12:36:09 +0100
From: "Danilo Krummrich" <dakr@...nel.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>, "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()
On Mon Jan 19, 2026 at 11:40 AM CET, Bartosz Golaszewski wrote:
> -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;
This should never fail at this point, no? Also, can't we just use of_root?
>
> - 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);
> }
> +EXPORT_SYMBOL_GPL(soc_device_get_machine);
If we want to export this, we shouldn't reuse the existing name, which is
misleading.
soc_device_get_machine() reads as if we return a reference count of something.
Additionally, it operates on struct soc_device_attribute instead of struct
soc_device, where the name suggests the latter.
Instead this should be soc_device_attribute_read_machine() or if we want a
shorter name, just soc_attr_read_machine().
Powered by blists - more mailing lists