Commit 4bcb20f8 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: csr: remove CsrStrLen()

It's just a wrapper around strlen(), so call that instead.

Also add a few #include <linux/string.h> to fix up the build with this
change.

Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
Cc: Riku Mettälä <riku.mettala@bluegiga.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e4bcecd9
...@@ -50,14 +50,14 @@ EXPORT_SYMBOL_GPL(CsrMemCpyDes); ...@@ -50,14 +50,14 @@ EXPORT_SYMBOL_GPL(CsrMemCpyDes);
void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) void CsrCharStringDes(char **value, u8 *buffer, size_t *offset)
{ {
*value = kstrdup((char *) &buffer[*offset], GFP_KERNEL); *value = kstrdup((char *) &buffer[*offset], GFP_KERNEL);
*offset += CsrStrLen(*value) + 1; *offset += strlen(*value) + 1;
} }
EXPORT_SYMBOL_GPL(CsrCharStringDes); EXPORT_SYMBOL_GPL(CsrCharStringDes);
void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset) void CsrUtf8StringDes(u8 **value, u8 *buffer, size_t *offset)
{ {
*value = (u8 *)kstrdup((char *) &buffer[*offset], GFP_KERNEL); *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) void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset)
...@@ -124,7 +124,7 @@ void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) ...@@ -124,7 +124,7 @@ void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value)
if (value) if (value)
{ {
strcpy(((char *) &buffer[*offset]), value); strcpy(((char *) &buffer[*offset]), value);
*offset += CsrStrLen(value) + 1; *offset += strlen(value) + 1;
} }
else else
{ {
...@@ -176,7 +176,7 @@ u32 CsrCharStringSerLen(const char *str) ...@@ -176,7 +176,7 @@ u32 CsrCharStringSerLen(const char *str)
{ {
if (str) if (str)
{ {
return (u32) (CsrStrLen(str) + sizeof(*str)); return (u32)(strlen(str) + sizeof(*str));
} }
else else
{ {
...@@ -188,7 +188,7 @@ u32 CsrUtf8StringSerLen(const u8 *str) ...@@ -188,7 +188,7 @@ u32 CsrUtf8StringSerLen(const u8 *str)
{ {
if (str) if (str)
{ {
return (u32) (CsrStrLen((char *) str) + sizeof(*str)); return (u32)(strlen((char *) str) + sizeof(*str));
} }
else else
{ {
...@@ -390,7 +390,7 @@ void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) ...@@ -390,7 +390,7 @@ void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length)
size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg) size_t CsrEventCsrUint16CsrCharStringSizeof(void *msg)
{ {
CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) 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) u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg)
...@@ -445,7 +445,7 @@ void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) ...@@ -445,7 +445,7 @@ void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length)
size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg) size_t CsrEventCsrUint32CsrCharStringSizeof(void *msg)
{ {
CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) 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) u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg)
......
...@@ -573,7 +573,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String) ...@@ -573,7 +573,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String)
{ {
return NULL; return NULL;
} }
sourceLength = CsrStrLen((char *) utf8String); sourceLength = strlen((char *)utf8String);
for (i = 0; i < sourceLength; i++) for (i = 0; i < sourceLength; i++)
{ {
...@@ -1020,7 +1020,7 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string) ...@@ -1020,7 +1020,7 @@ u32 CsrUtf8StringLengthInBytes(const u8 *string)
size_t length = 0; size_t length = 0;
if (string) if (string)
{ {
length = CsrStrLen((const char *) string); length = strlen((const char *)string);
} }
return (u32) length; return (u32) length;
} }
......
...@@ -44,14 +44,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count) ...@@ -44,14 +44,6 @@ void *CsrMemCpy(void *dest, const void *src, size_t count)
EXPORT_SYMBOL_GPL(CsrMemCpy); EXPORT_SYMBOL_GPL(CsrMemCpy);
#endif #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_DESCRIPTION("CSR Operating System Kernel Abstraction");
MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); MODULE_AUTHOR("Cambridge Silicon Radio Ltd.");
MODULE_LICENSE("GPL and additional rights"); MODULE_LICENSE("GPL and additional rights");
...@@ -28,10 +28,8 @@ void CsrUInt16ToHex(u16 number, char *str); ...@@ -28,10 +28,8 @@ void CsrUInt16ToHex(u16 number, char *str);
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
#ifdef CSR_USE_STDC_LIB #ifdef CSR_USE_STDC_LIB
#define CsrMemCpy memcpy #define CsrMemCpy memcpy
#define CsrStrLen strlen
#else /* !CSR_USE_STDC_LIB */ #else /* !CSR_USE_STDC_LIB */
void *CsrMemCpy(void *dest, const void *src, size_t count); void *CsrMemCpy(void *dest, const void *src, size_t count);
size_t CsrStrLen(const char *string);
#endif /* !CSR_USE_STDC_LIB */ #endif /* !CSR_USE_STDC_LIB */
#define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m) #define CsrOffsetOf(st, m) ((size_t) & ((st *) 0)->m)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
*****************************************************************************/ *****************************************************************************/
/* Note: this is an auto-generated file. */ /* Note: this is an auto-generated file. */
#include <linux/string.h>
#include "csr_pmem.h" #include "csr_pmem.h"
#include "csr_msgconv.h" #include "csr_msgconv.h"
#include "csr_unicode.h" #include "csr_unicode.h"
...@@ -324,7 +324,7 @@ size_t CsrWifiNmeApStartReqSizeof(void *msg) ...@@ -324,7 +324,7 @@ size_t CsrWifiNmeApStartReqSizeof(void *msg)
break; break;
case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ 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; break;
default: default:
break; break;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
*****************************************************************************/ *****************************************************************************/
/* Note: this is an auto-generated file. */ /* Note: this is an auto-generated file. */
#include <linux/string.h>
#include "csr_pmem.h" #include "csr_pmem.h"
#include "csr_msgconv.h" #include "csr_msgconv.h"
#include "csr_unicode.h" #include "csr_unicode.h"
...@@ -732,7 +732,7 @@ size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg) ...@@ -732,7 +732,7 @@ size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg)
} }
} }
bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ 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 += 4; /* u32 primitive->smeVersions.smeHip */
bufferSize += 1; /* u8 primitive->scheduledInterrupt */ bufferSize += 1; /* u8 primitive->scheduledInterrupt */
return bufferSize; return bufferSize;
...@@ -1793,7 +1793,7 @@ size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) ...@@ -1793,7 +1793,7 @@ size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg)
bufferSize += 4; /* u32 primitive->versions.chipVersion */ bufferSize += 4; /* u32 primitive->versions.chipVersion */
bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwareBuild */
bufferSize += 4; /* u32 primitive->versions.firmwareHip */ 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 += 4; /* u32 primitive->versions.routerHip */
return bufferSize; return bufferSize;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
*****************************************************************************/ *****************************************************************************/
/* Note: this is an auto-generated file. */ /* Note: this is an auto-generated file. */
#include <linux/string.h>
#include "csr_pmem.h" #include "csr_pmem.h"
#include "csr_msgconv.h" #include "csr_msgconv.h"
#include "csr_unicode.h" #include "csr_unicode.h"
...@@ -5421,9 +5421,9 @@ size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg) ...@@ -5421,9 +5421,9 @@ size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg)
bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ bufferSize += 4; /* u32 primitive->versions.firmwareBuild */
bufferSize += 4; /* u32 primitive->versions.firmwarePatch */ bufferSize += 4; /* u32 primitive->versions.firmwarePatch */
bufferSize += 4; /* u32 primitive->versions.firmwareHip */ 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 += 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 */ bufferSize += 4; /* u32 primitive->versions.smeHip */
return bufferSize; return bufferSize;
} }
...@@ -5676,7 +5676,7 @@ size_t CsrWifiSmeErrorIndSizeof(void *msg) ...@@ -5676,7 +5676,7 @@ size_t CsrWifiSmeErrorIndSizeof(void *msg)
size_t bufferSize = 2; size_t bufferSize = 2;
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ /* 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; return bufferSize;
} }
...@@ -5718,7 +5718,7 @@ size_t CsrWifiSmeInfoIndSizeof(void *msg) ...@@ -5718,7 +5718,7 @@ size_t CsrWifiSmeInfoIndSizeof(void *msg)
size_t bufferSize = 2; size_t bufferSize = 2;
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ /* 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; return bufferSize;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment