Skip to contentSkip to conversation

irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend()

PATCH Applied Wei Yongjun 3 participants 4 messages Jul 29, 2020 – Jul 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend()

Gcc report warning as follows:

drivers/irqchip/irq-imx-intmux.c:316:29: warning:
variable 'irqchip_data' set but not used [-Wunused-but-set-variable]

  316 |  struct intmux_irqchip_data irqchip_data;
      |                             ^~~~~~~~~~~~

irqdata regs is stored to this variable on the stack in imx_intmux_runtime_suspend(), which means a nop. this commit fix to save regs to the right place.

Fixes bb403111e017 ("irqchip/imx-intmux: Implement intmux runtime power management")
---
 drivers/irqchip/irq-imx-intmux.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/irqchip/irq-imx-intmux.c +6 -6
index 4c9e40d193d6..e35b7b09c3ab 100644
@@ -313,12 +313,12 @@ static int imx_intmux_remove(struct platform_device *pdev)
 static int imx_intmux_runtime_suspend(struct device *dev)
 {
 	struct intmux_data *data = dev_get_drvdata(dev);
-	struct intmux_irqchip_data irqchip_data;
+	struct intmux_irqchip_data *irqchip_data;
 	int i;
 
 	for (i = 0; i < data->channum; i++) {
-		irqchip_data = data->irqchip_data[i];
-		irqchip_data.saved_reg = readl_relaxed(data->regs + CHANIER(i));
+		irqchip_data = &data->irqchip_data[i];
+		irqchip_data->saved_reg = readl_relaxed(data->regs + CHANIER(i));
 	}
 
 	clk_disable_unprepare(data->ipg_clk);
@@ -329,7 +329,7 @@ static int imx_intmux_runtime_suspend(struct device *dev)
 static int imx_intmux_runtime_resume(struct device *dev)
 {
 	struct intmux_data *data = dev_get_drvdata(dev);
-	struct intmux_irqchip_data irqchip_data;
+	struct intmux_irqchip_data *irqchip_data;
 	int ret, i;
 
 	ret = clk_prepare_enable(data->ipg_clk);
@@ -339,8 +339,8 @@ static int imx_intmux_runtime_resume(struct device *dev)
 	}
 
 	for (i = 0; i < data->channum; i++) {
-		irqchip_data = data->irqchip_data[i];
-		writel_relaxed(irqchip_data.saved_reg, data->regs + CHANIER(i));
+		irqchip_data = &data->irqchip_data[i];
+		writel_relaxed(irqchip_data->saved_reg, data->regs + CHANIER(i));
 	}
 
 	return 0;
#1 lore raw
Quoted 61 lines · Wei Yongjun

Gcc report warning as follows:

drivers/irqchip/irq-imx-intmux.c:316:29: warning:
variable 'irqchip_data' set but not used [-Wunused-but-set-variable]

  316 |  struct intmux_irqchip_data irqchip_data;
      |                             ^~~~~~~~~~~~

irqdata regs is stored to this variable on the stack in imx_intmux_runtime_suspend(), which means a nop. this commit fix to save regs to the right place.

Fixes bb403111e017 ("irqchip/imx-intmux: Implement intmux runtime

power management")

---
 drivers/irqchip/irq-imx-intmux.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/irqchip/irq-imx-intmux.c +3 -3
index 4c9e40d193d6..e35b7b09c3ab 100644
@@ -313,12 +313,12 @@ static int imx_intmux_remove(struct 
 platform_device *pdev)
 static int imx_intmux_runtime_suspend(struct device *dev)
 {
 	struct intmux_data *data = dev_get_drvdata(dev);
-	struct intmux_irqchip_data irqchip_data;
+	struct intmux_irqchip_data *irqchip_data;
 	int i;
 
 	for (i = 0; i < data->channum; i++) {
-		irqchip_data = data->irqchip_data[i];
-		irqchip_data.saved_reg = readl_relaxed(data->regs + CHANIER(i));
+		irqchip_data = &data->irqchip_data[i];
+		irqchip_data->saved_reg = readl_relaxed(data->regs + CHANIER(i));
 	}
 
drivers/irqchip/irq-imx-intmux.c +1 -1
 	clk_disable_unprepare(data->ipg_clk);
@@ -329,7 +329,7 @@ static int imx_intmux_runtime_suspend(struct device 
 *dev)
 static int imx_intmux_runtime_resume(struct device *dev)
 {
 	struct intmux_data *data = dev_get_drvdata(dev);
-	struct intmux_irqchip_data irqchip_data;
+	struct intmux_irqchip_data *irqchip_data;
 	int ret, i;
 
drivers/irqchip/irq-imx-intmux.c +2 -2
 	ret = clk_prepare_enable(data->ipg_clk);
@@ -339,8 +339,8 @@ static int imx_intmux_runtime_resume(struct device 
 *dev)
 	}
 
 	for (i = 0; i < data->channum; i++) {
-		irqchip_data = data->irqchip_data[i];
-		writel_relaxed(irqchip_data.saved_reg, data->regs + CHANIER(i));
+		irqchip_data = &data->irqchip_data[i];
+		writel_relaxed(irqchip_data->saved_reg, data->regs + CHANIER(i));
 	}
 
Quoted 1 line

return 0;

Amazing. Thanks for fixing this.

Johakim: I guess this was never tested, was it?

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#2 lore raw
Quoted 32 lines

-----Original Message-----
From: Marc Zyngier <[email protected]>
Sent: 2020年7月30日 1:00
To: Wei Yongjun <[email protected]>
Cc: Hulk Robot <[email protected]>; Thomas Gleixner <[email protected]>; Jason Cooper <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Joakim Zhang <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH -next] irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend()

Quoted 18 lines · Wei Yongjun

Gcc report warning as follows:

drivers/irqchip/irq-imx-intmux.c:316:29: warning:
variable 'irqchip_data' set but not used [-Wunused-but-set-variable]

  316 |  struct intmux_irqchip_data irqchip_data;
      |                             ^~~~~~~~~~~~

irqdata regs is stored to this variable on the stack in imx_intmux_runtime_suspend(), which means a nop. this commit fix to save regs to the right place.

Fixes bb403111e017 ("irqchip/imx-intmux: Implement intmux runtime

power management")

---
 drivers/irqchip/irq-imx-intmux.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

[...]

Quoted 3 lines

Amazing. Thanks for fixing this.

Johakim: I guess this was never tested, was it?

Hi Marc,

Firstly, thanks Wei Yongjun for fixing this.

I do the intmux function test for each version.

At my side, I test intmux with CAN device. This intmux in M4 core subsystem, devices located in M4 core subsystem will route irqs into intmux. CAN transceiver is controlled by an I/O expander which is lined to I2C from M4 core subsystem. And CAN device is located in A35 core subsystem.

After implementing runtime pm, I test CAN work fine when do suspend/resume test and I check the runtime status. I guess intmux register's state will not lost in M4 core subsystem when system suspended.

However, this is a silly mistake, I am so sorry for this.

Best Regards,
Joakim Zhang

Quoted 3 lines
         M.

--
Jazz is not dead. It just smells funny...

Applied
#3 lore raw
In reply to Wei Yongjun
Quoted 8 lines · Wei Yongjun

Gcc report warning as follows:

drivers/irqchip/irq-imx-intmux.c:316:29: warning:
variable 'irqchip_data' set but not used [-Wunused-but-set-variable]

  316 |  struct intmux_irqchip_data irqchip_data;
      |                             ^~~~~~~~~~~~

[...]

Applied to irq/irqchip-next, thanks!

[1/1] irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend()

      commit: 5b6570bbb26f1dfad5663d99351820865e8c5c7e

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.