summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ks7010/eap_packet.h
diff options
context:
space:
mode:
authorTobin C. Harding <me@tobin.cc>2017-04-27 11:25:15 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-28 11:45:49 +0200
commit08484ef41927a52fbd0d46c5cd19a65535d768ea (patch)
tree08910900a042f8ebff2b96a7dc9525cf13e01611 /drivers/staging/ks7010/eap_packet.h
parent8cd1dbe1db97ad74c5265e09c3490eeb7986f623 (diff)
staging: ks7010: remove magic numbers
Driver includes magic numbers. Defining constants or using existing constants aids the readability of the code. Magic number '12' is used for two ethernet addresses (6 bytes each). ETH_ALEN is already defined within the kernel to 6. We can us the expression '2 * ETH_ALEN' to make this code explicit. Magic number '20' refers to the data size, in bytes, of a struct ether_hdr (described in eap_packet.h). We can define a constant for this purpose, making the code explicit and easier to read. Define constant. Remove magic numbers, using newly defined constant and/or expression using existing kernel constant. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010/eap_packet.h')
-rw-r--r--drivers/staging/ks7010/eap_packet.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/ks7010/eap_packet.h b/drivers/staging/ks7010/eap_packet.h
index 7a3decf66f88..b2d25ef1cd6b 100644
--- a/drivers/staging/ks7010/eap_packet.h
+++ b/drivers/staging/ks7010/eap_packet.h
@@ -9,6 +9,8 @@
#define ETH_ALEN 6
#endif
+#define ETHER_HDR_SIZE 20
+
struct ether_hdr {
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */