staging: csr: remove CsrStrLen()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Jul 2012 21:56:57 +0000 (14:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Jul 2012 21:56:57 +0000 (14:56 -0700)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/csr/csr_serialize_primitive_types.c
drivers/staging/csr/csr_utf16.c
drivers/staging/csr/csr_util.c
drivers/staging/csr/csr_util.h
drivers/staging/csr/csr_wifi_nme_ap_serialize.c
drivers/staging/csr/csr_wifi_router_ctrl_serialize.c
drivers/staging/csr/csr_wifi_sme_serialize.c

index 419528bf1fa5224f422a16b38043934eca091123..1d84938bbb4da64287362ddee3118e2514505129 100644 (file)
@@ -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)
index e678713d16759b0fbef1e7056143d8e26bb86024..edfc4b718db5629a5bd8542f71742f483e61db79 100644 (file)
@@ -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;
 }
index 397345c3ac24541585f4c4290e5fd67890f599ca..c3db3ee71b89546aea1937776f864f5dbd761e3f 100644 (file)
@@ -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");
index 1a911ca2424eafe1a3ffd9baa134354b411bf7b2..fb5f05e75c254c600a3460ac0b195aaf1a3057ee 100644 (file)
@@ -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)
index 71a4995821b28ac768333e06d14343585c6ba5fa..b673c1ca421b135a4284e20041dc9738c378fca4 100644 (file)
@@ -9,7 +9,7 @@
 *****************************************************************************/
 
 /* Note: this is an auto-generated file. */
-
+#include <linux/string.h>
 #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;
index 377efb12a81dffae2f299b56ffc1a27e6d5b949c..330eb95239040fe131394de03f8ca8a6385dd3e9 100644 (file)
@@ -9,7 +9,7 @@
 *****************************************************************************/
 
 /* Note: this is an auto-generated file. */
-
+#include <linux/string.h>
 #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;
 }
index 514974b38a8a2bab237f84a3c9b303bef3c9a24e..27e969caf1dd6de7c962b6886f1c94e0a37d97b0 100644 (file)
@@ -9,7 +9,7 @@
 *****************************************************************************/
 
 /* Note: this is an auto-generated file. */
-
+#include <linux/string.h>
 #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;
 }