[PATCH] staging: ks7010: Use __packed over __attribute__((packed))
From: Matt Kilgore
Date: Tue Sep 27 2016 - 02:08:45 EST
This replaces uses of __attribute__((packed)) with __packed, which is
recommended to be used over the direct __attribute__. This patch then
includes <linux/compiler.h> as necessary to use __packed.
Signed-off-by: Matthew Kilgore <mattkilgore12@xxxxxxxxx>
---
drivers/staging/ks7010/eap_packet.h | 10 ++--
drivers/staging/ks7010/ks_hostif.h | 99 +++++++++++++++++++------------------
drivers/staging/ks7010/ks_wlan.h | 4 +-
3 files changed, 59 insertions(+), 54 deletions(-)
diff --git a/drivers/staging/ks7010/eap_packet.h b/drivers/staging/ks7010/eap_packet.h
index 16a392a..373c0fe 100644
--- a/drivers/staging/ks7010/eap_packet.h
+++ b/drivers/staging/ks7010/eap_packet.h
@@ -1,6 +1,8 @@
#ifndef EAP_PACKET_H
#define EAP_PACKET_H
+#include <linux/compiler.h>
+
#define WBIT(n) (1 << (n))
#ifndef ETH_ALEN
@@ -19,14 +21,14 @@ struct ether_hdr {
#define ETHER_PROTOCOL_TYPE_IP 0x0800
#define ETHER_PROTOCOL_TYPE_ARP 0x0806
/* followed by length octets of data */
-} __attribute__ ((packed));
+} __packed;
struct ieee802_1x_hdr {
unsigned char version;
unsigned char type;
unsigned short length;
/* followed by length octets of data */
-} __attribute__ ((packed));
+} __packed;
#define EAPOL_VERSION 2
@@ -69,7 +71,7 @@ struct ieee802_1x_eapol_key {
* represents the number of least significant octets from
* MS-MPPE-Send-Key attribute to be used as the keying material;
* RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
-} __attribute__ ((packed));
+} __packed;
#define WPA_NONCE_LEN 32
#define WPA_REPLAY_COUNTER_LEN 8
@@ -86,7 +88,7 @@ struct wpa_eapol_key {
unsigned char key_mic[16];
unsigned short key_data_length;
/* followed by key_data_length bytes of key_data */
-} __attribute__ ((packed));
+} __packed;
#define WPA_KEY_INFO_TYPE_MASK (WBIT(0) | WBIT(1) | WBIT(2))
#define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 WBIT(0)
diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index dc806b5b..f35c0c51 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -11,6 +11,9 @@
#ifndef _KS_HOSTIF_H_
#define _KS_HOSTIF_H_
+
+#include <linux/compiler.h>
+
/*
* HOST-MAC I/F events
*/
@@ -61,7 +64,7 @@
struct hostif_hdr {
uint16_t size;
uint16_t event;
-} __attribute__ ((packed));
+} __packed;
struct hostif_data_request_t {
struct hostif_hdr header;
@@ -70,7 +73,7 @@ struct hostif_data_request_t {
#define TYPE_AUTH 0x0001
uint16_t reserved;
uint8_t data[0];
-} __attribute__ ((packed));
+} __packed;
struct hostif_data_indication_t {
struct hostif_hdr header;
@@ -81,14 +84,14 @@ struct hostif_data_indication_t {
#define TYPE_GMK2 0x0003
uint16_t reserved;
uint8_t data[0];
-} __attribute__ ((packed));
+} __packed;
#define CHANNEL_LIST_MAX_SIZE 14
struct channel_list_t {
uint8_t size;
uint8_t body[CHANNEL_LIST_MAX_SIZE];
uint8_t pad;
-} __attribute__ ((packed));
+} __packed;
/* MIB Attribute */
#define DOT11_MAC_ADDRESS 0x21010100 /* MAC Address (R) */
@@ -141,7 +144,7 @@ struct channel_list_t {
struct hostif_mib_get_request_t {
struct hostif_hdr header;
uint32_t mib_attribute;
-} __attribute__ ((packed));
+} __packed;
struct hostif_mib_value_t {
uint16_t size;
@@ -152,7 +155,7 @@ struct hostif_mib_value_t {
#define MIB_VALUE_TYPE_COUNT32 3
#define MIB_VALUE_TYPE_OSTRING 4
uint8_t body[0];
-} __attribute__ ((packed));
+} __packed;
struct hostif_mib_get_confirm_t {
struct hostif_hdr header;
@@ -163,19 +166,19 @@ struct hostif_mib_get_confirm_t {
#define MIB_WRITE_ONLY 3
uint32_t mib_attribute;
struct hostif_mib_value_t mib_value;
-} __attribute__ ((packed));
+} __packed;
struct hostif_mib_set_request_t {
struct hostif_hdr header;
uint32_t mib_attribute;
struct hostif_mib_value_t mib_value;
-} __attribute__ ((packed));
+} __packed;
struct hostif_mib_set_confirm_t {
struct hostif_hdr header;
uint32_t mib_status;
uint32_t mib_attribute;
-} __attribute__ ((packed));
+} __packed;
struct hostif_power_mngmt_request_t {
struct hostif_hdr header;
@@ -188,7 +191,7 @@ struct hostif_power_mngmt_request_t {
uint32_t receiveDTIMs;
#define DTIM_FALSE 0
#define DTIM_TRUE 1
-} __attribute__ ((packed));
+} __packed;
/* power management mode */
enum {
@@ -206,7 +209,7 @@ enum {
struct hostif_power_mngmt_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
struct hostif_start_request_t {
struct hostif_hdr header;
@@ -215,64 +218,64 @@ struct hostif_start_request_t {
#define MODE_INFRASTRUCTURE 1
#define MODE_AP 2 /* not used */
#define MODE_ADHOC 3
-} __attribute__ ((packed));
+} __packed;
struct hostif_start_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
#define SSID_MAX_SIZE 32
struct ssid_t {
uint8_t size;
uint8_t body[SSID_MAX_SIZE];
uint8_t ssid_pad;
-} __attribute__ ((packed));
+} __packed;
#define RATE_SET_MAX_SIZE 16
struct rate_set8_t {
uint8_t size;
uint8_t body[8];
uint8_t rate_pad;
-} __attribute__ ((packed));
+} __packed;
struct FhParms_t {
uint16_t dwellTime;
uint8_t hopSet;
uint8_t hopPattern;
uint8_t hopIndex;
-} __attribute__ ((packed));
+} __packed;
struct DsParms_t {
uint8_t channel;
-} __attribute__ ((packed));
+} __packed;
struct CfParms_t {
uint8_t count;
uint8_t period;
uint16_t maxDuration;
uint16_t durRemaining;
-} __attribute__ ((packed));
+} __packed;
struct IbssParms_t {
uint16_t atimWindow;
-} __attribute__ ((packed));
+} __packed;
struct rsn_t {
uint8_t size;
#define RSN_BODY_SIZE 64
uint8_t body[RSN_BODY_SIZE];
-} __attribute__ ((packed));
+} __packed;
struct ErpParams_t {
uint8_t erp_info;
-} __attribute__ ((packed));
+} __packed;
struct rate_set16_t {
uint8_t size;
uint8_t body[16];
uint8_t rate_pad;
-} __attribute__ ((packed));
+} __packed;
struct ap_info_t {
uint8_t bssid[6]; /* +00 */
@@ -299,7 +302,7 @@ struct ap_info_t {
uint16_t body_size; /* +16 */
uint8_t body[1024]; /* +18 */
/* +1032 */
-} __attribute__ ((packed));
+} __packed;
struct link_ap_info_t {
uint8_t bssid[6]; /* +00 */
@@ -325,8 +328,8 @@ struct link_ap_info_t {
struct {
uint8_t size; /* +52 */
uint8_t body[128]; /* +53 */
- } __attribute__ ((packed)) rsn;
-} __attribute__ ((packed));
+ } __packed rsn;
+} __packed;
struct hostif_connect_indication_t {
struct hostif_hdr header;
@@ -334,16 +337,16 @@ struct hostif_connect_indication_t {
#define RESULT_CONNECT 0
#define RESULT_DISCONNECT 1
struct link_ap_info_t link_ap_info;
-} __attribute__ ((packed));
+} __packed;
struct hostif_stop_request_t {
struct hostif_hdr header;
-} __attribute__ ((packed));
+} __packed;
struct hostif_stop_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
struct hostif_ps_adhoc_set_request_t {
struct hostif_hdr header;
@@ -360,12 +363,12 @@ struct hostif_ps_adhoc_set_request_t {
uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
uint16_t scan_type;
-} __attribute__ ((packed));
+} __packed;
struct hostif_ps_adhoc_set_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
struct hostif_infrastructure_set_request_t {
struct hostif_hdr header;
@@ -381,7 +384,7 @@ struct hostif_infrastructure_set_request_t {
#define AUTH_TYPE_SHARED_KEY 1
struct channel_list_t channel_list;
uint16_t scan_type;
-} __attribute__ ((packed));
+} __packed;
struct hostif_infrastructure_set2_request_t {
struct hostif_hdr header;
@@ -398,12 +401,12 @@ struct hostif_infrastructure_set2_request_t {
struct channel_list_t channel_list;
uint16_t scan_type;
uint8_t bssid[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
struct hostif_infrastructure_set_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
struct hostif_adhoc_set_request_t {
struct hostif_hdr header;
@@ -415,7 +418,7 @@ struct hostif_adhoc_set_request_t {
uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0
* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */
uint16_t scan_type;
-} __attribute__ ((packed));
+} __packed;
struct hostif_adhoc_set2_request_t {
struct hostif_hdr header;
@@ -429,17 +432,17 @@ struct hostif_adhoc_set2_request_t {
uint16_t scan_type;
struct channel_list_t channel_list;
uint8_t bssid[ETH_ALEN];
-} __attribute__ ((packed));
+} __packed;
struct hostif_adhoc_set_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
struct last_associate_t {
uint8_t type;
uint8_t status;
-} __attribute__ ((packed));
+} __packed;
struct association_request_t {
uint8_t type;
@@ -450,7 +453,7 @@ struct association_request_t {
uint16_t listen_interval;
uint8_t ap_address[6];
uint16_t reqIEs_size;
-} __attribute__ ((packed));
+} __packed;
struct association_response_t {
uint8_t type;
@@ -461,7 +464,7 @@ struct association_response_t {
uint16_t status;
uint16_t association_id;
uint16_t respIEs_size;
-} __attribute__ ((packed));
+} __packed;
struct hostif_associate_indication_t {
struct hostif_hdr header;
@@ -469,7 +472,7 @@ struct hostif_associate_indication_t {
struct association_response_t assoc_resp;
/* followed by (reqIEs_size + respIEs_size) octets of data */
/* reqIEs data *//* respIEs data */
-} __attribute__ ((packed));
+} __packed;
struct hostif_bss_scan_request_t {
struct hostif_hdr header;
@@ -481,13 +484,13 @@ struct hostif_bss_scan_request_t {
uint32_t ch_time_max;
struct channel_list_t channel_list;
struct ssid_t ssid;
-} __attribute__ ((packed));
+} __packed;
struct hostif_bss_scan_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
uint16_t reserved;
-} __attribute__ ((packed));
+} __packed;
struct hostif_phy_information_request_t {
struct hostif_hdr header;
@@ -495,7 +498,7 @@ struct hostif_phy_information_request_t {
#define NORMAL_TYPE 0
#define TIME_TYPE 1
uint16_t time; /* unit 100ms */
-} __attribute__ ((packed));
+} __packed;
struct hostif_phy_information_confirm_t {
struct hostif_hdr header;
@@ -507,30 +510,30 @@ struct hostif_phy_information_confirm_t {
uint32_t rx_frame;
uint32_t tx_error;
uint32_t rx_error;
-} __attribute__ ((packed));
+} __packed;
/* sleep mode */
#define SLP_ACTIVE 0
#define SLP_SLEEP 1
struct hostif_sleep_request_t {
struct hostif_hdr header;
-} __attribute__ ((packed));
+} __packed;
struct hostif_sleep_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
struct hostif_mic_failure_request_t {
struct hostif_hdr header;
uint16_t failure_count;
uint16_t timer;
-} __attribute__ ((packed));
+} __packed;
struct hostif_mic_failure_confirm_t {
struct hostif_hdr header;
uint16_t result_code;
-} __attribute__ ((packed));
+} __packed;
#define BASIC_RATE 0x80
#define RATE_MASK 0x7F
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index f05dc01..cf39e67 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -219,7 +219,7 @@ struct rsn_ie_t {
uint8_t id; /* 0xdd = WPA or 0x30 = RSN */
uint8_t size; /* max ? 255 ? */
uint8_t body[RSN_IE_BODY_MAX];
-} __attribute__ ((packed));
+} __packed;
#ifdef WPS
#define WPS_IE_BODY_MAX 255
@@ -227,7 +227,7 @@ struct wps_ie_t {
uint8_t id; /* 221 'dd <len> 00 50 F2 04' */
uint8_t size; /* max ? 255 ? */
uint8_t body[WPS_IE_BODY_MAX];
-} __attribute__ ((packed));
+} __packed;
#endif /* WPS */
struct local_ap_t {
--
2.10.0