public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: reset: ltc2952: remove global ltc2952_data structure
@ 2026-04-23  5:16 Nikhil Nagarkar
  0 siblings, 0 replies; only message in thread
From: Nikhil Nagarkar @ 2026-04-23  5:16 UTC (permalink / raw)
  To: sre; +Cc: linux-pm, linux-kernel

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-23  5:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23  5:16 [PATCH] power: reset: ltc2952: remove global ltc2952_data structure Nikhil Nagarkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox