OSDN Git Service

staging: ks7010: remove magic numbers
authorTobin C. Harding <me@tobin.cc>
Thu, 27 Apr 2017 01:25:15 +0000 (11:25 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Apr 2017 09:45:49 +0000 (11:45 +0200)
commit08484ef41927a52fbd0d46c5cd19a65535d768ea
tree08910900a042f8ebff2b96a7dc9525cf13e01611
parent8cd1dbe1db97ad74c5265e09c3490eeb7986f623
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>
drivers/staging/ks7010/eap_packet.h
drivers/staging/ks7010/ks_hostif.c