mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] cache: sifive_ccache: propagate IRQ count errors
@ 2026-10-15  8:45 Avi Weiss
  2026-10-16 17:27 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Weiss @ 2026-10-15  8:45 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>
---
Changes in v2:
- Combine the negative and zero IRQ count checks as suggested by Conor Dooley.

v1: https://lore.kernel.org/r/20261013095756.1084568-1-thnkslprpt@gmail.com/

 drivers/cache/sifive_ccache.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/cache/sifive_ccache.c b/drivers/cache/sifive_ccache.c
index 2acb8bdf06d52..f2428f7ea373e 100644
--- a/drivers/cache/sifive_ccache.c
+++ b/drivers/cache/sifive_ccache.c
@@ -262,8 +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)
-		return dev_err_probe(dev, -ENODEV, "No interrupts property\n");
+	if (intr_num <= 0)
+		return dev_err_probe(dev, intr_num ?: -ENODEV,
+					"No interrupts property\n");
 
 	for (int i = 0; i < intr_num; i++) {
 		if (i == DATA_UNCORR && (quirks & QUIRK_BROKEN_DATA_UNCORR))

base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
-- 
2.43.0


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

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

On Thu, 15 Oct 2026 11:45:02 +0300
Avi Weiss <thnkslprpt@gmail.com> 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>
> ---
> Changes in v2:
> - Combine the negative and zero IRQ count checks as suggested by Conor Dooley.
> 
> v1: https://lore.kernel.org/r/20261013095756.1084568-1-thnkslprpt@gmail.com/
> 
>  drivers/cache/sifive_ccache.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cache/sifive_ccache.c b/drivers/cache/sifive_ccache.c
> index 2acb8bdf06d52..f2428f7ea373e 100644
> --- a/drivers/cache/sifive_ccache.c
> +++ b/drivers/cache/sifive_ccache.c
> @@ -262,8 +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)
> -		return dev_err_probe(dev, -ENODEV, "No interrupts property\n");
> +	if (intr_num <= 0)
> +		return dev_err_probe(dev, intr_num ?: -ENODEV,
> +					"No interrupts property\n");

Align as (assuming local style isn't very strongly matching what you have)

		return dev_err_probe(dev, intr_num ?: -ENODEV,
				     "No interrupts property\n");

>  
>  	for (int i = 0; i < intr_num; i++) {
>  		if (i == DATA_UNCORR && (quirks & QUIRK_BROKEN_DATA_UNCORR))
> 
> base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053


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

end of thread, other threads:[~2026-10-16 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15  8:45 [PATCH v2] cache: sifive_ccache: propagate IRQ count errors Avi Weiss
2026-10-16 17:27 ` Jonathan Cameron

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®