All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Sebastian Reichel <sre@kernel.org>, Andrew Davis <afd@ti.com>
Cc: linux-pm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH] power: reset: rmobile-reset: Make sysc_base2 local
Date: Mon, 26 Feb 2024 11:54:52 +0100	[thread overview]
Message-ID: <35f04935c48ae55dc562071e0a1d6fca65234a58.1708944642.git.geert+renesas@glider.be> (raw)

The static global variable sysc_base2 is no longer used outside the
probe method and the reset handler, so it can be converted to a local
variable, and passed to the reset handler via its callback data.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Depends on commits 0867276eb12230a5 ("power: reset: rmobile-reset: Use
devm_platform_ioremap_resource() helper") and ba1188ea8be80a7b ("power:
reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART)") in
battery/for-next (next-20240214 and later).
---
 drivers/power/reset/rmobile-reset.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/reset/rmobile-reset.c b/drivers/power/reset/rmobile-reset.c
index 14682cd59e618d5f..7dbc51c32b0eb4b0 100644
--- a/drivers/power/reset/rmobile-reset.c
+++ b/drivers/power/reset/rmobile-reset.c
@@ -19,10 +19,10 @@
 /* Reset Control Register 2 */
 #define RESCNT2_PRES	0x80000000	/* Soft power-on reset */
 
-static void __iomem *sysc_base2;
-
 static int rmobile_reset_handler(struct sys_off_data *data)
 {
+	void __iomem *sysc_base2 = (void __iomem *)data->cb_data;
+
 	/* Let's assume we have acquired the HPB semaphore */
 	writel(RESCNT2_PRES, sysc_base2 + RESCNT2);
 
@@ -31,6 +31,7 @@ static int rmobile_reset_handler(struct sys_off_data *data)
 
 static int rmobile_reset_probe(struct platform_device *pdev)
 {
+	void __iomem *sysc_base2;
 	int error;
 
 	sysc_base2 = devm_platform_ioremap_resource(pdev, 1);
@@ -41,7 +42,7 @@ static int rmobile_reset_probe(struct platform_device *pdev)
 					      SYS_OFF_MODE_RESTART,
 					      SYS_OFF_PRIO_HIGH,
 					      rmobile_reset_handler,
-					      NULL);
+					      (__force void *)sysc_base2);
 	if (error) {
 		dev_err(&pdev->dev,
 			"cannot register restart handler (err=%d)\n", error);
-- 
2.34.1


             reply	other threads:[~2024-02-26 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 10:54 Geert Uytterhoeven [this message]
2024-02-26 14:12 ` [PATCH] power: reset: rmobile-reset: Make sysc_base2 local 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=35f04935c48ae55dc562071e0a1d6fca65234a58.1708944642.git.geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=afd@ti.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.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 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.