Skip to contentSkip to conversation

soc/tegra: fuse: Use device-specific instance in suspend/resume

PATCH RESEND In review Kartik Rajput 2 participants 2 messages May 14 Tegra architecture support

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 soc/tegra: fuse: Use device-specific instance in suspend/resume

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().

---
 drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/soc/tegra/fuse/fuse-tegra.c +5 -0
index 291484595dcf..f38107d04ed6 100644
@@ -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)
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 41 lines · 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().

---
  drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/soc/tegra/fuse/fuse-tegra.c +4 -0
index 291484595dcf..f38107d04ed6 100644
@@ -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;
 
  	/*

drivers/soc/tegra/fuse/fuse-tegra.c static int __maybe_unused tegra_fuse_suspend(struct device *dev) · line 305

Quoted 7 lines
drivers/soc/tegra/fuse/fuse-tegra.c +1 -0
@@ -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

Signature · 1 line
nvpublic