public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikhil Nagarkar <nikhilnagarkar97@gmail.com>
To: sre@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] power: reset: ltc2952: remove global ltc2952_data structure
Date: Wed, 22 Apr 2026 22:16:01 -0700	[thread overview]
Message-ID: <20260423051601.250932-1-nikhilnagarkar97@gmail.com> (raw)

The driver currently uses a global pointer (ltc2952_data) to store its
entire state structure just to access the gpio_kill descriptor during
the power-off sequence.

Refactor the driver to use a specific static gpio_desc pointer for
the kill signal. This addresses the existing TODO in the function.

Signed-off-by: Nikhil Nagarkar <nikhilnagarkar97@gmail.com>
---
 drivers/power/reset/ltc2952-poweroff.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c
index 90c664d344d0..f07283d38cbd 100644
--- a/drivers/power/reset/ltc2952-poweroff.c
+++ b/drivers/power/reset/ltc2952-poweroff.c
@@ -77,12 +77,7 @@ struct ltc2952_poweroff {
 
 #define to_ltc2952(p, m) container_of(p, struct ltc2952_poweroff, m)
 
-/*
- * This global variable is only needed for pm_power_off. We should
- * remove it entirely once we don't need the global state anymore.
- */
-static struct ltc2952_poweroff *ltc2952_data;
-
+static struct gpio_desc *ltc2952_poweroff_gpio_kill;
 /**
  * ltc2952_poweroff_timer_wde - Timer callback
  * Toggles the watchdog reset signal each wde_interval
@@ -154,7 +149,7 @@ static irqreturn_t ltc2952_poweroff_handler(int irq, void *dev_id)
 
 static void ltc2952_poweroff_kill(void)
 {
-	gpiod_set_value(ltc2952_data->gpio_kill, 1);
+	gpiod_set_value(ltc2952_poweroff_gpio_kill, 1);
 }
 
 static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
@@ -274,8 +269,7 @@ static int ltc2952_poweroff_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	/* TODO: remove ltc2952_data */
-	ltc2952_data = data;
+	ltc2952_poweroff_gpio_kill = data->gpio_kill;
 	pm_power_off = ltc2952_poweroff_kill;
 
 	data->panic_notifier.notifier_call = ltc2952_poweroff_notify_panic;
-- 
2.34.1


                 reply	other threads:[~2026-04-23  5:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260423051601.250932-1-nikhilnagarkar97@gmail.com \
    --to=nikhilnagarkar97@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox