diff mbox

can: sja1000: fix compilation on x86

Message ID 1355520824-23175-2-git-send-email-mkl@pengutronix.de
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Marc Kleine-Budde Dec. 14, 2012, 9:33 p.m. UTC
Since commit:
04df251 can: sja1000: Make sja1000_of_platform selectable and compilable on SPARC
the driver can be activated on non powerpc platform like x86 or sparc. Without
this patch the driver fails to compile on platform that don't define NO_IRQ,
like x86.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/sja1000/sja1000_of_platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Dec. 14, 2012, 9:37 p.m. UTC | #1
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 14 Dec 2012 22:33:44 +0100

> @@ -121,7 +121,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
>  	}
>  
>  	irq = irq_of_parse_and_map(np, 0);
> -	if (irq == NO_IRQ) {
> +	if (irq <= 0) {
>  		dev_err(&ofdev->dev, "no irq found\n");
>  		err = -ENODEV;
>  		goto exit_unmap_mem;

I don't see anything existing which says this is the proper
transformation.

There is no consistency at all for the tests of the return
value of irq_of_parse_and_map().

And if anything testing against zero is the correct thing to
do, universally.

I'm not applying this or pulling from your tree, sorry.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marc Kleine-Budde Dec. 14, 2012, 10:17 p.m. UTC | #2
On 12/14/2012 10:37 PM, David Miller wrote:
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Date: Fri, 14 Dec 2012 22:33:44 +0100
> 
>> @@ -121,7 +121,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
>>  	}
>>  
>>  	irq = irq_of_parse_and_map(np, 0);
>> -	if (irq == NO_IRQ) {
>> +	if (irq <= 0) {
>>  		dev_err(&ofdev->dev, "no irq found\n");
>>  		err = -ENODEV;
>>  		goto exit_unmap_mem;
> 
> I don't see anything existing which says this is the proper
> transformation.
> 
> There is no consistency at all for the tests of the return
> value of irq_of_parse_and_map().

Right. And the current status of NO_IRQ doesn't help much.

> And if anything testing against zero is the correct thing to
> do, universally.

I've looked at the implementation of irq_of_parse_and_map() (both the
generic and sparc one), they both return 0 on failure. Because there are
some arch that define NO_IRQ being not 0, sparc (0xffffffff) and arm
(-1), I though testing against <= 0 would be a good idea.

> I'm not applying this or pulling from your tree, sorry.

Marc
diff mbox

Patch

diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 0f59170..38d37c8 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -121,7 +121,7 @@  static int sja1000_ofp_probe(struct platform_device *ofdev)
 	}
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq == NO_IRQ) {
+	if (irq <= 0) {
 		dev_err(&ofdev->dev, "no irq found\n");
 		err = -ENODEV;
 		goto exit_unmap_mem;