From: Joe Perches <joe@perches.com>
To: David Miller <davem@davemloft.net>
Cc: johannes@sipsolutions.net, eric.dumazet@gmail.com,
netdev@vger.kernel.org
Subject: [PATCH] etherdev.h: Convert int is_<foo>_ether_addr to bool
Date: Tue, 08 May 2012 09:44:40 -0700 [thread overview]
Message-ID: <1336495480.29640.19.camel@joe2Laptop> (raw)
In-Reply-To: <20120508.033120.1272130362698029549.davem@davemloft.net>
Make the return value explicitly true or false.
Signed-off-by: Joe Perches <joe@perches.com>
---
I grepped through the uses, there are a couple of
tests that store to an int that are unaffected.
There are also a couple of senseless tests of
is_broadcast_ether_addr() || is_multicast_ether_addr()
in staging that could be improved.
include/linux/etherdevice.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 8a18358..46a95ef 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -59,7 +59,7 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
*
* Return true if the address is all zeroes.
*/
-static inline int is_zero_ether_addr(const u8 *addr)
+static inline bool is_zero_ether_addr(const u8 *addr)
{
return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
}
@@ -71,7 +71,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
* Return true if the address is a multicast address.
* By definition the broadcast address is also a multicast address.
*/
-static inline int is_multicast_ether_addr(const u8 *addr)
+static inline bool is_multicast_ether_addr(const u8 *addr)
{
return 0x01 & addr[0];
}
@@ -82,7 +82,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
*
* Return true if the address is a local address.
*/
-static inline int is_local_ether_addr(const u8 *addr)
+static inline bool is_local_ether_addr(const u8 *addr)
{
return 0x02 & addr[0];
}
@@ -93,7 +93,7 @@ static inline int is_local_ether_addr(const u8 *addr)
*
* Return true if the address is the broadcast address.
*/
-static inline int is_broadcast_ether_addr(const u8 *addr)
+static inline bool is_broadcast_ether_addr(const u8 *addr)
{
return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
}
@@ -104,7 +104,7 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
*
* Return true if the address is a unicast address.
*/
-static inline int is_unicast_ether_addr(const u8 *addr)
+static inline bool is_unicast_ether_addr(const u8 *addr)
{
return !is_multicast_ether_addr(addr);
}
@@ -118,7 +118,7 @@ static inline int is_unicast_ether_addr(const u8 *addr)
*
* Return true if the address is valid.
*/
-static inline int is_valid_ether_addr(const u8 *addr)
+static inline bool is_valid_ether_addr(const u8 *addr)
{
/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
* explicitly check for it here. */
next prev parent reply other threads:[~2012-05-08 16:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-07 13:39 [PATCH] net: compare_ether_addr[_64bits]() has no ordering Johannes Berg
2012-05-07 13:53 ` Eric Dumazet
2012-05-07 14:12 ` Johannes Berg
2012-05-07 23:20 ` David Miller
2012-05-08 5:25 ` Johannes Berg
2012-05-08 6:26 ` David Miller
2012-05-08 6:35 ` Joe Perches
2012-05-08 7:31 ` David Miller
2012-05-08 16:44 ` Joe Perches
2012-05-08 16:44 ` Joe Perches [this message]
2012-05-08 17:07 ` [PATCH] etherdev.h: Convert int is_<foo>_ether_addr to bool David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336495480.29640.19.camel@joe2Laptop \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox