2013-07-24 06:11:14

by Prashant Shah

[permalink] [raw]
Subject: [PATCH] Change request_irq() to use struct net_device *dev->name

Signed-off-by: Prashant Shah <[email protected]>
---
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);
if (i) {
printk (" unable to get IRQ %d.\n", dev->irq);
return i;
--
1.7.9.5


2013-07-25 00:42:58

by Ryan Mallon

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

On 24/07/13 16:09, Prashant Shah wrote:
> Signed-off-by: Prashant Shah <[email protected]>
> ---
> 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

2013-07-25 05:19:49

by Prashant Shah

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

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.

2013-07-25 05:39:03

by Prashant Shah

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

Hi,

On Thu, Jul 25, 2013 at 10:49 AM, Prashant Shah <[email protected]> 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.

2013-07-25 12:16:35

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

On Thu, Jul 25, 2013 at 8:38 AM, Prashant Shah <[email protected]> wrote:
> On Thu, Jul 25, 2013 at 10:49 AM, Prashant Shah <[email protected]> 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.

--
With Best Regards,
Andy Shevchenko

2013-07-25 18:31:24

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

On Thu, Jul 25, 2013 at 6:20 PM, tedheadster <[email protected]> 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.

--
With Best Regards,
Andy Shevchenko

2013-07-25 18:33:35

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

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

2013-07-25 18:40:37

by Aaro Koskinen

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

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.

2013-07-27 08:58:40

by Prashant Shah

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

Hi,

On Fri, Jul 26, 2013 at 12:08 AM, Aaro Koskinen <[email protected]> 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.

2013-07-27 15:13:37

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] Change request_irq() to use struct net_device *dev->name

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