From: Elliot Berman <quic_eberman@quicinc.com>
To: Mukesh Ojha <quic_mojha@quicinc.com>,
Mark Rutland <mark.rutland@arm.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Sebastian Reichel <sre@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-pm@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
<kernel@quicinc.com>,
"Satya Durga Srinivasu Prabhala" <quic_satyap@quicinc.com>,
Melody Olvera <quic_molvera@quicinc.com>,
Prasad Sodagudi <quic_psodagud@quicinc.com>
Subject: Re: [RFC PATCH 2/4] power: reset: reboot-mode: Wire reboot_mode enum to magic
Date: Tue, 25 Jul 2023 14:04:28 -0700 [thread overview]
Message-ID: <fa1c8f0d-f949-0e20-5ff3-b98fd4d64ada@quicinc.com> (raw)
In-Reply-To: <27d9bd35-b69c-5596-8e1a-c42ec2b01f75@quicinc.com>
On 7/25/2023 3:03 AM, Mukesh Ojha wrote:
>
>
> On 7/25/2023 4:00 AM, Elliot Berman wrote:
>> Allow the reboot mode type to be wired to magic.
>>
>> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
>> ---
>> drivers/power/reset/reboot-mode.c | 30 ++++++++++++++++++++++++++----
>> 1 file changed, 26 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/power/reset/reboot-mode.c
>> b/drivers/power/reset/reboot-mode.c
>> index a646aefa041b..4ea97ccbaf51 100644
>> --- a/drivers/power/reset/reboot-mode.c
>> +++ b/drivers/power/reset/reboot-mode.c
>> @@ -22,12 +22,8 @@ struct mode_info {
>> static bool get_reboot_mode_magic(struct reboot_mode_driver *reboot,
>> const char *cmd, unsigned int *magic)
>> {
>> - const char *normal = "normal";
>> struct mode_info *info;
>> - if (!cmd)
>> - cmd = normal;
>> -
>> list_for_each_entry(info, &reboot->head, list) {
>> if (!strcmp(info->mode, cmd)) {
>> *magic = info->magic;
>> @@ -45,6 +41,32 @@ static int reboot_mode_notify(struct notifier_block
>> *this,
>> unsigned int magic;
>> reboot = container_of(this, struct reboot_mode_driver,
>> reboot_notifier);
>> +
>> + if (!cmd) {
>> + switch (mode) {
>
> IIUC, mode will be filled up with reboot_mode during restart
> notifier and not reboot notifiers ?
>
Ah, you're correct. I should register a restart notifier and not use
reboot mode framework. I'll follow similar bindings.
>> + case REBOOT_COLD:
>> + cmd = "cold";
>> + break;
>> + case REBOOT_WARM:
>> + cmd = "warm";
>> + break;
>> + case REBOOT_HARD:
>> + cmd = "hard";
>> + break;
>> + case REBOOT_SOFT:
>> + cmd = "soft";
>> + break;
>> + case REBOOT_GPIO:
>> + cmd = "gpio";
>
> These strings are already there kernel/reboot.c
> Can it be reused ?
>
> #define REBOOT_COLD_STR "cold"
> #define REBOOT_WARM_STR "warm"
> #define REBOOT_HARD_STR "hard"
> #define REBOOT_SOFT_STR "soft"
> #define REBOOT_GPIO_STR "gpio"
> #define REBOOT_UNDEFINED_STR "undefined"
>
>
One set of constants are "binding" for devicetree and the other is for
sysfs. I think they should be kept separate.
>> + break;
>> + }
>> + if (get_reboot_mode_magic(reboot, cmd, &magic)) {
>
> Is info->mode is going to filled up with mode-cold, mode-warm and so
> on from DT to compare against cmd?
>
> What if , cmd is not among the one above switch, NULL pointer during
> strcmp ?
> > -Mukesh
>
>> + reboot->write(reboot, magic);
>> + return NOTIFY_DONE;
>> + }
>> + cmd = "normal";
>> + }
>> +
>> if (get_reboot_mode_magic(reboot, cmd, &magic))
>> reboot->write(reboot, magic);
next prev parent reply other threads:[~2023-07-25 21:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 22:30 [RFC PATCH 0/4] Implement a PSCI SYSTEM_RESET2 reboot-mode driver Elliot Berman
2023-07-24 22:30 ` [RFC PATCH 1/4] power: reset: reboot-mode: Allow magic to be 0 Elliot Berman
2023-07-26 5:06 ` Pavan Kondeti
2023-07-24 22:30 ` [RFC PATCH 2/4] power: reset: reboot-mode: Wire reboot_mode enum to magic Elliot Berman
2023-07-25 10:03 ` Mukesh Ojha
2023-07-25 21:04 ` Elliot Berman [this message]
2023-07-26 5:10 ` Pavan Kondeti
2023-07-24 22:30 ` [RFC PATCH 3/4] dt-bindings: power: reset: Document arm,psci-vendor-reset Elliot Berman
2023-07-24 23:23 ` Rob Herring
2023-07-25 18:01 ` Elliot Berman
2023-07-25 20:26 ` Elliot Berman
2023-07-26 13:45 ` Rob Herring
2023-07-26 17:18 ` Elliot Berman
2023-07-25 8:29 ` Mukesh Ojha
2023-07-24 22:30 ` [RFC PATCH 4/4] power: reset: Implement a PSCI SYSTEM_RESET2 reboot-mode driver Elliot Berman
2023-07-25 5:44 ` Krzysztof Kozlowski
2023-07-26 10:41 ` Pavan Kondeti
2023-07-26 17:19 ` Elliot Berman
2023-07-27 3:00 ` Pavan Kondeti
2023-07-25 19:12 ` [RFC PATCH 0/4] " Florian Fainelli
2023-07-25 20:27 ` Elliot Berman
2023-07-26 17:38 ` Florian Fainelli
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=fa1c8f0d-f949-0e20-5ff3-b98fd4d64ada@quicinc.com \
--to=quic_eberman@quicinc.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@quicinc.com \
--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=linux-pm@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mark.rutland@arm.com \
--cc=quic_mojha@quicinc.com \
--cc=quic_molvera@quicinc.com \
--cc=quic_psodagud@quicinc.com \
--cc=quic_satyap@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
/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