All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Samuel Holland <samuel@sholland.org>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] firmware/psci: Switch to the sys-off handler API
Date: Mon, 7 Nov 2022 10:55:06 +0000	[thread overview]
Message-ID: <20221107105506.pfoxmngp7shhci3p@bogus> (raw)
In-Reply-To: <20221105214841.7828-3-samuel@sholland.org>

On Sat, Nov 05, 2022 at 04:48:40PM -0500, Samuel Holland wrote:
> Any other poweroff handlers registered at the default priority will
> run before the legacy pm_power_off() function. Register the PSCI
> poweroff handler with the correct priority to ensure it runs first.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/firmware/psci/psci.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index e7bcfca4159f..6d528021925d 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c
> @@ -13,7 +13,6 @@
>  #include <linux/errno.h>
>  #include <linux/linkage.h>
>  #include <linux/of.h>
> -#include <linux/pm.h>
>  #include <linux/printk.h>
>  #include <linux/psci.h>
>  #include <linux/reboot.h>
> @@ -322,9 +321,11 @@ static struct notifier_block psci_sys_reset_nb = {
>  	.priority = 129,
>  };
>  
> -static void psci_sys_poweroff(void)
> +static int psci_sys_poweroff(struct sys_off_data *data)
>  {
>  	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
> +
> +	return NOTIFY_DONE;

Just note that PSCI SYSTEM_OFF doesn't return and hence the above return
is useless. I understand the generic idea here and should be fine, just
thought of pointing that the firmware won't return from the call.

-- 
Regards,
Sudeep

WARNING: multiple messages have this Message-ID (diff)
From: Sudeep Holla <sudeep.holla@arm.com>
To: Samuel Holland <samuel@sholland.org>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] firmware/psci: Switch to the sys-off handler API
Date: Mon, 7 Nov 2022 10:55:06 +0000	[thread overview]
Message-ID: <20221107105506.pfoxmngp7shhci3p@bogus> (raw)
In-Reply-To: <20221105214841.7828-3-samuel@sholland.org>

On Sat, Nov 05, 2022 at 04:48:40PM -0500, Samuel Holland wrote:
> Any other poweroff handlers registered at the default priority will
> run before the legacy pm_power_off() function. Register the PSCI
> poweroff handler with the correct priority to ensure it runs first.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/firmware/psci/psci.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index e7bcfca4159f..6d528021925d 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c
> @@ -13,7 +13,6 @@
>  #include <linux/errno.h>
>  #include <linux/linkage.h>
>  #include <linux/of.h>
> -#include <linux/pm.h>
>  #include <linux/printk.h>
>  #include <linux/psci.h>
>  #include <linux/reboot.h>
> @@ -322,9 +321,11 @@ static struct notifier_block psci_sys_reset_nb = {
>  	.priority = 129,
>  };
>  
> -static void psci_sys_poweroff(void)
> +static int psci_sys_poweroff(struct sys_off_data *data)
>  {
>  	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
> +
> +	return NOTIFY_DONE;

Just note that PSCI SYSTEM_OFF doesn't return and hence the above return
is useless. I understand the generic idea here and should be fine, just
thought of pointing that the firmware won't return from the call.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-07 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 21:48 [PATCH 0/2] firmware/psci: Switch to the sys-off handler API Samuel Holland
2022-11-05 21:48 ` Samuel Holland
2022-11-05 21:48 ` [PATCH 1/2] kernel/reboot: Use the static sys-off handler for any priority Samuel Holland
2022-11-05 21:48   ` Samuel Holland
2022-11-06 22:28   ` Dmitry Osipenko
2022-11-06 22:28     ` Dmitry Osipenko
2022-11-05 21:48 ` [PATCH 2/2] firmware/psci: Switch to the sys-off handler API Samuel Holland
2022-11-05 21:48   ` Samuel Holland
2022-11-07 10:55   ` Sudeep Holla [this message]
2022-11-07 10:55     ` Sudeep Holla

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=20221107105506.pfoxmngp7shhci3p@bogus \
    --to=sudeep.holla@arm.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=samuel@sholland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.