2014-06-20 20:42:13

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 2/2] drivers/net/usb/asix_devices.c: inline ax88772_unbind

inline this one line function used in driver_info structure

Cc: "David S. Miller" <[email protected]>
Cc: Emil Goode <[email protected]>
Cc: [email protected]
Signed-off-by: Fabian Frederick <[email protected]>
---
drivers/net/usb/asix_devices.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 8a7582b..a41926a 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -497,7 +497,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
return 0;
}

-static void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
+static inline void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
{
kfree(dev->driver_priv);
}
--
1.8.4.5


2014-06-21 00:08:57

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 2/2] drivers/net/usb/asix_devices.c: inline ax88772_unbind

Hello.

On 06/21/2014 12:40 AM, Fabian Frederick wrote:

> inline this one line function used in driver_info structure

> Cc: "David S. Miller" <[email protected]>
> Cc: Emil Goode <[email protected]>
> Cc: [email protected]
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
> drivers/net/usb/asix_devices.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 8a7582b..a41926a 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -497,7 +497,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
> return 0;
> }
>
> -static void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
> +static inline void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
> {
> kfree(dev->driver_priv);
> }

gcc is perfectly capable of figuring that out. No need to use *inline*
outside the *.h files.

WBR, Sergei

2014-06-23 08:05:20

by Oliver Neukum

[permalink] [raw]
Subject: Re: [PATCH 2/2] drivers/net/usb/asix_devices.c: inline ax88772_unbind

On Fri, 2014-06-20 at 22:40 +0200, Fabian Frederick wrote:
> inline this one line function used in driver_info structure

That precisely is this the reason not to inline this.
It is used as a function pointer. gcc must generate
a non-inlined version of the function.

Your patch has zero effect and suggests something that is
actually wrong.

Regards
Oliver