[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <308cd9f5-109c-4530-94c4-dd32eecf9ec3@oss.qualcomm.com>
Date: Thu, 9 Jan 2025 15:06:45 +0100
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Stephen Boyd <swboyd@...omium.org>,
Bjorn Andersson
<andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>
Cc: linux-kernel@...r.kernel.org, patches@...ts.linux.dev,
devicetree@...r.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Rob Herring <robh@...nel.org>, linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, Arnd Bergmann <arnd@...db.de>,
Conor Dooley <conor+dt@...nel.org>,
Saravana Kannan <saravanak@...gle.com>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>
Subject: Re: [RFC PATCH 4/6] of: Extract alloc/add functions from
of_platform_device_create_pdata()
On 8.01.2025 2:28 AM, Stephen Boyd wrote:
> Allow drivers to modify the 'struct device' for a device node by
> splitting of_platform_device_create_pdata() into two functions. The
> first function, of_platform_device_alloc(), allocates the platform
> device and the second function, of_platform_device_add(), adds the
> platform device to the platform bus. SoC power management drivers can
> use these APIs to allocate a platform device for a node underneath the
> soc node, attach pmdomains and/or set the device as runtime PM active,
> and finally add the platform device to the platform bus.
>
> Cc: Rob Herring <robh@...nel.org>
> Cc: Saravana Kannan <saravanak@...gle.com>
> Cc: <devicetree@...r.kernel.org>
> Cc: Bjorn Andersson <andersson@...nel.org>
> Cc: Konrad Dybcio <konradybcio@...nel.org>
> Cc: <linux-arm-msm@...r.kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
[...]
> +/**
> + * of_platform_device_add - Add an of_device to the platform bus
> + * @ofdev: of_device to add
> + *
> + * Return: 0 on success, negative errno on failure.
> + */
> +int of_platform_device_add(struct platform_device *ofdev)
> +{
> + struct device_node *np = ofdev->dev.of_node;
> + int ret;
> +
> + pr_debug("adding platform device: %pOF\n", np);
> +
> + ret = of_device_add(ofdev);
> + if (ret) {
> + platform_device_put(ofdev);
> + of_node_clear_flag(np, OF_POPULATED);
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(of_platform_device_add);
> +
> /**
> * of_platform_device_create_pdata - Alloc, initialize and register an of_device
> * @np: pointer to node to create device for
> @@ -154,29 +214,19 @@ static struct platform_device *of_platform_device_create_pdata(
> void *platform_data,
> struct device *parent)
> {
> + int ret;
> struct platform_device *dev;
ultranit: you kept the reverse order above, please keep ret last too
Konrad
Powered by blists - more mailing lists