public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Akashdeep Kaur <a-kaur@ti.com>
Cc: praneeth@ti.com, nm@ti.com, afd@ti.com, vigneshr@ti.com,
	kristo@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, aaro.koskinen@iki.fi, andreas@kemnade.info,
	khilman@baylibre.com, rogerq@kernel.org, tony@atomide.com,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	s-ramamoorthy@ti.com, vishalm@ti.com, sebin.francis@ti.com,
	d-gole@ti.com, k-willis@ti.com
Subject: Re: [PATCH 2/2] mfd: tps65219: Make poweroff handler conditional on system-power-controller
Date: Thu, 19 Mar 2026 11:24:05 +0000	[thread overview]
Message-ID: <20260319112405.GJ554736@google.com> (raw)
In-Reply-To: <20260310111846.1084623-3-a-kaur@ti.com>

On Tue, 10 Mar 2026, Akashdeep Kaur wrote:

> Currently, the TPS65219 driver unconditionally registers a poweroff
> handler. This causes issues on systems where a different component
> (such as TF-A firmware) should handle system poweroff instead.
> 
> Make the poweroff handler registration conditional based on the
> "system-power-controller" device tree property. This follows the
> standard kernel pattern where only the designated power controller
> registers for system poweroff operations.
> 
> On systems where the property is absent, the PMIC will not register
> a poweroff handler, allowing other poweroff mechanisms to function.
> 
> Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
> ---
>  drivers/mfd/tps65219.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c
> index 7275dcdb7c44..beb816707d8f 100644
> --- a/drivers/mfd/tps65219.c
> +++ b/drivers/mfd/tps65219.c
> @@ -541,13 +541,19 @@ static int tps65219_probe(struct i2c_client *client)
>  		return ret;
>  	}
>  
> -	ret = devm_register_power_off_handler(tps->dev,
> -					      tps65219_power_off_handler,
> -					      tps);
> -	if (ret) {
> -		dev_err(tps->dev, "failed to register power-off handler: %d\n", ret);
> -		return ret;
> +	/*
> +	 * Only register PMIC power-off handler if system-power-controller
> +	 * property is present.
> +	 */
> +	if (of_device_is_system_power_controller(tps->dev->of_node)) {

The function name `of_device_is_system_power_controller()` is quite
self-descriptive. Is this comment really necessary? The code seems clear
enough without it.

> +		ret = devm_register_power_off_handler(tps->dev,
> +						      tps65219_power_off_handler,
> +						      tps);
> +		if (ret)
> +			return dev_err_probe(tps->dev, ret,
> +					"failed to register power-off handler\n");
>  	}
> +
>  	return 0;
>  }
>  
> -- 
> 2.34.1
> 

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2026-03-19 11:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 11:18 [PATCH 0/2] Make TPS65219 poweroff handler conditional Akashdeep Kaur
2026-03-10 11:18 ` [PATCH 1/2] arm64: dts: ti: k3-am62-lp-sk: Add system-power-controller Akashdeep Kaur
2026-03-10 11:18 ` [PATCH 2/2] mfd: tps65219: Make poweroff handler conditional on system-power-controller Akashdeep Kaur
2026-03-19 11:24   ` Lee Jones [this message]
2026-03-24 10:18     ` Akashdeep Kaur

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=20260319112405.GJ554736@google.com \
    --to=lee@kernel.org \
    --cc=a-kaur@ti.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=afd@ti.com \
    --cc=andreas@kemnade.info \
    --cc=conor+dt@kernel.org \
    --cc=d-gole@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=k-willis@ti.com \
    --cc=khilman@baylibre.com \
    --cc=kristo@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=praneeth@ti.com \
    --cc=robh@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=s-ramamoorthy@ti.com \
    --cc=sebin.francis@ti.com \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    --cc=vishalm@ti.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