linux/drivers/staging/vt6656
aybuke ozdemir 1aba012174 Staging: vt6656: replace memcpy() by ether_addr_copy() using coccinelle and pack variable
This patch focuses on fixing the following warning generated
by checkpatch.pl for the file rxtx.c

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

@@ expression e1, e2; @@

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

According to ether_addr_copy() description and functionality,
all Ethernet addresses should align to the u16 datatype.
The changes were applied using the following coccinelle rule:

Here is the output of pahole for the relevant datastructures:
struct vnt_usb_send_context {
        void *                     priv;                 /*     0     8*/
        struct sk_buff *           skb;                  /*     8     8*/
        struct urb *               urb;                  /*    16     8*/
        struct ieee80211_hdr *     hdr;                  /*    24     8*/
        unsigned int               buf_len;              /*    32     4*/
        u32                        frame_len;            /*    36     4*/
        u16                        tx_hdr_size;          /*    40     2*/
        u16                        tx_rate;              /*    42     2*/
        u8                         type;                 /*    44     1*/
        u8                         pkt_no;               /*    45     1*/
        u8                         pkt_type;             /*    46     1*/
        u8                         need_ack;             /*    47     1*/
        u8                         fb_option;            /*    48     1*/
        bool                       in_use;               /*    49     1*/
        unsigned char              data[2900];           /*    50  2900*/
        /* --- cacheline 46 boundary (2944 bytes) was 6 bytes ago --- */

        /* size: 2952, cachelines: 47, members: 15 */
        /* padding: 2 */
        /* last cacheline: 8 bytes */
};

struct ieee80211_key_conf {
        u32                        cipher;               /*     0     4*/
        u8                         icv_len;              /*     4     1*/
        u8                         iv_len;               /*     5     1*/
        u8                         hw_key_idx;           /*     6     1*/
        u8                         flags;                /*     7     1*/
        s8                         keyidx;               /*     8     1*/
        u8                         keylen;               /*     9     1*/
        u8                         key[0];               /*    10     0*/

        /* size: 12, cachelines: 1, members: 8 */
        /* padding: 2 */
        /* last cacheline: 12 bytes */
};

struct vnt_mic_hdr {
        u8                         id;                   /*     0     1*/
        u8                         tx_priority;          /*     1     1*/
        u8                         mic_addr2[6];         /*     2     6*/
        u8                         ccmp_pn[6];           /*     8     6*/
        __be16                     payload_len;          /*    14     2*/
        __be16                     hlen;                 /*    16     2*/
        __le16                     frame_control;        /*    18     2*/
        u8                         addr1[6];             /*    20     6*/
        u8                         addr2[6];             /*    26     6*/
        u8                         addr3[6];             /*    32     6*/
        __le16                     seq_ctrl;             /*    38     2*/
        u8                         addr4[6];             /*    40     6*/
        u16                        packing;              /*    46     2*/

        /* size: 48, cachelines: 1, members: 13 */
        /* last cacheline: 48 bytes */
};

Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 12:23:58 -08:00
..
baseband.c Staging: vt6656: Removing else after break statement to fix warning 2014-09-19 17:01:22 -07:00
baseband.h staging: vt6656: rename BBvUpdatePreEDThreshold to vnt_update_pre_ed_threshold 2014-07-17 18:01:52 -07:00
card.c Staging: vt6656: Fixed typo in a macro name 2015-01-12 19:46:50 -08:00
card.h
channel.c staging: vt6656: struct vnt_private replace byRFType with rf_type 2014-07-21 12:11:56 -07:00
channel.h
desc.h
device.h Staging: vt6656: Fixed typo in a macro name 2015-01-12 19:46:50 -08:00
dpc.c staging: vt6656: dpc remove unneeded headers 2014-07-27 11:19:57 -07:00
dpc.h Staging: vt6656: Fixed typo in a variable name 2015-01-12 19:46:50 -08:00
firmware.c staging: vt6656: Merge three lines into one 2014-09-28 23:22:21 -04:00
firmware.h
int.c staging: vt6656: dead code remove channel switch. 2014-07-21 12:16:29 -07:00
int.h
Kconfig
key.c Staging: vt6656: Merges two lines of code and removes unused variable 2014-09-23 13:40:17 -07:00
key.h
mac.c staging: vt6656: remove return from all void functions 2014-07-27 09:03:44 -07:00
mac.h staging: vt6656: remove unused macros 2014-07-18 16:11:28 -07:00
main_usb.c staging: vt6656: Use ether_addr_copy() on vnt_private members. 2015-01-12 19:38:40 -08:00
Makefile
power.c staging: vt6656: power.c replace DBG_PRT debug messages 2014-07-17 18:01:52 -07:00
power.h staging: vt6656: rf.h cleanup C_PWBT comments 2014-07-27 11:19:57 -07:00
rf.c Staging: vt6656: Merge two lines of code into one 2014-09-23 13:42:54 -07:00
rf.h staging: vt6656: rf.h clean up comments 2014-07-27 09:03:44 -07:00
rxtx.c Staging: vt6656: replace memcpy() by ether_addr_copy() using coccinelle and pack variable 2015-02-26 12:23:58 -08:00
rxtx.h staging: vt6656: struct vnt_tx_short_buf_head change base type of fifo_ctl to __le16 2014-07-22 16:19:36 -07:00
TODO
usbpipe.c staging: vt6656: remove unnecessary braces 2014-08-16 12:23:16 -07:00
usbpipe.h
wcmd.c staging: vt6656: remove return from all void functions 2014-07-27 09:03:44 -07:00
wcmd.h staging: vt6656: wcmd.h remove dead macros 2014-07-27 11:19:57 -07:00