From fe6d57701d3ccdce08123b467c43176d20795886 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Tue, 19 Oct 2010 20:35:21 +0200 Subject: [PATCH] carl9170 firmware: privatize firmware structs This patch removes all public bit-packed structs from the public view by making them private with ifdef __CARL9170FW__. Signed-off-by: Christian Lamparter --- carlfw/CMakeLists.txt | 4 ++-- carlfw/include/config.h | 2 -- include/shared/fwcmd.h | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/carlfw/CMakeLists.txt b/carlfw/CMakeLists.txt index a32f68a..f1dc23c 100644 --- a/carlfw/CMakeLists.txt +++ b/carlfw/CMakeLists.txt @@ -7,7 +7,7 @@ include("../config.cmake") set(CARLFW_CFLAGS_WARNING "-W -Wall -Wextra -Wunreachable-code -Winline -Wlogical-op -Wno-packed-bitfield-compat -Winit-self -Wshadow -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wformat=2 -Wcast-align -Wmissing-format-attribute -Wmissing-prototypes -Wtype-limits -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wdisabled-optimization -Wpointer-arith -Wvolatile-register-var -Waddress -Wbad-function-cast -Wunsafe-loop-optimizations") set(CARLFW_CFLAGS_EXTRA "-mbitops -std=gnu99 -ffunction-sections -Wframe-larger-than=128 -Werror") - +set(CARLFW_CFLAGS_DEF "-D__CARL9170FW__") if (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS) set(CARLFW_CFLAGS_AGGRESSIVE "-fomit-frame-pointer -fsee -frename-registers -ftree-vectorize") endif (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS) @@ -33,7 +33,7 @@ add_executable(carl9170.elf ${carl9170_src}) set_target_properties(carl9170.elf PROPERTIES LINKER_LANGUAGE C) set_target_properties(carl9170.elf PROPERTIES COMPILE_FLAGS - "${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}") + " ${CARLFW_CFLAGS_DEF} ${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}") set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "-Tcarl9170.lds") add_custom_target( diff --git a/carlfw/include/config.h b/carlfw/include/config.h index f9f093e..8361aff 100644 --- a/carlfw/include/config.h +++ b/carlfw/include/config.h @@ -24,8 +24,6 @@ #ifndef __CARL9170FW_CONFIG_H #define __CARL9170FW_CONFIG_H -#define __CARL9170FW__ - #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #if GCC_VERSION < 40400 diff --git a/include/shared/fwcmd.h b/include/shared/fwcmd.h index 6bd374a..3680dfc 100644 --- a/include/shared/fwcmd.h +++ b/include/shared/fwcmd.h @@ -216,6 +216,7 @@ struct carl9170_cmd { #define CARL9170_TX_STATUS_TRIES (7 << CARL9170_TX_STATUS_TRIES_S) #define CARL9170_TX_STATUS_SUCCESS 0x80 +#ifdef __CARL9170FW__ /* * NOTE: * Both structs [carl9170_tx_status and _carl9170_tx_status] @@ -232,6 +233,8 @@ struct carl9170_tx_status { u8 tries:3; u8 success:1; } __packed; +#endif /* __CARL9170FW__ */ + struct _carl9170_tx_status { /* * This version should be immune to all alignment bugs. @@ -272,7 +275,9 @@ struct carl9170_rsp { struct carl9170_rf_init_result rf_init_res; struct carl9170_u32_list rreg_res; struct carl9170_u32_list echo; +#ifdef __CARL9170FW__ struct carl9170_tx_status tx_status[0]; +#endif /* __CARL9170FW__ */ struct _carl9170_tx_status _tx_status[0]; struct carl9170_gpio gpio; struct carl9170_tsf_rsp tsf; -- 2.31.1