Patchwork phy_device: Interrupt number 0 is valid

login
register
mail settings
Submitter Paulius Zaleckas
Date Oct. 8, 2008, 12:16 p.m.
Message ID <48ECA4A0.7080508@teltonika.lt>
Download mbox | patch
Permalink /patch/3311/
State Rejected
Delegated to: Jeff Garzik
Headers show

Comments

Paulius Zaleckas - Oct. 8, 2008, 12:16 p.m.
If interrupt number 0(valid interrupt number) will be passed as
phy interrupt it should be used. In current situation even phy
polling will not work since PHY_POLL = -1

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>


--
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
David Miller - Oct. 8, 2008, 4:43 p.m.
From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Date: Wed, 08 Oct 2008 15:16:32 +0300

> If interrupt number 0(valid interrupt number) will be passed as
> phy interrupt it should be used. In current situation even phy
> polling will not work since PHY_POLL = -1
> 
> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>

In the Linux kernel, interrupt number 0 is defined as not valid.
--
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
Paulius Zaleckas - Oct. 9, 2008, 7:05 a.m.
David Miller wrote:
> From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
> Date: Wed, 08 Oct 2008 15:16:32 +0300
> 
>> If interrupt number 0(valid interrupt number) will be passed as
>> phy interrupt it should be used. In current situation even phy
>> polling will not work since PHY_POLL = -1
>>
>> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
> 
> In the Linux kernel, interrupt number 0 is defined as not valid.

Where it is defined as not valid?
Maybe it is not valid under x86, but it is valid at least on
ARM for sure.
Anyway if interrupt 0 is not valid then request_irq() will fail
and PHY_POLL will be used.
--
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
David Miller - Oct. 9, 2008, 4:38 p.m.
From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Date: Thu, 09 Oct 2008 10:05:03 +0300

> David Miller wrote:
> > From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
> > Date: Wed, 08 Oct 2008 15:16:32 +0300
> > 
> >> If interrupt number 0(valid interrupt number) will be passed as
> >> phy interrupt it should be used. In current situation even phy
> >> polling will not work since PHY_POLL = -1
> >>
> >> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
> > 
> > In the Linux kernel, interrupt number 0 is defined as not valid.
> 
> Where it is defined as not valid?
> Maybe it is not valid under x86, but it is valid at least on
> ARM for sure.

There are many tests in the kernel that explicitly assume
that IRQ zero is not valid.

And architectures should make amends to adhere to this
convention, even if physically IRQ 0 is meaningful for them.
--
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

Patch

Index: linux-2.6/drivers/net/phy/phy_device.c
===================================================================
--- linux-2.6.orig/drivers/net/phy/phy_device.c
+++ linux-2.6/drivers/net/phy/phy_device.c
@@ -285,7 +285,7 @@  struct phy_device * phy_connect(struct n
 
 	phy_start_machine(phydev, NULL);
 
-	if (phydev->irq > 0)
+	if (phydev->irq >= 0)
 		phy_start_interrupts(phydev);
 
 	return phydev;
@@ -298,7 +298,7 @@  EXPORT_SYMBOL(phy_connect);
  */
 void phy_disconnect(struct phy_device *phydev)
 {
-	if (phydev->irq > 0)
+	if (phydev->irq >= 0)
 		phy_stop_interrupts(phydev);
 
 	phy_stop_machine(phydev);