Message ID | 1387345093-14168-4-git-send-email-f.fainelli@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, 2013-12-17 at 21:38 -0800, Florian Fainelli wrote: > diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c [] > @@ -851,8 +851,8 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts) > > seqid = (u16 *)(data + offset + OFF_PTP_SEQUENCE_ID); > > - return (rxts->msgtype == (*msgtype & 0xf) && > - rxts->seqid == ntohs(*seqid)); > + return rxts->msgtype == (*msgtype & 0xf) && > + rxts->seqid == ntohs(*seqid); I think this isn't an improvement. Maybe: return rxts->msgtype == (*msgtype & 0xf) && rxts->seqid == ntohs(*seqid); or return (rxts->msgtype == (*msgtype & 0xf)) && (rxts->seqid == ntohs(*seqid)); -- 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
> From: Joe Perches > Sent: 19 December 2013 22:31 > On Tue, 2013-12-17 at 21:38 -0800, Florian Fainelli wrote: > > diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c > [] > > @@ -851,8 +851,8 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts) > > > > seqid = (u16 *)(data + offset + OFF_PTP_SEQUENCE_ID); > > > > - return (rxts->msgtype == (*msgtype & 0xf) && > > - rxts->seqid == ntohs(*seqid)); > > + return rxts->msgtype == (*msgtype & 0xf) && > > + rxts->seqid == ntohs(*seqid); > > I think this isn't an improvement. > > Maybe: > return rxts->msgtype == (*msgtype & 0xf) && > rxts->seqid == ntohs(*seqid); > or > return (rxts->msgtype == (*msgtype & 0xf)) && > (rxts->seqid == ntohs(*seqid)); Or even (modulo stupid errors): return !((rxts->msgtype ^ (*msgtype & 0xf)) | (rxts->seqid ^ ntohs(*seqid))); which saves a branch if the conditional is usually true. David -- 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 --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 7490b6c..547725f 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -851,8 +851,8 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts) seqid = (u16 *)(data + offset + OFF_PTP_SEQUENCE_ID); - return (rxts->msgtype == (*msgtype & 0xf) && - rxts->seqid == ntohs(*seqid)); + return rxts->msgtype == (*msgtype & 0xf) && + rxts->seqid == ntohs(*seqid); } static void dp83640_free_clocks(void)
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/phy/dp83640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)