[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB42986@AcuExch.aculab.com>
Date: Fri, 29 May 2015 10:48:43 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Shradha Shah' <sshah@...arflare.com>,
David Miller <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-net-drivers@...arflare.com" <linux-net-drivers@...arflare.com>
Subject: RE: [PATCH net-next 02/14] sfc: Add sysfs entry for flags (link
control and primary)
From: Shradha Shah
> Sent: 29 May 2015 11:01
> On every adapter there will be one primary PF per adaptor and
> one link control PF per port.
...
> + return sprintf(buf, "%d\n",
> + ((efx->mcdi->fn_flags) &
> + (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL))
> + ? 1 : 0);
Horrid expression.
Why not:
(efx->mcdi->fn_flags >> MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL) & 1
using sprintf() is also excessive. Maybe:
*buf = '0' + (expression);
return 1;
You may also need to check for buffer overrun.
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists