Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Stephen Boyd <swboyd@chromium.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	devicetree@vger.kernel.org,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Rob Herring" <robh@kernel.org>,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Saravana Kannan" <saravanak@google.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: Re: [RFC PATCH 4/6] of: Extract alloc/add functions from of_platform_device_create_pdata()
Date: Thu, 9 Jan 2025 15:06:45 +0100	[thread overview]
Message-ID: <308cd9f5-109c-4530-94c4-dd32eecf9ec3@oss.qualcomm.com> (raw)
In-Reply-To: <20250108012846.3275443-5-swboyd@chromium.org>

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@kernel.org>
> Cc: Saravana Kannan <saravanak@google.com>
> Cc: <devicetree@vger.kernel.org>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: Konrad Dybcio <konradybcio@kernel.org>
> Cc: <linux-arm-msm@vger.kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.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

  reply	other threads:[~2025-01-09 14:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08  1:28 [RFC PATCH 0/6] qcom: Add an SoC PM driver for sc7180 using PM domains Stephen Boyd
2025-01-08  1:28 ` [RFC PATCH 1/6] bus: Extract simple-bus into self-contained driver Stephen Boyd
2025-01-08 14:11   ` Rob Herring
2025-01-08 22:44     ` Stephen Boyd
2025-01-09 14:02       ` Konrad Dybcio
2025-01-09 21:41         ` Stephen Boyd
2025-01-08  1:28 ` [RFC PATCH 2/6] dt-bindings: bus: Add qcom,soc-sc7180 SoC Stephen Boyd
2025-01-09 14:05   ` Konrad Dybcio
2025-01-09 21:51     ` Stephen Boyd
2025-01-10  0:35       ` Konrad Dybcio
2025-01-10 13:58       ` Rob Herring
2025-01-14 23:22         ` Stephen Boyd
2025-01-08  1:28 ` [RFC PATCH 3/6] bus: Add basic sc7180 bus driver Stephen Boyd
2025-01-08  1:28 ` [RFC PATCH 4/6] of: Extract alloc/add functions from of_platform_device_create_pdata() Stephen Boyd
2025-01-09 14:06   ` Konrad Dybcio [this message]
2025-01-08  1:28 ` [RFC PATCH 5/6] bus: qcom-sc7180: Attach pm domain to watchdog device Stephen Boyd
2025-01-10 14:09   ` Rob Herring
2025-01-15  0:24     ` Stephen Boyd
2025-01-08  1:28 ` [RFC PATCH 6/6] arm64: dts: qcom: sc7180: Add SoC specific compatible to soc node Stephen Boyd
2025-01-08 13:02   ` Dmitry Baryshkov
2025-01-09 14:10     ` Konrad Dybcio
2025-01-09 23:45       ` Dmitry Baryshkov
2025-01-10  0:38         ` Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=308cd9f5-109c-4530-94c4-dd32eecf9ec3@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=konradybcio@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=swboyd@chromium.org \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox