lkml.org 
[lkml]   [2015]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 11/12] staging: wilc1000: fix const cast warnings
    Date
    The wilc1000 driver produces a lot of warnings about invalid
    casts between const and non-const variables. This reworks
    the code to avoid all those warnings, by marking variables
    and function arguments const.

    A lot of the types use WILC_Uint8, I change them to const u8
    for style reasons, as I'm touching them anyway.

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    ---
    drivers/staging/wilc1000/host_interface.c | 32 ++++++++++++-----------
    drivers/staging/wilc1000/host_interface.h | 24 ++++++++---------
    drivers/staging/wilc1000/linux_mon.c | 2 +-
    drivers/staging/wilc1000/wilc_memory.c | 2 +-
    drivers/staging/wilc1000/wilc_memory.h | 2 +-
    drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 ++++-----
    drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
    7 files changed, 39 insertions(+), 37 deletions(-)

    diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
    index 8f7adc760500..6d9bd4983e90 100644
    --- a/drivers/staging/wilc1000/host_interface.c
    +++ b/drivers/staging/wilc1000/host_interface.c
    @@ -4912,8 +4912,8 @@ WILC_Sint32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const WILC_Ui
    * @date 8 March 2012
    * @version 1.0
    */
    -WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
    - const WILC_Uint8 *mac_addr, WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx)
    +WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
    + const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
    @@ -5014,9 +5014,9 @@ WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC
    * @date 8 March 2012
    * @version 1.0
    */
    -WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
    - WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, WILC_Uint8 *KeyRSC,
    - WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode)
    +WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
    + WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, const u8 *KeyRSC,
    + const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
    @@ -5531,7 +5531,7 @@ WILC_Sint32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *p
    * @version 1.0
    */
    WILC_Sint32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8bssid,
    - WILC_Uint8 *pu8ssid, size_t ssidLen,
    + const u8 *pu8ssid, size_t ssidLen,
    const WILC_Uint8 *pu8IEs, size_t IEsLen,
    tWILCpfConnectResult pfConnectResult, void *pvUserArg,
    WILC_Uint8 u8security, AUTHTYPE_T tenuAuth_type,
    @@ -6090,7 +6090,7 @@ WILC_Sint32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, WILC_Uint32 u32
    * @date
    * @version 1.0
    */
    -WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *mac, WILC_Uint32 *pu32InactiveTime)
    +WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, WILC_Uint32 *pu32InactiveTime)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
    @@ -7364,10 +7364,11 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam

    WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam));
    if (pstrAddStationMsg->u8NumRates > 0) {
    - pstrAddStationMsg->pu8Rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
    - WILC_NULLCHECK(s32Error, pstrAddStationMsg->pu8Rates);
    + u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
    + WILC_NULLCHECK(s32Error, rates);

    - WILC_memcpy(pstrAddStationMsg->pu8Rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
    + WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
    + pstrAddStationMsg->pu8Rates = rates;
    }


    @@ -7391,7 +7392,7 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam
    * @date
    * @version 1.0
    */
    -WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAddr)
    +WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
    @@ -7437,7 +7438,7 @@ WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAd
    * @date
    * @version 1.0
    */
    -WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 pu8MacAddr[][ETH_ALEN])
    +WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN])
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
    @@ -7523,9 +7524,10 @@ WILC_Sint32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaPara

    WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam));
    if (pstrAddStationMsg->u8NumRates > 0) {
    - pstrAddStationMsg->pu8Rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
    - WILC_memcpy(pstrAddStationMsg->pu8Rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
    - WILC_NULLCHECK(s32Error, pstrAddStationMsg->pu8Rates);
    + u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
    + WILC_NULLCHECK(s32Error, rates);
    + WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
    + pstrAddStationMsg->pu8Rates = rates;
    }

    s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), WILC_NULL);
    diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
    index 9c06db12b7ea..5c17076d10f6 100644
    --- a/drivers/staging/wilc1000/host_interface.h
    +++ b/drivers/staging/wilc1000/host_interface.h
    @@ -464,7 +464,7 @@ typedef struct {
    WILC_Uint8 au8BSSID[ETH_ALEN];
    WILC_Uint16 u16AssocID;
    WILC_Uint8 u8NumRates;
    - WILC_Uint8 *pu8Rates;
    + const u8 *pu8Rates;
    WILC_Bool bIsHTSupported;
    WILC_Uint16 u16HTCapInfo;
    WILC_Uint8 u8AmpduParams;
    @@ -578,8 +578,8 @@ WILC_Sint32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const WILC_Ui
    * @date 8 March 2012
    * @version 1.0
    */
    -WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
    - const WILC_Uint8 *mac_addr, WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx);
    +WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
    + const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx);

    /**
    * @brief host_int_get_inactive_time
    @@ -593,7 +593,7 @@ WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC
    * @date 15 April 2013
    * @version 1.0
    */
    -WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *mac, WILC_Uint32 *pu32InactiveTime);
    +WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, WILC_Uint32 *pu32InactiveTime);

    /**
    * @brief adds Rx GTk Key
    @@ -611,9 +611,9 @@ WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *ma
    * @date 8 March 2012
    * @version 1.0
    */
    -WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
    - WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, WILC_Uint8 *KeyRSC,
    - WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode);
    +WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
    + WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, const u8 *KeyRSC,
    + const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode);


    /**
    @@ -836,7 +836,7 @@ WILC_Sint32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *p
    */

    WILC_Sint32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8bssid,
    - WILC_Uint8 *pu8ssid, size_t ssidLen,
    + const u8 *pu8ssid, size_t ssidLen,
    const WILC_Uint8 *pu8IEs, size_t IEsLen,
    tWILCpfConnectResult pfConnectResult, void *pvUserArg,
    WILC_Uint8 u8security, AUTHTYPE_T tenuAuth_type,
    @@ -1157,7 +1157,7 @@ WILC_Sint32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv);
    WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams);

    /*!
    - * @fn WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8* pu8MacAddr)
    + * @fn WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
    * @brief Deauthenticates clients when group is terminating
    * @details
    * @param[in,out] hWFIDrv handle to the wifi driver
    @@ -1169,10 +1169,10 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam
    * @date 09 April 2014
    * @version 1.0 Description
    */
    -WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 pu8MacAddr[][ETH_ALEN]);
    +WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);

    /*!
    - * @fn WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8* pu8MacAddr)
    + * @fn WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
    * @brief Notifies the firmware with a new deleted station
    * @details
    * @param[in,out] hWFIDrv handle to the wifi driver
    @@ -1184,7 +1184,7 @@ WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 pu8Mac
    * @date 15 July 2012
    * @version 1.0 Description
    */
    -WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAddr);
    +WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr);

    /*!
    * @fn WILC_Sint32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams)
    diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
    index a19be45b5897..f0a20a98774d 100644
    --- a/drivers/staging/wilc1000/linux_mon.c
    +++ b/drivers/staging/wilc1000/linux_mon.c
    @@ -522,7 +522,7 @@ static void WILC_WFI_mon_setup(struct net_device *dev)
    * @date 12 JUL 2012
    * @version 1.0
    */
    -struct net_device *WILC_WFI_init_mon_interface(char *name, struct net_device *real_dev)
    +struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev)
    {


    diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c
    index fbba38da19bc..f5f4b7acc993 100644
    --- a/drivers/staging/wilc1000/wilc_memory.c
    +++ b/drivers/staging/wilc1000/wilc_memory.c
    @@ -51,7 +51,7 @@ void *WILC_MemoryRealloc(void *pvOldBlock, WILC_Uint32 u32NewSize,
    * @date 18 Aug 2010
    * @version 1.0
    */
    -void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
    +void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
    WILC_Char *pcFileName, WILC_Uint32 u32LineNo)
    {
    kfree(pvBlock);
    diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h
    index 012f03cae0c8..4038e1f3e30b 100644
    --- a/drivers/staging/wilc1000/wilc_memory.h
    +++ b/drivers/staging/wilc1000/wilc_memory.h
    @@ -113,7 +113,7 @@ void *WILC_MemoryRealloc(void *pvOldBlock, WILC_Uint32 u32NewSize,
    * @date 16 Aug 2010
    * @version 1.0
    */
    -void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
    +void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
    WILC_Char *pcFileName, WILC_Uint32 u32LineNo);

    /*!
    diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
    index d8ca75cf73f6..e9ab2cb35381 100644
    --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
    +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
    @@ -1159,8 +1159,8 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
    WILC_Sint32 s32Error = WILC_SUCCESS, KeyLen = params->key_len;
    WILC_Uint32 i;
    struct WILC_WFI_priv *priv;
    - WILC_Uint8 *pu8RxMic = NULL;
    - WILC_Uint8 *pu8TxMic = NULL;
    + const u8 *pu8RxMic = NULL;
    + const u8 *pu8TxMic = NULL;
    WILC_Uint8 u8mode = NO_ENCRYPT;
    #ifdef WILC_AP_EXTERNAL_MLME
    WILC_Uint8 u8gmode = NO_ENCRYPT;
    @@ -1662,7 +1662,7 @@ static int WILC_WFI_dump_survey(struct wiphy *wiphy, struct net_device *netdev,

    extern uint32_t Statisitcs_totalAcks, Statisitcs_DroppedAcks;
    static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
    - u8 *mac, struct station_info *sinfo)
    + const u8 *mac, struct station_info *sinfo)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    struct WILC_WFI_priv *priv;
    @@ -3431,7 +3431,7 @@ static int WILC_WFI_stop_ap(struct wiphy *wiphy, struct net_device *dev)
    * @version 1.0
    */
    static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
    - u8 *mac, struct station_parameters *params)
    + const u8 *mac, struct station_parameters *params)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    struct WILC_WFI_priv *priv;
    @@ -3518,7 +3518,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
    static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
    struct station_del_parameters *params)
    {
    - u8 *mac = params->mac;
    + const u8 *mac = params->mac;
    WILC_Sint32 s32Error = WILC_SUCCESS;
    struct WILC_WFI_priv *priv;
    perInterface_wlan_t *nic;
    @@ -3564,7 +3564,7 @@ static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
    * @version 1.0
    */
    static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev,
    - u8 *mac, struct station_parameters *params)
    + const u8 *mac, struct station_parameters *params)
    {
    WILC_Sint32 s32Error = WILC_SUCCESS;
    struct WILC_WFI_priv *priv;
    diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
    index 829ba32ea210..f45a15f4650f 100644
    --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
    +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
    @@ -118,7 +118,7 @@ int WILC_WFI_DeInitHostInt(struct net_device *net);
    int WILC_WFI_InitHostInt(struct net_device *net);
    void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size);
    int WILC_WFI_deinit_mon_interface(void);
    -struct net_device *WILC_WFI_init_mon_interface(char *name, struct net_device *real_dev);
    +struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev);

    #ifdef TCP_ENHANCEMENTS
    #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
    --
    2.1.0.rc2


    \
     
     \ /
      Last update: 2015-06-01 21:41    [W:2.708 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site