* [PATCH] macb: convert platform data phy_irq_pin to an int @ 2011-11-24 9:48 Jamie Iles 2011-11-24 10:47 ` Nicolas Ferre 2011-11-24 21:21 ` [PATCH] at91_ether: use gpio_is_valid for phy IRQ line Nicolas Ferre 0 siblings, 2 replies; 9+ messages in thread From: Jamie Iles @ 2011-11-24 9:48 UTC (permalink / raw) To: netdev; +Cc: Jamie Iles, Jean-Christophe PLAGNIOL-VILLARD, Nicolas Ferre AT91 platforms have been updated to set the phy_irq_pin to -EINVAL if not present, but phy_irq_pin is currently a u8. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Jamie Iles <jamie@jamieiles.com> --- include/linux/platform_data/macb.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h index e7c748f..b081c72 100644 --- a/include/linux/platform_data/macb.h +++ b/include/linux/platform_data/macb.h @@ -10,7 +10,7 @@ struct macb_platform_data { u32 phy_mask; - u8 phy_irq_pin; /* PHY IRQ */ + int phy_irq_pin; /* PHY IRQ */ u8 is_rmii; /* using RMII interface? */ }; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] macb: convert platform data phy_irq_pin to an int 2011-11-24 9:48 [PATCH] macb: convert platform data phy_irq_pin to an int Jamie Iles @ 2011-11-24 10:47 ` Nicolas Ferre 2011-11-24 21:21 ` [PATCH] at91_ether: use gpio_is_valid for phy IRQ line Nicolas Ferre 1 sibling, 0 replies; 9+ messages in thread From: Nicolas Ferre @ 2011-11-24 10:47 UTC (permalink / raw) To: Jamie Iles; +Cc: netdev, Jean-Christophe PLAGNIOL-VILLARD On 11/24/2011 10:48 AM, Jamie Iles : > AT91 platforms have been updated to set the phy_irq_pin to -EINVAL if > not present, but phy_irq_pin is currently a u8. > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> > Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > Signed-off-by: Jamie Iles <jamie@jamieiles.com> > --- > include/linux/platform_data/macb.h | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h > index e7c748f..b081c72 100644 > --- a/include/linux/platform_data/macb.h > +++ b/include/linux/platform_data/macb.h > @@ -10,7 +10,7 @@ > > struct macb_platform_data { > u32 phy_mask; > - u8 phy_irq_pin; /* PHY IRQ */ > + int phy_irq_pin; /* PHY IRQ */ > u8 is_rmii; /* using RMII interface? */ > }; > -- Nicolas Ferre ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-24 9:48 [PATCH] macb: convert platform data phy_irq_pin to an int Jamie Iles 2011-11-24 10:47 ` Nicolas Ferre @ 2011-11-24 21:21 ` Nicolas Ferre 2011-11-24 22:28 ` Jamie Iles 2011-11-29 23:53 ` David Miller 1 sibling, 2 replies; 9+ messages in thread From: Nicolas Ferre @ 2011-11-24 21:21 UTC (permalink / raw) To: jamie, netdev Cc: plagnioj, sfr, linux-next, linux-kernel, linux-arm-kernel, Nicolas Ferre Use the generic gpiolib gpio_is_valid() function to test if the phy IRQ line GPIO is actually provided. For non-connected or non-existing phy IRQ lines, -EINVAL value is used for phy_irq_pin field of struct at91_eth_data. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- drivers/net/ethernet/cadence/at91_ether.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 56624d3..a1c4143 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c @@ -255,8 +255,7 @@ static void enable_phyirq(struct net_device *dev) unsigned int dsintr, irq_number; int status; - irq_number = lp->board_data.phy_irq_pin; - if (!irq_number) { + if (!gpio_is_valid(lp->board_data.phy_irq_pin)) { /* * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), * or board does not have it connected. @@ -265,6 +264,7 @@ static void enable_phyirq(struct net_device *dev) return; } + irq_number = lp->board_data.phy_irq_pin; status = request_irq(irq_number, at91ether_phy_interrupt, 0, dev->name, dev); if (status) { printk(KERN_ERR "at91_ether: PHY IRQ %d request failed - status %d!\n", irq_number, status); @@ -319,8 +319,7 @@ static void disable_phyirq(struct net_device *dev) unsigned int dsintr; unsigned int irq_number; - irq_number = lp->board_data.phy_irq_pin; - if (!irq_number) { + if (!gpio_is_valid(lp->board_data.phy_irq_pin)) { del_timer_sync(&lp->check_timer); return; } @@ -365,6 +364,7 @@ static void disable_phyirq(struct net_device *dev) disable_mdi(); spin_unlock_irq(&lp->lock); + irq_number = lp->board_data.phy_irq_pin; free_irq(irq_number, dev); /* Free interrupt handler */ } @@ -1077,7 +1077,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add netif_carrier_off(dev); /* will be enabled in open() */ /* If board has no PHY IRQ, use a timer to poll the PHY */ - if (!lp->board_data.phy_irq_pin) { + if (!gpio_is_valid(lp->board_data.phy_irq_pin)) { init_timer(&lp->check_timer); lp->check_timer.data = (unsigned long)dev; lp->check_timer.function = at91ether_check_link; @@ -1169,7 +1169,8 @@ static int __devexit at91ether_remove(struct platform_device *pdev) struct net_device *dev = platform_get_drvdata(pdev); struct at91_private *lp = netdev_priv(dev); - if (lp->board_data.phy_irq_pin >= 32) + if (gpio_is_valid(lp->board_data.phy_irq_pin) && + lp->board_data.phy_irq_pin >= 32) gpio_free(lp->board_data.phy_irq_pin); unregister_netdev(dev); @@ -1188,11 +1189,12 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg) { struct net_device *net_dev = platform_get_drvdata(pdev); struct at91_private *lp = netdev_priv(net_dev); - int phy_irq = lp->board_data.phy_irq_pin; if (netif_running(net_dev)) { - if (phy_irq) + if (gpio_is_valid(lp->board_data.phy_irq_pin)) { + int phy_irq = lp->board_data.phy_irq_pin; disable_irq(phy_irq); + } netif_stop_queue(net_dev); netif_device_detach(net_dev); @@ -1206,7 +1208,6 @@ static int at91ether_resume(struct platform_device *pdev) { struct net_device *net_dev = platform_get_drvdata(pdev); struct at91_private *lp = netdev_priv(net_dev); - int phy_irq = lp->board_data.phy_irq_pin; if (netif_running(net_dev)) { clk_enable(lp->ether_clk); @@ -1214,8 +1215,10 @@ static int at91ether_resume(struct platform_device *pdev) netif_device_attach(net_dev); netif_start_queue(net_dev); - if (phy_irq) + if (gpio_is_valid(lp->board_data.phy_irq_pin)) { + int phy_irq = lp->board_data.phy_irq_pin; enable_irq(phy_irq); + } } return 0; } -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-24 21:21 ` [PATCH] at91_ether: use gpio_is_valid for phy IRQ line Nicolas Ferre @ 2011-11-24 22:28 ` Jamie Iles 2011-11-25 13:47 ` Jean-Christophe PLAGNIOL-VILLARD 2011-11-29 23:53 ` David Miller 1 sibling, 1 reply; 9+ messages in thread From: Jamie Iles @ 2011-11-24 22:28 UTC (permalink / raw) To: Nicolas Ferre Cc: jamie, netdev, plagnioj, sfr, linux-next, linux-kernel, linux-arm-kernel Hi Nicolas, On Thu, Nov 24, 2011 at 10:21:14PM +0100, Nicolas Ferre wrote: > Use the generic gpiolib gpio_is_valid() function to test > if the phy IRQ line GPIO is actually provided. > > For non-connected or non-existing phy IRQ lines, -EINVAL > value is used for phy_irq_pin field of struct at91_eth_data. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > drivers/net/ethernet/cadence/at91_ether.c | 23 +++++++++++++---------- > 1 files changed, 13 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c > index 56624d3..a1c4143 100644 > --- a/drivers/net/ethernet/cadence/at91_ether.c > +++ b/drivers/net/ethernet/cadence/at91_ether.c > @@ -255,8 +255,7 @@ static void enable_phyirq(struct net_device *dev) > unsigned int dsintr, irq_number; > int status; > > - irq_number = lp->board_data.phy_irq_pin; > - if (!irq_number) { > + if (!gpio_is_valid(lp->board_data.phy_irq_pin)) { > /* > * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), > * or board does not have it connected. > @@ -265,6 +264,7 @@ static void enable_phyirq(struct net_device *dev) > return; > } > > + irq_number = lp->board_data.phy_irq_pin; Does this need to be: irq_number = gpio_to_irq(lp->board_data.phy_irq_pin); and the same for the other occurrences? Otherwise this looks like the right thing to me. Jamie ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-24 22:28 ` Jamie Iles @ 2011-11-25 13:47 ` Jean-Christophe PLAGNIOL-VILLARD 2011-11-25 13:56 ` Nicolas Ferre 0 siblings, 1 reply; 9+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-25 13:47 UTC (permalink / raw) To: Jamie Iles Cc: Nicolas Ferre, netdev, sfr, linux-next, linux-kernel, linux-arm-kernel On 22:28 Thu 24 Nov , Jamie Iles wrote: > Hi Nicolas, > > On Thu, Nov 24, 2011 at 10:21:14PM +0100, Nicolas Ferre wrote: > > Use the generic gpiolib gpio_is_valid() function to test > > if the phy IRQ line GPIO is actually provided. > > > > For non-connected or non-existing phy IRQ lines, -EINVAL > > value is used for phy_irq_pin field of struct at91_eth_data. > > > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > > --- > > drivers/net/ethernet/cadence/at91_ether.c | 23 +++++++++++++---------- > > 1 files changed, 13 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c > > index 56624d3..a1c4143 100644 > > --- a/drivers/net/ethernet/cadence/at91_ether.c > > +++ b/drivers/net/ethernet/cadence/at91_ether.c > > @@ -255,8 +255,7 @@ static void enable_phyirq(struct net_device *dev) > > unsigned int dsintr, irq_number; > > int status; > > > > - irq_number = lp->board_data.phy_irq_pin; > > - if (!irq_number) { > > + if (!gpio_is_valid(lp->board_data.phy_irq_pin)) { > > /* > > * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), > > * or board does not have it connected. > > @@ -265,6 +264,7 @@ static void enable_phyirq(struct net_device *dev) > > return; > > } > > > > + irq_number = lp->board_data.phy_irq_pin; > > Does this need to be: > > irq_number = gpio_to_irq(lp->board_data.phy_irq_pin); > > and the same for the other occurrences? Otherwise this looks like the > right thing to me. yes Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Best Regards, J. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-25 13:47 ` Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-25 13:56 ` Nicolas Ferre 0 siblings, 0 replies; 9+ messages in thread From: Nicolas Ferre @ 2011-11-25 13:56 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD, Jamie Iles Cc: netdev, sfr, linux-next, linux-kernel, linux-arm-kernel On 11/25/2011 02:47 PM, Jean-Christophe PLAGNIOL-VILLARD : > On 22:28 Thu 24 Nov , Jamie Iles wrote: >> Hi Nicolas, >> >> On Thu, Nov 24, 2011 at 10:21:14PM +0100, Nicolas Ferre wrote: >>> Use the generic gpiolib gpio_is_valid() function to test >>> if the phy IRQ line GPIO is actually provided. >>> >>> For non-connected or non-existing phy IRQ lines, -EINVAL >>> value is used for phy_irq_pin field of struct at91_eth_data. >>> >>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >>> --- >>> drivers/net/ethernet/cadence/at91_ether.c | 23 +++++++++++++---------- >>> 1 files changed, 13 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c >>> index 56624d3..a1c4143 100644 >>> --- a/drivers/net/ethernet/cadence/at91_ether.c >>> +++ b/drivers/net/ethernet/cadence/at91_ether.c >>> @@ -255,8 +255,7 @@ static void enable_phyirq(struct net_device *dev) >>> unsigned int dsintr, irq_number; >>> int status; >>> >>> - irq_number = lp->board_data.phy_irq_pin; >>> - if (!irq_number) { >>> + if (!gpio_is_valid(lp->board_data.phy_irq_pin)) { >>> /* >>> * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), >>> * or board does not have it connected. >>> @@ -265,6 +264,7 @@ static void enable_phyirq(struct net_device *dev) >>> return; >>> } >>> >>> + irq_number = lp->board_data.phy_irq_pin; >> >> Does this need to be: >> >> irq_number = gpio_to_irq(lp->board_data.phy_irq_pin); >> >> and the same for the other occurrences? Otherwise this looks like the >> right thing to me. > yes True but I prefered to separate changes. As it was not addressed like this in the code I clung to it. I will post an additional patch on top of this one to add the gpio_to_irq() call. > Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Best regards, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-24 21:21 ` [PATCH] at91_ether: use gpio_is_valid for phy IRQ line Nicolas Ferre 2011-11-24 22:28 ` Jamie Iles @ 2011-11-29 23:53 ` David Miller 2011-11-30 4:44 ` Jean-Christophe PLAGNIOL-VILLARD 1 sibling, 1 reply; 9+ messages in thread From: David Miller @ 2011-11-29 23:53 UTC (permalink / raw) To: nicolas.ferre Cc: jamie, netdev, plagnioj, sfr, linux-next, linux-kernel, linux-arm-kernel From: Nicolas Ferre <nicolas.ferre@atmel.com> Date: Thu, 24 Nov 2011 22:21:14 +0100 > Use the generic gpiolib gpio_is_valid() function to test > if the phy IRQ line GPIO is actually provided. > > For non-connected or non-existing phy IRQ lines, -EINVAL > value is used for phy_irq_pin field of struct at91_eth_data. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> I'm assuming this goes through the ARM tree, because in both of my networking trees there is no ARM at91 implementation of gpio_is_valid(). ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-29 23:53 ` David Miller @ 2011-11-30 4:44 ` Jean-Christophe PLAGNIOL-VILLARD 2011-11-30 5:40 ` David Miller 0 siblings, 1 reply; 9+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-30 4:44 UTC (permalink / raw) To: David Miller Cc: nicolas.ferre, jamie, netdev, sfr, linux-next, linux-kernel, linux-arm-kernel On 18:53 Tue 29 Nov , David Miller wrote: > From: Nicolas Ferre <nicolas.ferre@atmel.com> > Date: Thu, 24 Nov 2011 22:21:14 +0100 > > > Use the generic gpiolib gpio_is_valid() function to test > > if the phy IRQ line GPIO is actually provided. > > > > For non-connected or non-existing phy IRQ lines, -EINVAL > > value is used for phy_irq_pin field of struct at91_eth_data. > > > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > > I'm assuming this goes through the ARM tree, because in both of my networking > trees there is no ARM at91 implementation of gpio_is_valid(). yes the depending patch series is in the arm-soc can we have your ack or sob? Best Regards, J. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] at91_ether: use gpio_is_valid for phy IRQ line 2011-11-30 4:44 ` Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-30 5:40 ` David Miller 0 siblings, 0 replies; 9+ messages in thread From: David Miller @ 2011-11-30 5:40 UTC (permalink / raw) To: plagnioj Cc: nicolas.ferre, jamie, netdev, sfr, linux-next, linux-kernel, linux-arm-kernel From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Date: Wed, 30 Nov 2011 05:44:03 +0100 > On 18:53 Tue 29 Nov , David Miller wrote: >> From: Nicolas Ferre <nicolas.ferre@atmel.com> >> Date: Thu, 24 Nov 2011 22:21:14 +0100 >> >> > Use the generic gpiolib gpio_is_valid() function to test >> > if the phy IRQ line GPIO is actually provided. >> > >> > For non-connected or non-existing phy IRQ lines, -EINVAL >> > value is used for phy_irq_pin field of struct at91_eth_data. >> > >> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> >> I'm assuming this goes through the ARM tree, because in both of my networking >> trees there is no ARM at91 implementation of gpio_is_valid(). > yes the depending patch series is in the arm-soc > > can we have your ack or sob? Acked-by: David S. Miller <davem@davemloft.net> ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-11-30 5:40 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-11-24 9:48 [PATCH] macb: convert platform data phy_irq_pin to an int Jamie Iles 2011-11-24 10:47 ` Nicolas Ferre 2011-11-24 21:21 ` [PATCH] at91_ether: use gpio_is_valid for phy IRQ line Nicolas Ferre 2011-11-24 22:28 ` Jamie Iles 2011-11-25 13:47 ` Jean-Christophe PLAGNIOL-VILLARD 2011-11-25 13:56 ` Nicolas Ferre 2011-11-29 23:53 ` David Miller 2011-11-30 4:44 ` Jean-Christophe PLAGNIOL-VILLARD 2011-11-30 5:40 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).