public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled()
@ 2021-11-15 20:46 marek.vasut
  2021-11-15 21:59 ` Krzysztof Wilczyński
  2021-12-01 16:24 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: marek.vasut @ 2021-11-15 20:46 UTC (permalink / raw)
  To: linux-pci
  Cc: Marek Vasut, Geert Uytterhoeven, Randy Dunlap, Arnd Bergmann,
	Bjorn Helgaas, Lorenzo Pieralisi, Stephen Boyd, Wolfram Sang,
	Yoshihiro Shimoda, linux-renesas-soc

From: Marek Vasut <marek.vasut+renesas@gmail.com>

Replace __clk_is_enabled() with pm_runtime_suspended(),
as __clk_is_enabled() was checking the wrong bus clock
and caused the following build error too:
  arm-linux-gnueabi-ld: drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
  pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'

Fixes: a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: linux-renesas-soc@vger.kernel.org
---
V2: Drop the __clk_is_enabled(), like it was done already in V1 of
    a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")
V3: Use pm_runtime_suspended() instead of __clk_is_enabled()
V4: Rework the commit message
---
 drivers/pci/controller/pcie-rcar-host.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index e12c2d8be05a..138592e22600 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -50,10 +50,10 @@ struct rcar_msi {
  */
 static void __iomem *pcie_base;
 /*
- * Static copy of bus clock pointer, so we can check whether the clock
- * is enabled or not.
+ * Static copy of pcie device pointer, so we can check whether the
+ * device is runtime suspended or not.
  */
-static struct clk *pcie_bus_clk;
+static struct device *pcie_dev;
 #endif
 
 /* Structure representing the PCIe interface */
@@ -792,7 +792,7 @@ static int rcar_pcie_get_resources(struct rcar_pcie_host *host)
 #ifdef CONFIG_ARM
 	/* Cache static copy for L1 link state fixup hook on aarch32 */
 	pcie_base = pcie->base;
-	pcie_bus_clk = host->bus_clk;
+	pcie_dev = pcie->dev;
 #endif
 
 	return 0;
@@ -1062,7 +1062,7 @@ static int rcar_pcie_aarch32_abort_handler(unsigned long addr,
 
 	spin_lock_irqsave(&pmsr_lock, flags);
 
-	if (!pcie_base || !__clk_is_enabled(pcie_bus_clk)) {
+	if (!pcie_base || pm_runtime_suspended(pcie_dev)) {
 		ret = 1;
 		goto unlock_exit;
 	}
-- 
2.33.0


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

* Re: [PATCH v4] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled()
  2021-11-15 20:46 [PATCH v4] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled() marek.vasut
@ 2021-11-15 21:59 ` Krzysztof Wilczyński
  2021-12-01 16:24 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-11-15 21:59 UTC (permalink / raw)
  To: marek.vasut
  Cc: linux-pci, Marek Vasut, Geert Uytterhoeven, Randy Dunlap,
	Arnd Bergmann, Bjorn Helgaas, Lorenzo Pieralisi, Stephen Boyd,
	Wolfram Sang, Yoshihiro Shimoda, linux-renesas-soc, Sasha Levin

[+CC Adding Sasha for visibility]

Hi Marek,

Thank you for taking care about this.  I am adding Sasha since this is
something we should most likely port to stable and long-term kernels,
especially since this isn't a new driver.

[...]
> - * Static copy of bus clock pointer, so we can check whether the clock
> - * is enabled or not.
> + * Static copy of pcie device pointer, so we can check whether the
> + * device is runtime suspended or not.

A small nitpick: it would be "PCIe" in the above comment.  However,
probably not worth sending another version just for this.

	Krzysztof

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

* Re: [PATCH v4] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled()
  2021-11-15 20:46 [PATCH v4] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled() marek.vasut
  2021-11-15 21:59 ` Krzysztof Wilczyński
@ 2021-12-01 16:24 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2021-12-01 16:24 UTC (permalink / raw)
  To: marek.vasut, linux-pci
  Cc: Lorenzo Pieralisi, Wolfram Sang, linux-renesas-soc, Arnd Bergmann,
	Randy Dunlap, Bjorn Helgaas, Stephen Boyd, Marek Vasut,
	Yoshihiro Shimoda, Geert Uytterhoeven

On Mon, 15 Nov 2021 21:46:41 +0100, marek.vasut@gmail.com wrote:
> From: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> Replace __clk_is_enabled() with pm_runtime_suspended(),
> as __clk_is_enabled() was checking the wrong bus clock
> and caused the following build error too:
>   arm-linux-gnueabi-ld: drivers/pci/controller/pcie-rcar-host.o: in function `rcar_pcie_aarch32_abort_handler':
>   pcie-rcar-host.c:(.text+0xdd0): undefined reference to `__clk_is_enabled'
> 
> [...]

Applied to pci/rcar, thanks!

[1/1] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled()
      https://git.kernel.org/lpieralisi/pci/c/d2a14b5498

Thanks,
Lorenzo

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

end of thread, other threads:[~2021-12-01 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-15 20:46 [PATCH v4] PCI: rcar: Check if device is runtime suspended instead of __clk_is_enabled() marek.vasut
2021-11-15 21:59 ` Krzysztof Wilczyński
2021-12-01 16:24 ` Lorenzo Pieralisi

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