The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RESEND] soc/tegra: fuse: Use device-specific instance in suspend/resume
@ 2026-05-14  5:35 Kartik Rajput
  2026-05-14  8:03 ` Jon Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Kartik Rajput @ 2026-05-14  5:35 UTC (permalink / raw)
  To: thierry.reding, jonathanh, kees, linux-tegra, linux-kernel; +Cc: Kartik Rajput

Avoid using the default fuse instance in suspend/resume callbacks, as it
always runs the suspend/resume callbacks for the default instance rather
than the device’s own.

Get the correct fuse instance by using `dev_get_drvdata()`.

Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 291484595dcf..f38107d04ed6 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -259,6 +259,7 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 
 static int __maybe_unused tegra_fuse_runtime_resume(struct device *dev)
 {
+	struct tegra_fuse *fuse = dev_get_drvdata(dev);
 	int err;
 
 	err = clk_prepare_enable(fuse->clk);
@@ -272,6 +273,8 @@ static int __maybe_unused tegra_fuse_runtime_resume(struct device *dev)
 
 static int __maybe_unused tegra_fuse_runtime_suspend(struct device *dev)
 {
+	struct tegra_fuse *fuse = dev_get_drvdata(dev);
+
 	clk_disable_unprepare(fuse->clk);
 
 	return 0;
@@ -279,6 +282,7 @@ static int __maybe_unused tegra_fuse_runtime_suspend(struct device *dev)
 
 static int __maybe_unused tegra_fuse_suspend(struct device *dev)
 {
+	struct tegra_fuse *fuse = dev_get_drvdata(dev);
 	int ret;
 
 	/*
@@ -295,6 +299,7 @@ static int __maybe_unused tegra_fuse_suspend(struct device *dev)
 
 static int __maybe_unused tegra_fuse_resume(struct device *dev)
 {
+	struct tegra_fuse *fuse = dev_get_drvdata(dev);
 	int ret = 0;
 
 	if (fuse->soc->clk_suspend_on)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] soc/tegra: fuse: Use device-specific instance in suspend/resume
  2026-05-14  5:35 [PATCH RESEND] soc/tegra: fuse: Use device-specific instance in suspend/resume Kartik Rajput
@ 2026-05-14  8:03 ` Jon Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Hunter @ 2026-05-14  8:03 UTC (permalink / raw)
  To: Kartik Rajput, thierry.reding, kees, linux-tegra, linux-kernel



On 14/05/2026 06:35, Kartik Rajput wrote:
> Avoid using the default fuse instance in suspend/resume callbacks, as it
> always runs the suspend/resume callbacks for the default instance rather
> than the device’s own.
> 
> Get the correct fuse instance by using `dev_get_drvdata()`.
> 
> Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
> ---
>   drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index 291484595dcf..f38107d04ed6 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -259,6 +259,7 @@ static int tegra_fuse_probe(struct platform_device *pdev)
>   
>   static int __maybe_unused tegra_fuse_runtime_resume(struct device *dev)
>   {
> +	struct tegra_fuse *fuse = dev_get_drvdata(dev);
>   	int err;
>   
>   	err = clk_prepare_enable(fuse->clk);
> @@ -272,6 +273,8 @@ static int __maybe_unused tegra_fuse_runtime_resume(struct device *dev)
>   
>   static int __maybe_unused tegra_fuse_runtime_suspend(struct device *dev)
>   {
> +	struct tegra_fuse *fuse = dev_get_drvdata(dev);
> +
>   	clk_disable_unprepare(fuse->clk);
>   
>   	return 0;
> @@ -279,6 +282,7 @@ static int __maybe_unused tegra_fuse_runtime_suspend(struct device *dev)
>   
>   static int __maybe_unused tegra_fuse_suspend(struct device *dev)
>   {
> +	struct tegra_fuse *fuse = dev_get_drvdata(dev);
>   	int ret;
>   
>   	/*
> @@ -295,6 +299,7 @@ static int __maybe_unused tegra_fuse_suspend(struct device *dev)
>   
>   static int __maybe_unused tegra_fuse_resume(struct device *dev)
>   {
> +	struct tegra_fuse *fuse = dev_get_drvdata(dev);
>   	int ret = 0;
>   
>   	if (fuse->soc->clk_suspend_on)

So now we have both local and global variables called 'fuse'. It would 
be better to have a different name to distinguish between these.

Jon

-- 
nvpublic


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-14  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14  5:35 [PATCH RESEND] soc/tegra: fuse: Use device-specific instance in suspend/resume Kartik Rajput
2026-05-14  8:03 ` Jon Hunter

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