mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cache: sifive_ccache: propagate IRQ count errors
@ 2026-10-13  9:57 Avi Weiss
  2026-10-13 22:39 ` Conor Dooley
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Weiss @ 2026-10-13  9:57 UTC (permalink / raw)
  To: Conor Dooley, Jonathan Cameron
  Cc: Paul Walmsley, Samuel Holland, linux-riscv, linux-kernel, Avi Weiss

platform_irq_count() returns -EPROBE_DEFER when the
interrupt provider is not ready, but
sifive_ccache_probe() only checks for a zero count.

-EPROBE_DEFER seems to be the only negative return
code possible here (currently).

A negative count skips the IRQ registration loop and
allows the probe to return success without requesting
a deferred retry.

Return negative IRQ counts so the driver is reprobed
when the interrupt provider becomes available.

Fixes: c90847bcbfb6 ("cache: sifive_ccache: Partially convert to a platform driver")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 drivers/cache/sifive_ccache.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/cache/sifive_ccache.c b/drivers/cache/sifive_ccache.c
index 2acb8bdf06d52..b4033110f34e5 100644
--- a/drivers/cache/sifive_ccache.c
+++ b/drivers/cache/sifive_ccache.c
@@ -262,6 +262,9 @@ static int sifive_ccache_probe(struct platform_device *pdev)
 	quirks = (unsigned long)device_get_match_data(dev);
 
 	intr_num = platform_irq_count(pdev);
+	if (intr_num < 0)
+		return dev_err_probe(dev, intr_num,
+				     "Failed to count interrupts\n");
 	if (!intr_num)
 		return dev_err_probe(dev, -ENODEV, "No interrupts property\n");
 

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
-- 
2.43.0


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

* Re: [PATCH] cache: sifive_ccache: propagate IRQ count errors
  2026-10-13  9:57 [PATCH] cache: sifive_ccache: propagate IRQ count errors Avi Weiss
@ 2026-10-13 22:39 ` Conor Dooley
  0 siblings, 0 replies; 2+ messages in thread
From: Conor Dooley @ 2026-10-13 22:39 UTC (permalink / raw)
  To: Avi Weiss
  Cc: Jonathan Cameron, Paul Walmsley, Samuel Holland, linux-riscv,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]

On Tue, Oct 13, 2026 at 12:57:56PM +0300, Avi Weiss wrote:
> platform_irq_count() returns -EPROBE_DEFER when the
> interrupt provider is not ready, but
> sifive_ccache_probe() only checks for a zero count.
> 
> -EPROBE_DEFER seems to be the only negative return
> code possible here (currently).
> 
> A negative count skips the IRQ registration loop and
> allows the probe to return success without requesting
> a deferred retry.
> 
> Return negative IRQ counts so the driver is reprobed
> when the interrupt provider becomes available.
> 
> Fixes: c90847bcbfb6 ("cache: sifive_ccache: Partially convert to a platform driver")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---
>  drivers/cache/sifive_ccache.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/cache/sifive_ccache.c b/drivers/cache/sifive_ccache.c
> index 2acb8bdf06d52..b4033110f34e5 100644
> --- a/drivers/cache/sifive_ccache.c
> +++ b/drivers/cache/sifive_ccache.c
> @@ -262,6 +262,9 @@ static int sifive_ccache_probe(struct platform_device *pdev)
>  	quirks = (unsigned long)device_get_match_data(dev);
>  
>  	intr_num = platform_irq_count(pdev);
> +	if (intr_num < 0)
> +		return dev_err_probe(dev, intr_num,
> +				     "Failed to count interrupts\n");
>  	if (!intr_num)
>  		return dev_err_probe(dev, -ENODEV, "No interrupts property\n");

I normally hate putting ternary operators in things, but I really don't
like how this looks, especially since the new dev_err_probe() will never
actually ever emit that warning given the behaviour of
platform_irq_count().

Can we do

if (intr_num <= 0)
	return dev_err_probe(dev, ret ?: -ENODEV, "No interrupts property\n");

instead?

Cheers,
Conor.

>  
> 
> base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
> -- 
> 2.43.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2026-10-13 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13  9:57 [PATCH] cache: sifive_ccache: propagate IRQ count errors Avi Weiss
2026-10-13 22:39 ` Conor Dooley

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

all inboxes | Powered by JetHome®