From 4bcb20f83441f1ffa5907200444066c580231755 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 14:56:57 -0700 Subject: [PATCH] staging: csr: remove CsrStrLen() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's just a wrapper around strlen(), so call that instead. Also add a few #include to fix up the build with this change. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman --- .../staging/csr/csr_serialize_primitive_types.c | 14 +++++++------- drivers/staging/csr/csr_utf16.c | 4 ++-- drivers/staging/csr/csr_util.c | 8 -------- drivers/staging/csr/csr_util.h | 2 -- drivers/staging/csr/csr_wifi_nme_ap_serialize.c | 4 ++-- .../staging/csr/csr_wifi_router_ctrl_serialize.c | 6 +++--- drivers/staging/csr/csr_wifi_sme_serialize.c | 10 +++++----- 7 files changed, 19 insertions(+), 29 deletions(-) diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index 419528bf1fa5..1d84938bbb4d 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -50,14 +50,14 @@ EXPORT_SYMBOL_GPL(CsrMemCpyDes); void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) { *value = kstrdup((char *) &buffer[*offset], GFP_KERNEL); - *offset += CsrStrLen(*value) + 1; + *offset += strlen(*value) + 1; } EXPORT_SYMBOL_GPL(CsrCharStringDes); void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset) { *value = (u8 *)kstrdup((char *) &buffer[*offset], GFP_KERNEL); - *offset += CsrStrLen((char *) *value) + 1; + *offset += strlen((char *) *value) + 1; } void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset) @@ -124,7 +124,7 @@ void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) if (value) { strcpy(((char *) &buffer[*offset]), value); - *offset += CsrStrLen(value) + 1; + *offset += strlen(value) + 1; } else { @@ -176,7 +176,7 @@ u32 CsrCharStringSerLen(const char *str) { if (str) { - return (u32) (CsrStrLen(str) + sizeof(*str)); + return (u32)(strlen(str) + sizeof(*str)); } else { @@ -188,7 +188,7 @@ u32 CsrUtf8StringSerLen(const u8 *str) { if (str) { - return (u32) (CsrStrLen((char *) str) + sizeof(*str)); + return (u32)(strlen((char *) str) + sizeof(*str)); } else { @@ -390,7 +390,7 @@ void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg) { CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg; - return 4 + CsrStrLen(primitive->value2) + 1; + return 4 + strlen(primitive->value2) + 1; } u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg) @@ -445,7 +445,7 @@ void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg) { CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg; - return 6 + CsrStrLen(primitive->value2) + 1; + return 6 + strlen(primitive->value2) + 1; } u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg) diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index e678713d1675..edfc4b718db5 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -573,7 +573,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String) { return NULL; } - sourceLength = CsrStrLen((char *) utf8String); + sourceLength = strlen((char *)utf8String); for (i = 0; i < sourceLength; i++) { @@ -1020,7 +1020,7 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string) size_t length = 0; if (string) { - length = CsrStrLen((const char *) string); + length = strlen((const char *)string); } return (u32) length; } diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c index 397345c3ac24..c3db3ee71b89 100644 --- a/drivers/staging/csr/csr_util.c +++ b/drivers/staging/csr/csr_util.c @@ -44,14 +44,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count) EXPORT_SYMBOL_GPL(CsrMemCpy); #endif -#ifndef CSR_USE_STDC_LIB -size_t CsrStrLen(const char *string) -{ - return strlen(string); -} -EXPORT_SYMBOL_GPL(CsrStrLen); -#endif - MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h index 1a911ca2424e..fb5f05e75c25 100644 --- a/drivers/staging/csr/csr_util.h +++ b/drivers/staging/csr/csr_util.h @@ -28,10 +28,8 @@ void CsrUInt16ToHex(u16 number, char *str); /*------------------------------------------------------------------*/ #ifdef CSR_USE_STDC_LIB #define CsrMemCpy memcpy -#define CsrStrLen strlen #else /* !CSR_USE_STDC_LIB */ void *CsrMemCpy(void *dest, const void *src, size_t count); -size_t CsrStrLen(const char *string); #endif /* !CSR_USE_STDC_LIB */ #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index 71a4995821b2..b673c1ca421b 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -324,7 +324,7 @@ size_t CsrWifiNmeApStartReqSizeof(void *msg) break; case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ - bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase?CsrStrLen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase ? strlen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ break; default: break; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c index 377efb12a81d..330eb9523904 100644 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -732,7 +732,7 @@ size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg) } } bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ - bufferSize += (primitive->smeVersions.smeBuild?CsrStrLen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->smeVersions.smeBuild ? strlen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->smeVersions.smeHip */ bufferSize += 1; /* u8 primitive->scheduledInterrupt */ return bufferSize; @@ -1793,7 +1793,7 @@ size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) bufferSize += 4; /* u32 primitive->versions.chipVersion */ bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.routerHip */ return bufferSize; } diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c index 514974b38a8a..27e969caf1dd 100644 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ b/drivers/staging/csr/csr_wifi_sme_serialize.c @@ -9,7 +9,7 @@ *****************************************************************************/ /* Note: this is an auto-generated file. */ - +#include #include "csr_pmem.h" #include "csr_msgconv.h" #include "csr_unicode.h" @@ -5421,9 +5421,9 @@ size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg) bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwarePatch */ bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild?CsrStrLen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.routerHip */ - bufferSize += (primitive->versions.smeBuild?CsrStrLen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->versions.smeBuild ? strlen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ bufferSize += 4; /* u32 primitive->versions.smeHip */ return bufferSize; } @@ -5676,7 +5676,7 @@ size_t CsrWifiSmeErrorIndSizeof(void *msg) size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->errorMessage?CsrStrLen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->errorMessage ? strlen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ return bufferSize; } @@ -5718,7 +5718,7 @@ size_t CsrWifiSmeInfoIndSizeof(void *msg) size_t bufferSize = 2; /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->infoMessage?CsrStrLen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ + bufferSize += (primitive->infoMessage ? strlen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ return bufferSize; } -- 2.39.5