Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Bjorn Andersson <andersson@kernel.org>,
	Sebastian Reichel <sre@kernel.org>, Rob Herring <robh@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Souvik Chakravarty <Souvik.Chakravarty@arm.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Andy Yan <andy.yan@rock-chips.com>,
	John Stultz <john.stultz@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Moritz Fischer <moritz.fischer@ettus.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Conor Dooley <conor+dt@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>,
	Andre Draszik <andre.draszik@linaro.org>,
	Kathiravan Thirumoorthy
	<kathiravan.thirumoorthy@oss.qualcomm.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	Srinivas Kandagatla <srini@kernel.org>
Subject: Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
Date: Mon, 5 Jan 2026 23:35:24 +0530	[thread overview]
Message-ID: <87f25d02-2805-9da7-0d7f-05ce8a022d25@oss.qualcomm.com> (raw)
In-Reply-To: <CAMRc=Me8WQ=aMd-NJ1yzzHzqU8fT1u4eb7as=EjSpZ+Rpv9+rg@mail.gmail.com>



On 1/2/2026 5:27 PM, Bartosz Golaszewski wrote:
> On Sun, Dec 28, 2025 at 6:21 PM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
> 
> [snip]
> 
>> +
>> +static int psci_reboot_mode_probe(struct faux_device *fdev)
>> +{
>> +       struct reboot_mode_driver *reboot;
>> +       struct device_node *psci_np;
>> +       struct device_node *np;
>> +       int ret;
>> +
>> +       psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
>> +       if (!psci_np)
>> +               return -ENODEV;
>> +
>> +       /*
>> +        * Find the psci:reboot-mode node.
>> +        * If NULL, continue to register predefined modes.
>> +        * np refcount to be handled by dev;
>> +        * psci_np refcount is decremented by of_find_node_by_name;
>> +        */
> 
> Can you make this comment into full sentences, I had trouble parsing
> the meaning for a minute.

Ack.

> 
>> +       np = of_find_node_by_name(psci_np, "reboot-mode");
>> +       fdev->dev.of_node = np;
> 
> The logic of the device assigning its own node is a bit sketchy,
> ideally this should be done before the device probes.

Will move it to init. thanks.

> 
>> +
>> +       reboot = devm_kzalloc(&fdev->dev, sizeof(*reboot), GFP_KERNEL);
>> +       if (!reboot)
>> +               return -ENOMEM;
>> +
>> +       psci_reboot_mode_set_predefined_modes(reboot);
>> +       reboot->write = psci_reboot_mode_write;
>> +       reboot->dev = &fdev->dev;
>> +
>> +       ret = devm_reboot_mode_register(&fdev->dev, reboot);
>> +       if (ret) {
>> +               dev_err(&fdev->dev, "devm_reboot_mode_register failed %d\n", ret);
>> +               return ret;
> 
> Use dev_err_probe().

Ack.

> 
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>> +static struct faux_device_ops psci_reboot_mode_ops = {
>> +       .probe = psci_reboot_mode_probe,
>> +};
>> +
>> +static int __init psci_reboot_mode_init(void)
>> +{
>> +       struct faux_device *fdev;
>> +
>> +       fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
>> +       if (!fdev)
>> +               return -ENODEV;
> 
> This will always create this device for everyone who includes this
> module. Move the of_find_compatible_node(NULL, NULL, "arm,psci-1.0")
> call from probe() here instead and don't create the device if it
> fails.

Ack. 
Will move both calls to init before creating the faux device. 

psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
and 
np = of_find_node_by_name(psci_np, "reboot-mode");
--

thanks,
Shivendra

  reply	other threads:[~2026-01-05 18:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
2026-01-02 10:05   ` Bartosz Golaszewski
2026-01-05 17:53     ` Shivendra Pratap
2026-01-06 12:31       ` Bartosz Golaszewski
2026-01-05 18:16     ` Shivendra Pratap
2026-01-05 21:31       ` Dmitry Baryshkov
2026-01-06  6:31         ` Shivendra Pratap
2026-01-06 12:30           ` Bartosz Golaszewski
2026-01-06 14:47             ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 02/10] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 03/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-01-02 11:57   ` Bartosz Golaszewski
2026-01-05 18:05     ` Shivendra Pratap [this message]
2026-01-06 12:34       ` Bartosz Golaszewski
2026-01-06 14:45         ` Shivendra Pratap
2026-01-06 15:06           ` Bartosz Golaszewski
2026-03-02 12:30     ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 08/10] arm64: dts: qcom: lemans: " Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 09/10] arm64: dts: qcom: monaco: " Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 10/10] arm64: dts: qcom: talos: " Shivendra Pratap
2026-01-06 11:08 ` [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-01-24 10:38   ` Shivendra Pratap
2026-01-26 13:38     ` Lorenzo Pieralisi
2026-02-10 14:05       ` Shivendra Pratap
2026-03-02 12:39         ` Shivendra Pratap

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=87f25d02-2805-9da7-0d7f-05ce8a022d25@oss.qualcomm.com \
    --to=shivendra.pratap@oss.qualcomm.com \
    --cc=Souvik.Chakravarty@arm.com \
    --cc=andersson@kernel.org \
    --cc=andre.draszik@linaro.org \
    --cc=andy.yan@rock-chips.com \
    --cc=arnd@arndb.de \
    --cc=brgl@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=john.stultz@linaro.org \
    --cc=kathiravan.thirumoorthy@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=moritz.fischer@ettus.com \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    --cc=srini@kernel.org \
    --cc=sudeep.holla@arm.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