From: Arend van Spriel <arend@xxxxxxxxxxxx> Removed include construction used to solve compiler differences related to packed structure types. Now GNUC variant of packed structure is used explicitly. Reviewed-by: Brett Rudley <brudley@xxxxxxxxxxxx> Reviewed-by: Henry Ptasinski <henryp@xxxxxxxxxxxx> Reviewed-by: Roland Vossen <rvossen@xxxxxxxxxxxx> Reviewed-by: Dowan Kim <dowan@xxxxxxxxxxxx> Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/staging/brcm80211/include/d11.h | 34 ++++++++----------- drivers/staging/brcm80211/include/dhdioctl.h | 7 ---- drivers/staging/brcm80211/include/msgtrace.h | 10 +---- .../staging/brcm80211/include/packed_section_end.h | 32 ----------------- .../brcm80211/include/packed_section_start.h | 36 -------------------- drivers/staging/brcm80211/include/proto/802.11.h | 30 ++++++++--------- drivers/staging/brcm80211/include/proto/bcmeth.h | 8 +--- drivers/staging/brcm80211/include/proto/bcmevent.h | 12 ++---- drivers/staging/brcm80211/include/proto/ethernet.h | 8 +--- drivers/staging/brcm80211/include/sdiovar.h | 6 --- drivers/staging/brcm80211/include/wlioctl.h | 7 ---- 11 files changed, 38 insertions(+), 152 deletions(-) delete mode 100644 drivers/staging/brcm80211/include/packed_section_end.h delete mode 100644 drivers/staging/brcm80211/include/packed_section_start.h diff --git a/drivers/staging/brcm80211/include/d11.h b/drivers/staging/brcm80211/include/d11.h index be2d497..631bfe7 100644 --- a/drivers/staging/brcm80211/include/d11.h +++ b/drivers/staging/brcm80211/include/d11.h @@ -17,9 +17,6 @@ #ifndef _D11_H #define _D11_H -/* This marks the start of a packed structure section. */ -#include <packed_section_start.h> - #ifndef WL_RSSI_ANT_MAX #define WL_RSSI_ANT_MAX 4 /* max possible rx antennas */ #elif WL_RSSI_ANT_MAX != 4 @@ -625,11 +622,11 @@ typedef volatile struct _d11regs { /* 802.11a PLCP header def */ typedef struct ofdm_phy_hdr ofdm_phy_hdr_t; -BWL_PRE_PACKED_STRUCT struct ofdm_phy_hdr { +struct ofdm_phy_hdr { u8 rlpt[3]; /* rate, length, parity, tail */ u16 service; u8 pad; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define D11A_PHY_HDR_GRATE(phdr) ((phdr)->rlpt[0] & 0x0f) #define D11A_PHY_HDR_GRES(phdr) (((phdr)->rlpt[0] >> 4) & 0x01) @@ -660,12 +657,12 @@ BWL_PRE_PACKED_STRUCT struct ofdm_phy_hdr { /* 802.11b PLCP header def */ typedef struct cck_phy_hdr cck_phy_hdr_t; -BWL_PRE_PACKED_STRUCT struct cck_phy_hdr { +struct cck_phy_hdr { u8 signal; u8 service; u16 length; u16 crc; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define D11B_PHY_HDR_LEN 6 @@ -706,7 +703,7 @@ BWL_PRE_PACKED_STRUCT struct cck_phy_hdr { /* TX DMA buffer header */ typedef struct d11txh d11txh_t; -BWL_PRE_PACKED_STRUCT struct d11txh { +struct d11txh { u16 MacTxControlLow; /* 0x0 */ u16 MacTxControlHigh; /* 0x1 */ u16 MacFrameControl; /* 0x2 */ @@ -741,7 +738,7 @@ BWL_PRE_PACKED_STRUCT struct d11txh { u8 RTSPhyHeader[D11_PHY_HDR_LEN]; /* 0x2c - 0x2e */ struct dot11_rts_frame rts_frame; /* 0x2f - 0x36 */ u16 PAD; /* 0x37 */ -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define D11_TXH_LEN 112 /* bytes */ @@ -850,7 +847,7 @@ BWL_PRE_PACKED_STRUCT struct d11txh { /* tx status packet */ typedef struct tx_status tx_status_t; -BWL_PRE_PACKED_STRUCT struct tx_status { +struct tx_status { u16 framelen; u16 PAD; u16 frameid; @@ -859,7 +856,7 @@ BWL_PRE_PACKED_STRUCT struct tx_status { u16 sequence; u16 phyerr; u16 ackphyrxsh; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define TXSTATUS_LEN 16 @@ -1243,7 +1240,7 @@ BWL_PRE_PACKED_STRUCT struct tx_status { #define MIMO_ANTSEL_OVERRIDE 0x8000 /* flag */ typedef struct shm_acparams shm_acparams_t; -BWL_PRE_PACKED_STRUCT struct shm_acparams { +struct shm_acparams { u16 txop; u16 cwmin; u16 cwmax; @@ -1253,7 +1250,7 @@ BWL_PRE_PACKED_STRUCT struct shm_acparams { u16 reggap; u16 status; u16 rsvd[8]; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define M_EDCF_QLEN (16 * 2) #define WME_STATUS_NEWAC (1 << 8) @@ -1302,7 +1299,7 @@ BWL_PRE_PACKED_STRUCT struct shm_acparams { /* Receive Frame Data Header for 802.11b DCF-only frames */ typedef struct d11rxhdr d11rxhdr_t; -BWL_PRE_PACKED_STRUCT struct d11rxhdr { +struct d11rxhdr { u16 RxFrameSize; /* Actual byte length of the frame data received */ u16 PAD; u16 PhyRxStatus_0; /* PhyRxStatus 15:0 */ @@ -1315,13 +1312,13 @@ BWL_PRE_PACKED_STRUCT struct d11rxhdr { u16 RxStatus2; /* extended MAC Rx status */ u16 RxTSFTime; /* RxTSFTime time of first MAC symbol + M_PHY_PLCPRX_DLY */ u16 RxChan; /* gain code, channel radio code, and phy type */ -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define RXHDR_LEN 24 /* sizeof d11rxhdr_t */ #define FRAMELEN(h) ((h)->RxFrameSize) typedef struct wlc_d11rxhdr wlc_d11rxhdr_t; -BWL_PRE_PACKED_STRUCT struct wlc_d11rxhdr { +struct wlc_d11rxhdr { d11rxhdr_t rxhdr; u32 tsf_l; /* TSF_L reading */ s8 rssi; /* computed instanteneous rssi in BMAC */ @@ -1329,7 +1326,7 @@ BWL_PRE_PACKED_STRUCT struct wlc_d11rxhdr { s8 rxpwr1; /* obsoleted, place holder for legacy ROM code. use rxpwr[] */ s8 do_rssi_ma; /* do per-pkt sampling for per-antenna ma in HIGH */ s8 rxpwr[WL_RSSI_ANT_MAX]; /* rssi for supported antennas */ -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); /* PhyRxStatus_0: */ #define PRXS0_FT_MASK 0x0003 /* NPHY only: CCK, OFDM, preN, N */ @@ -1762,9 +1759,6 @@ typedef struct macstat { #define TST_TXTEST_RATE_11MBPS 3 #define TST_TXTEST_RATE_SHIFT 3 -/* This marks the end of a packed structure section. */ -#include <packed_section_end.h> - #define SHM_BYT_CNT 0x2 /* IHR location */ #define MAX_BYT_CNT 0x600 /* Maximum frame len */ diff --git a/drivers/staging/brcm80211/include/dhdioctl.h b/drivers/staging/brcm80211/include/dhdioctl.h index 4d06e50..f0ba535 100644 --- a/drivers/staging/brcm80211/include/dhdioctl.h +++ b/drivers/staging/brcm80211/include/dhdioctl.h @@ -17,10 +17,6 @@ #ifndef _dhdioctl_h_ #define _dhdioctl_h_ -/* require default structure packing */ -#define BWL_DEFAULT_PACKING -#include <packed_section_start.h> - /* Linux network driver ioctl encoding */ typedef struct dhd_ioctl { uint cmd; /* common ioctl definition */ @@ -101,7 +97,4 @@ typedef struct dhd_pktgen { #define DHD_IDLE_STOP (-1) /* Request SD clock be stopped (and use SD1 mode) */ -/* require default structure packing */ -#include <packed_section_end.h> - #endif /* _dhdioctl_h_ */ diff --git a/drivers/staging/brcm80211/include/msgtrace.h b/drivers/staging/brcm80211/include/msgtrace.h index 9d9e53d..d654671 100644 --- a/drivers/staging/brcm80211/include/msgtrace.h +++ b/drivers/staging/brcm80211/include/msgtrace.h @@ -17,13 +17,10 @@ #ifndef _MSGTRACE_H #define _MSGTRACE_H -/* This marks the start of a packed structure section. */ -#include <packed_section_start.h> - #define MSGTRACE_VERSION 1 /* Message trace header */ -typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr { +typedef struct msgtrace_hdr { u8 version; u8 spare; u16 len; /* Len of the trace */ @@ -36,7 +33,7 @@ typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr { trace overflow */ u32 discarded_printf; /* Number of discarded printf because of trace overflow */ -} BWL_POST_PACKED_STRUCT msgtrace_hdr_t; +} __attribute__((packed)) msgtrace_hdr_t; #define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t) @@ -61,7 +58,4 @@ extern void msgtrace_put(char *buf, int count); extern void msgtrace_init(void *hdl1, void *hdl2, msgtrace_func_send_t func_send); -/* This marks the end of a packed structure section. */ -#include <packed_section_end.h> - #endif /* _MSGTRACE_H */ diff --git a/drivers/staging/brcm80211/include/packed_section_end.h b/drivers/staging/brcm80211/include/packed_section_end.h deleted file mode 100644 index 04c7d43..0000000 --- a/drivers/staging/brcm80211/include/packed_section_end.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h - * and undefined in packed_section_end.h. If it is NOT defined at this - * point, then there is a missing include of packed_section_start.h. - */ -#ifdef BWL_PACKED_SECTION -#undef BWL_PACKED_SECTION -#else -#error "BWL_PACKED_SECTION is NOT defined!" -#endif - -/* Compiler-specific directives for structure packing are declared in - * packed_section_start.h. This marks the end of the structure packing section, - * so, undef them here. - */ -#undef BWL_PRE_PACKED_STRUCT -#undef BWL_POST_PACKED_STRUCT diff --git a/drivers/staging/brcm80211/include/packed_section_start.h b/drivers/staging/brcm80211/include/packed_section_start.h deleted file mode 100644 index 60e862a..0000000 --- a/drivers/staging/brcm80211/include/packed_section_start.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Error check - BWL_PACKED_SECTION is defined in packed_section_start.h - * and undefined in packed_section_end.h. If it is already defined at this - * point, then there is a missing include of packed_section_end.h. - */ -#ifdef BWL_PACKED_SECTION -#error "BWL_PACKED_SECTION is already defined!" -#else -#define BWL_PACKED_SECTION -#endif - -/* Declare compiler-specific directives for structure packing. */ -#if defined(__GNUC__) -#define BWL_PRE_PACKED_STRUCT -#define BWL_POST_PACKED_STRUCT __attribute__((packed)) -#elif defined(__CC_ARM) -#define BWL_PRE_PACKED_STRUCT __packed -#define BWL_POST_PACKED_STRUCT -#else -#error "Unknown compiler!" -#endif diff --git a/drivers/staging/brcm80211/include/proto/802.11.h b/drivers/staging/brcm80211/include/proto/802.11.h index d1ee416..57840a0 100644 --- a/drivers/staging/brcm80211/include/proto/802.11.h +++ b/drivers/staging/brcm80211/include/proto/802.11.h @@ -18,7 +18,6 @@ #define _802_11_H_ #include <proto/ethernet.h> -#include <packed_section_start.h> #define DOT11_A3_HDR_LEN 24 #define DOT11_A4_HDR_LEN 30 @@ -45,7 +44,7 @@ #define DOT11_OUI_LEN 3 -BWL_PRE_PACKED_STRUCT struct dot11_header { +struct dot11_header { u16 fc; u16 durid; struct ether_addr a1; @@ -53,14 +52,14 @@ BWL_PRE_PACKED_STRUCT struct dot11_header { struct ether_addr a3; u16 seq; struct ether_addr a4; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); -BWL_PRE_PACKED_STRUCT struct dot11_rts_frame { +struct dot11_rts_frame { u16 fc; u16 durid; struct ether_addr ra; struct ether_addr ta; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define DOT11_RTS_LEN 16 #define DOT11_CTS_LEN 10 @@ -69,21 +68,21 @@ BWL_PRE_PACKED_STRUCT struct dot11_rts_frame { #define DOT11_BA_BITMAP_LEN 128 #define DOT11_BA_LEN 4 -BWL_PRE_PACKED_STRUCT struct dot11_management_header { +struct dot11_management_header { u16 fc; u16 durid; struct ether_addr da; struct ether_addr sa; struct ether_addr bssid; u16 seq; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define DOT11_MGMT_HDR_LEN 24 -BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb { +struct dot11_bcn_prb { u32 timestamp[2]; u16 beacon_interval; u16 capability; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); #define DOT11_BCN_PRB_LEN 12 #define WME_OUI "\x00\x50\xf2" @@ -102,14 +101,14 @@ typedef u8 ac_bitmap_t; #define AC_BITMAP_ALL 0xf #define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0) -BWL_PRE_PACKED_STRUCT struct edcf_acparam { +struct edcf_acparam { u8 ACI; u8 ECW; u16 TXOP; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); typedef struct edcf_acparam edcf_acparam_t; -BWL_PRE_PACKED_STRUCT struct wme_param_ie { +struct wme_param_ie { u8 oui[3]; u8 type; u8 subtype; @@ -117,7 +116,7 @@ BWL_PRE_PACKED_STRUCT struct wme_param_ie { u8 qosinfo; u8 rsvd; edcf_acparam_t acparam[AC_COUNT]; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); typedef struct wme_param_ie wme_param_ie_t; #define WME_PARAM_IE_LEN 24 @@ -253,14 +252,14 @@ typedef struct d11cnt { #define MCSSET_LEN 16 -BWL_PRE_PACKED_STRUCT struct ht_cap_ie { +struct ht_cap_ie { u16 cap; u8 params; u8 supp_mcs[MCSSET_LEN]; u16 ext_htcap; u32 txbf_cap; u8 as_cap; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); typedef struct ht_cap_ie ht_cap_ie_t; #define HT_CAP_IE_LEN 26 @@ -317,6 +316,5 @@ typedef struct ht_cap_ie ht_cap_ie_t; #define AES_KEY_SIZE 16 #define BRCM_OUI "\x00\x10\x18" -#include <packed_section_end.h> #endif /* _802_11_H_ */ diff --git a/drivers/staging/brcm80211/include/proto/bcmeth.h b/drivers/staging/brcm80211/include/proto/bcmeth.h index f7d3d8d..e98ee65 100644 --- a/drivers/staging/brcm80211/include/proto/bcmeth.h +++ b/drivers/staging/brcm80211/include/proto/bcmeth.h @@ -17,8 +17,6 @@ #ifndef _BCMETH_H_ #define _BCMETH_H_ -#include <packed_section_start.h> - #define BCMILCP_SUBTYPE_RATE 1 #define BCMILCP_SUBTYPE_LINK 2 #define BCMILCP_SUBTYPE_CSA 3 @@ -35,14 +33,12 @@ #define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8 #define BCMILCP_BCM_SUBTYPEHDR_VERSION 0 -typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr { +typedef struct bcmeth_hdr { u16 subtype; u16 length; u8 version; u8 oui[3]; u16 usr_subtype; -} BWL_POST_PACKED_STRUCT bcmeth_hdr_t; - -#include <packed_section_end.h> +} __attribute__((packed)) bcmeth_hdr_t; #endif /* _BCMETH_H_ */ diff --git a/drivers/staging/brcm80211/include/proto/bcmevent.h b/drivers/staging/brcm80211/include/proto/bcmevent.h index 5796f75..2f0d471 100644 --- a/drivers/staging/brcm80211/include/proto/bcmevent.h +++ b/drivers/staging/brcm80211/include/proto/bcmevent.h @@ -17,8 +17,6 @@ #ifndef _BCMEVENT_H_ #define _BCMEVENT_H_ -#include <packed_section_start.h> - #define BCM_EVENT_MSG_VERSION 1 #define BCM_MSG_IFNAME_MAX 16 @@ -26,7 +24,7 @@ #define WLC_EVENT_MSG_FLUSHTXQ 0x02 #define WLC_EVENT_MSG_GROUP 0x04 -typedef BWL_PRE_PACKED_STRUCT struct { +typedef struct { u16 version; u16 flags; u32 event_type; @@ -36,14 +34,14 @@ typedef BWL_PRE_PACKED_STRUCT struct { u32 datalen; struct ether_addr addr; char ifname[BCM_MSG_IFNAME_MAX]; -} BWL_POST_PACKED_STRUCT wl_event_msg_t; +} __attribute__((packed)) wl_event_msg_t; #ifdef BRCM_FULLMAC -typedef BWL_PRE_PACKED_STRUCT struct bcm_event { +typedef struct bcm_event { struct ethhdr eth; bcmeth_hdr_t bcm_hdr; wl_event_msg_t event; -} BWL_POST_PACKED_STRUCT bcm_event_t; +} __attribute__((packed)) bcm_event_t; #endif #define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - \ sizeof(struct ether_header)) @@ -212,6 +210,4 @@ typedef struct wl_event_data_if { #define WLC_E_LINK_ASSOC_REC 3 #define WLC_E_LINK_BSSCFG_DIS 4 -#include <packed_section_end.h> - #endif /* _BCMEVENT_H_ */ diff --git a/drivers/staging/brcm80211/include/proto/ethernet.h b/drivers/staging/brcm80211/include/proto/ethernet.h index 520c4d2..0860219 100644 --- a/drivers/staging/brcm80211/include/proto/ethernet.h +++ b/drivers/staging/brcm80211/include/proto/ethernet.h @@ -19,15 +19,11 @@ #include <linux/if_ether.h> -#include <packed_section_start.h> - -BWL_PRE_PACKED_STRUCT struct ether_addr { +struct ether_addr { u8 octet[ETH_ALEN]; -} BWL_POST_PACKED_STRUCT; +} __attribute__((packed)); static const struct ether_addr ether_bcast = { {255, 255, 255, 255, 255, 255} }; -#include <packed_section_end.h> - #endif /* _NET_ETHERNET_H_ */ diff --git a/drivers/staging/brcm80211/include/sdiovar.h b/drivers/staging/brcm80211/include/sdiovar.h index 7686fde..d1cfa5f 100644 --- a/drivers/staging/brcm80211/include/sdiovar.h +++ b/drivers/staging/brcm80211/include/sdiovar.h @@ -17,10 +17,6 @@ #ifndef _sdiovar_h_ #define _sdiovar_h_ -/* require default structure packing */ -#define BWL_DEFAULT_PACKING -#include <packed_section_start.h> - typedef struct sdreg { int func; int offset; @@ -39,6 +35,4 @@ typedef struct sdreg { #define NUM_PREV_TRANSACTIONS 16 -#include <packed_section_end.h> - #endif /* _sdiovar_h_ */ diff --git a/drivers/staging/brcm80211/include/wlioctl.h b/drivers/staging/brcm80211/include/wlioctl.h index f909c12..69cb541 100644 --- a/drivers/staging/brcm80211/include/wlioctl.h +++ b/drivers/staging/brcm80211/include/wlioctl.h @@ -30,10 +30,6 @@ #define INTF_NAME_SIZ 16 #endif -/* require default structure packing */ -#define BWL_DEFAULT_PACKING -#include <packed_section_start.h> - #ifdef BRCM_FULLMAC #define WL_BSS_INFO_VERSION 108 /* current ver of wl_bss_info struct */ @@ -1669,9 +1665,6 @@ typedef struct wl_pkt_filter_enable { #define WLC_RSSI_INVALID 0 /* invalid RSSI value */ -/* require default structure packing */ -#include <packed_section_end.h> - /* n-mode support capability */ /* 2x2 includes both 1x1 & 2x2 devices * reserved #define 2 for future when we want to separate 1x1 & 2x2 and -- 1.7.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel