[PATCH] power: reset: ltc2952: remove global ltc2952_data structure

From: Nikhil Nagarkar

Date: Thu Apr 23 2026 - 01:17:40 EST


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@xxxxxxxxx>
---
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