From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Sebastian Reichel <sre@kernel.org>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
<linux-pm@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v3 1/2] power: reset: at91-reset: change the power on reason prototype
Date: Mon, 19 Jun 2023 10:10:05 +0200 [thread overview]
Message-ID: <9cb6cebf-80ff-7ca1-6acf-41f58fd831f8@microchip.com> (raw)
In-Reply-To: <20230616135252.2787679-2-miquel.raynal@bootlin.com>
On 16/06/2023 at 15:52, Miquel Raynal wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> It is quite uncommon to use a driver helper with parameters like *pdev
> and __iomem *base. It is much cleaner and close to today's standards to
> provide the per-device driver structure and then access its
> internals. Let's do this with the helper which returns the power on
> reason. While we change the parameters, we can as well rename the
> function from at91_reset_status() to at91_reset_reason() to be more
> accurate with what the helper actually does, and finally because we don't
> really need the pdev argument in this helper besides for printing the
> reset reason, we can move the dev_info() call into the probe.
>
> All these modifications prepare the introduction of a sysfs entry to
> access this information. This way the diff will be much smaller. Thus,
> there is no intended functional change.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks Miquel:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Best regards,
Nicolas
> ---
> drivers/power/reset/at91-reset.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
> index 741e44a017c3..d6884841a6dc 100644
> --- a/drivers/power/reset/at91-reset.c
> +++ b/drivers/power/reset/at91-reset.c
> @@ -149,11 +149,10 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
> return NOTIFY_DONE;
> }
>
> -static void __init at91_reset_status(struct platform_device *pdev,
> - void __iomem *base)
> +static const char * __init at91_reset_reason(struct at91_reset *reset)
> {
> + u32 reg = readl(reset->rstc_base + AT91_RSTC_SR);
> const char *reason;
> - u32 reg = readl(base + AT91_RSTC_SR);
>
> switch ((reg & AT91_RSTC_RSTTYP) >> 8) {
> case RESET_TYPE_GENERAL:
> @@ -185,7 +184,7 @@ static void __init at91_reset_status(struct platform_device *pdev,
> break;
> }
>
> - dev_info(&pdev->dev, "Starting after %s\n", reason);
> + return reason;
> }
>
> static const struct of_device_id at91_ramc_of_match[] = {
> @@ -392,7 +391,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
> if (ret)
> goto disable_clk;
>
> - at91_reset_status(pdev, reset->rstc_base);
> + dev_info(&pdev->dev, "Starting after %s\n", at91_reset_reason(reset));
>
> return 0;
>
> --
> 2.34.1
>
--
Nicolas Ferre
next prev parent reply other threads:[~2023-06-19 8:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 13:52 [PATCH v3 0/2] Expose reset reason through sysfs Miquel Raynal
2023-06-16 13:52 ` [PATCH v3 1/2] power: reset: at91-reset: change the power on reason prototype Miquel Raynal
2023-06-19 8:10 ` Nicolas Ferre [this message]
2023-06-19 21:46 ` Sebastian Reichel
2023-06-16 13:52 ` [PATCH v3 2/2] power: reset: at91-reset: add sysfs interface to the power on reason Miquel Raynal
2023-06-19 21:44 ` Sebastian Reichel
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=9cb6cebf-80ff-7ca1-6acf-41f58fd831f8@microchip.com \
--to=nicolas.ferre@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=sre@kernel.org \
--cc=thomas.petazzoni@bootlin.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;
as well as URLs for NNTP newsgroup(s).