RE: [PATCH net-next] r8152: simply the arguments
From: David Laight
Date: Thu Mar 16 2017 - 10:28:24 EST
From: Hayes Wang
> Sent: 16 March 2017 06:28
> Replace &tp->napi with napi and tp->netdev with netdev.
>
> Signed-off-by: Hayes Wang <hayeswang@xxxxxxxxxxx>
> ---
> drivers/net/usb/r8152.c | 44 +++++++++++++++++++++++++++-----------------
> 1 file changed, 27 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 227e1fd..e480e9f 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -1761,6 +1761,7 @@ static int rx_bottom(struct r8152 *tp, int budget)
> unsigned long flags;
> struct list_head *cursor, *next, rx_queue;
> int ret = 0, work_done = 0;
> + struct napi_struct *napi = &tp->napi;
>
> if (!skb_queue_empty(&tp->rx_queue)) {
> while (work_done < budget) {
> @@ -1773,7 +1774,7 @@ static int rx_bottom(struct r8152 *tp, int budget)
> break;
>
> pkt_len = skb->len;
> - napi_gro_receive(&tp->napi, skb);
> + napi_gro_receive(napi, skb);
...
I'm not sure this makes the code any more readable.
It isn't even needed to shorten any long lines.
If you are really lucky the compiler will optimise it away.
Otherwise it will generate another local variable and possibly
a register spill to stack.
David