diff mbox

Change request_irq() to use struct net_device *dev->name

Message ID 1374646199-9398-1-git-send-email-pshah.mumbai@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Prashant Shah July 24, 2013, 6:09 a.m. UTC
Signed-off-by: Prashant Shah <pshah.mumbai@gmail.com>
---
 drivers/net/ethernet/8390/wd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ryan Mallon July 25, 2013, 12:42 a.m. UTC | #1
On 24/07/13 16:09, Prashant Shah wrote:
> Signed-off-by: Prashant Shah <pshah.mumbai@gmail.com>
> ---
>  drivers/net/ethernet/8390/wd.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/8390/wd.c b/drivers/net/ethernet/8390/wd.c
> index 03eb3ee..b43a63f 100644
> --- a/drivers/net/ethernet/8390/wd.c
> +++ b/drivers/net/ethernet/8390/wd.c
> @@ -308,7 +308,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
>  
>  	/* Snarf the interrupt now.  There's no point in waiting since we cannot
>  	   share and the board will usually be enabled. */
> -	i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev);
> +	i = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev);

You should also remove the definition of DRV_NAME, since it is no longer
used. The changelog should probably mention that this will change the
interrupt name (which appears in /proc/interrupts for example) from "wd"
to "eth%d".

~Ryan

--
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
Prashant Shah July 25, 2013, 5:19 a.m. UTC | #2
Hi,

> You should also remove the definition of DRV_NAME, since it is no longer
> used. The changelog should probably mention that this will change the
> interrupt name (which appears in /proc/interrupts for example) from "wd"
> to "eth%d".
>

I will resend the patch.

Regards.
--
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
Prashant Shah July 25, 2013, 5:38 a.m. UTC | #3
Hi,

On Thu, Jul 25, 2013 at 10:49 AM, Prashant Shah <pshah.mumbai@gmail.com> wrote:
> Hi,
>
>> You should also remove the definition of DRV_NAME, since it is no longer
>> used. The changelog should probably mention that this will change the
>> interrupt name (which appears in /proc/interrupts for example) from "wd"
>> to "eth%d".
>>

I was going through the code. The apne driver apne.c in the same
folder is using DRV_NAME in request_region()

> if (!request_region(IOBASE, 0x20, DRV_NAME)) {

I can change the wd.c request_region() code to use DRV_NAME. Currently
it is using a string constant.

> r = request_region(base_addr, WD_IO_EXTENT, "wd-probe");

This will make it more consistent. Please suggest which change is more
preferable.

@Matthew, following drivers are not using dev->name in request_irq()
axnet_cs.c
mac8390.c
hydra.c
ne-h8300.c
apne.c
stnic.c
zorro8390.c

Regards.
--
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
Andy Shevchenko July 25, 2013, 12:16 p.m. UTC | #4
On Thu, Jul 25, 2013 at 8:38 AM, Prashant Shah <pshah.mumbai@gmail.com> wrote:
> On Thu, Jul 25, 2013 at 10:49 AM, Prashant Shah <pshah.mumbai@gmail.com> wrote:
>>> You should also remove the definition of DRV_NAME, since it is no longer
>>> used. The changelog should probably mention that this will change the
>>> interrupt name (which appears in /proc/interrupts for example) from "wd"
>>> to "eth%d".
>
> I was going through the code. The apne driver apne.c in the same
> folder is using DRV_NAME in request_region()
>
>> if (!request_region(IOBASE, 0x20, DRV_NAME)) {
>
> I can change the wd.c request_region() code to use DRV_NAME. Currently
> it is using a string constant.
>
>> r = request_region(base_addr, WD_IO_EXTENT, "wd-probe");
>
> This will make it more consistent. Please suggest which change is more
> preferable.

If you convert each driver to use devres API, you may avoid a lot of
useless work.
Andy Shevchenko July 25, 2013, 6:31 p.m. UTC | #5
On Thu, Jul 25, 2013 at 6:20 PM, tedheadster <tedheadster@gmail.com> wrote:
> Andy,
>   I can't find a single example of a devres_* call in
> drivers/net/ethernet/*. Does any networking code exist that we can look at
> as an example for conversion to the devres API?

devres API usually means managed version of the functions that used
mostly at probe() stage.
For example, devm_*() or pcim_*() calls.
Sergei Shtylyov July 25, 2013, 6:33 p.m. UTC | #6
Hello.

On 07/25/2013 10:31 PM, Andy Shevchenko wrote:

>> Andy,
>>    I can't find a single example of a devres_* call in
>> drivers/net/ethernet/*. Does any networking code exist that we can look at
>> as an example for conversion to the devres API?

> devres API usually means managed version of the functions that used
> mostly at probe() stage.
> For example, devm_*() or pcim_*() calls.

    It's also called managed device API. In fact, I've never heard it named 
devres API.

WBR, Sergei

--
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
Aaro Koskinen July 25, 2013, 6:38 p.m. UTC | #7
Hi,

On Thu, Jul 25, 2013 at 10:33:24PM +0400, Sergei Shtylyov wrote:
>    It's also called managed device API. In fact, I've never heard it
> named devres API.

Never read the documentation. :-)

$ head -1 Documentation/driver-model/devres.txt 
Devres - Managed Device Resource

A.
--
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
Prashant Shah July 27, 2013, 8:58 a.m. UTC | #8
Hi,

On Fri, Jul 26, 2013 at 12:08 AM, Aaro Koskinen <aaro.koskinen@iki.fi> wrote:
> Hi,
>
> On Thu, Jul 25, 2013 at 10:33:24PM +0400, Sergei Shtylyov wrote:
>>    It's also called managed device API. In fact, I've never heard it
>> named devres API.

If I understood it correctly it has to just calls
devm_request_region() with the struct device pointer and there are no
deallocation functions to call ? It manages deallocation on it own.

Regards.
--
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
Sergei Shtylyov July 27, 2013, 3:13 p.m. UTC | #9
On 27-07-2013 12:58, Prashant Shah wrote:

>>>     It's also called managed device API. In fact, I've never heard it
>>> named devres API.

> If I understood it correctly it has to just calls
> devm_request_region() with the struct device pointer and there are no
> deallocation functions to call ? It manages deallocation on it own.

    Yes.

> Regards.

WBR, Sergei

--
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
diff mbox

Patch

diff --git a/drivers/net/ethernet/8390/wd.c b/drivers/net/ethernet/8390/wd.c
index 03eb3ee..b43a63f 100644
--- a/drivers/net/ethernet/8390/wd.c
+++ b/drivers/net/ethernet/8390/wd.c
@@ -308,7 +308,7 @@  static int __init wd_probe1(struct net_device *dev, int ioaddr)
 
 	/* Snarf the interrupt now.  There's no point in waiting since we cannot
 	   share and the board will usually be enabled. */
-	i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev);
+	i = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev);
 	if (i) {
 		printk (" unable to get IRQ %d.\n", dev->irq);
 		return i;