[PATCH 13/34] staging: bcm: Remove typedef PCHAR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use normal char *.
Remove unnecessary kmalloc and same type casts.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
 drivers/staging/bcm/Bcmchar.c          |   10 ++++----
 drivers/staging/bcm/InterfaceAdapter.h |    6 ++--
 drivers/staging/bcm/Misc.c             |    6 ++--
 drivers/staging/bcm/Prototypes.h       |    6 ++--
 drivers/staging/bcm/Typedefs.h         |    1 -
 drivers/staging/bcm/nvm.c              |   36 ++++++++++++++++----------------
 6 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index d974f04..58c2a58 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -202,7 +202,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
 		/* Rdms for Swin Idle... */
 	case IOCTL_BCM_REGISTER_READ_PRIVATE: {
 		RDM_BUFFER  sRdmBuffer = {0};
-		PCHAR temp_buff;
+		char *temp_buff;
 		UINT Bufflen;
 		u16 temp_value;
 
@@ -286,7 +286,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
 	case IOCTL_BCM_REGISTER_READ:
 	case IOCTL_BCM_EEPROM_REGISTER_READ: {
 		RDM_BUFFER  sRdmBuffer = {0};
-		PCHAR temp_buff = NULL;
+		char *temp_buff = NULL;
 		UINT uiTempVar = 0;
 		if ((Adapter->IdleMode == TRUE) ||
 		    (Adapter->bShutStatus == TRUE) ||
@@ -1138,7 +1138,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
 	case IOCTL_BCM_BULK_WRM: {
 		PBULKWRM_BUFFER pBulkBuffer;
 		UINT uiTempVar = 0;
-		PCHAR pvBuffer = NULL;
+		char *pvBuffer = NULL;
 
 		if ((Adapter->IdleMode == TRUE) ||
 		    (Adapter->bShutStatus == TRUE) ||
@@ -1192,7 +1192,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
 		}
 
 		if (pBulkBuffer->SwapEndian == FALSE)
-			Status = wrmWithLock(Adapter, (UINT)pBulkBuffer->Register, (PCHAR)pBulkBuffer->Values, IoBuffer.InputLength - 2*sizeof(ULONG));
+			Status = wrmWithLock(Adapter, (UINT)pBulkBuffer->Register, (char *)pBulkBuffer->Values, IoBuffer.InputLength - 2*sizeof(ULONG));
 		else
 			Status = wrmaltWithLock(Adapter, (UINT)pBulkBuffer->Register, (PUINT)pBulkBuffer->Values, IoBuffer.InputLength - 2*sizeof(ULONG));
 
@@ -1486,7 +1486,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
 
 		ReadOffset = sFlash2xRead.offset ;
 		OutPutBuff = IoBuffer.OutputBuffer;
-		pReadBuff = (PCHAR)kzalloc(BuffSize , GFP_KERNEL);
+		pReadBuff = kzalloc(BuffSize, GFP_KERNEL);
 
 		if (pReadBuff == NULL) {
 			pr_info("Memory allocation failed for Flash 2.x Read Structure\n");
diff --git a/drivers/staging/bcm/InterfaceAdapter.h b/drivers/staging/bcm/InterfaceAdapter.h
index 155da34..e48bb59 100644
--- a/drivers/staging/bcm/InterfaceAdapter.h
+++ b/drivers/staging/bcm/InterfaceAdapter.h
@@ -2,7 +2,7 @@
 #define _INTERFACE_ADAPTER_H
 
 typedef struct _BULK_ENDP_IN {
-	PCHAR		    bulk_in_buffer;
+	char *bulk_in_buffer;
 	size_t          bulk_in_size;
 	UCHAR			bulk_in_endpointAddr;
 	UINT bulk_in_pipe;
@@ -19,7 +19,7 @@ typedef struct _BULK_ENDP_OUT {
 }BULK_ENDP_OUT, *PBULK_ENDP_OUT;
 
 typedef struct _INTR_ENDP_IN {
-	PCHAR		    int_in_buffer;
+	char *int_in_buffer;
 	size_t          int_in_size;
 	UCHAR			int_in_endpointAddr;
 	UCHAR			int_in_interval;
@@ -27,7 +27,7 @@ typedef struct _INTR_ENDP_IN {
 }INTR_ENDP_IN, *PINTR_ENDP_IN;
 
 typedef struct _INTR_ENDP_OUT {
-	PCHAR		    int_out_buffer;
+	char *int_out_buffer;
 	size_t          int_out_size;
 	UCHAR			int_out_endpointAddr;
 	UCHAR			int_out_interval;
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c
index d671d55..886aef1 100644
--- a/drivers/staging/bcm/Misc.c
+++ b/drivers/staging/bcm/Misc.c
@@ -1452,13 +1452,13 @@ static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount)
 #define CACHE_ADDRESS_MASK 0x80000000
 #define UNCACHE_ADDRESS_MASK 0xa0000000
 
-int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
+int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, char *pucBuff, size_t sSize)
 {
 	return Adapter->interface_rdm(Adapter->pvInterfaceAdapter,
 				      uiAddress, pucBuff, sSize);
 }
 
-int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
+int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, char *pucBuff, size_t sSize)
 {
 	int iRetVal;
 
@@ -1483,7 +1483,7 @@ int rdmalt(PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t size)
 	return uiRetVal;
 }
 
-int wrmWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize)
+int wrmWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, char *pucBuff, size_t sSize)
 {
 	int status = STATUS_SUCCESS;
 	down(&Adapter->rdmwrmsync);
diff --git a/drivers/staging/bcm/Prototypes.h b/drivers/staging/bcm/Prototypes.h
index a1eeb66..05e8087 100644
--- a/drivers/staging/bcm/Prototypes.h
+++ b/drivers/staging/bcm/Prototypes.h
@@ -75,9 +75,9 @@ int register_control_device_interface(PMINI_ADAPTER ps_adapter);
 
 void DumpPackInfo(PMINI_ADAPTER Adapter);
 
-int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t size);
+int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, char *pucBuff, size_t size);
 
-int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t size);
+int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, char *pucBuff, size_t size);
 
 int wrmalt (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t sSize);
 
@@ -206,7 +206,7 @@ VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter, PUINT puiBuffer);
 int wrmaltWithLock (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t sSize);
 int rdmaltWithLock (PMINI_ADAPTER Adapter, UINT uiAddress, PUINT pucBuff, size_t sSize);
 
-int wrmWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t size);
+int wrmWithLock(PMINI_ADAPTER Adapter, UINT uiAddress, char *pucBuff, size_t size);
 int buffDnldVerify(PMINI_ADAPTER Adapter, unsigned char *mappedbuffer, unsigned int u32FirmwareLength,
 		   unsigned long u32StartingAddress);
 
diff --git a/drivers/staging/bcm/Typedefs.h b/drivers/staging/bcm/Typedefs.h
index 2cbb1f3..3756868 100644
--- a/drivers/staging/bcm/Typedefs.h
+++ b/drivers/staging/bcm/Typedefs.h
@@ -22,7 +22,6 @@ typedef unsigned int B_UINT32;
 typedef unsigned long ULONG;
 typedef unsigned long DWORD;
 
-typedef char* PCHAR;
 typedef short* PSHORT;
 typedef long* PLONG;
 typedef void* PVOID;
diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c
index 20dc861..4fdba1c 100644
--- a/drivers/staging/bcm/nvm.c
+++ b/drivers/staging/bcm/nvm.c
@@ -439,7 +439,7 @@ static int BeceemFlashBulkRead(
 		uiBytesToRead = MAX_RW_SIZE - (uiOffset%MAX_RW_SIZE);
 		uiBytesToRead = MIN(uiNumBytes, uiBytesToRead);
 
-		bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer+uiIndex, uiBytesToRead);
+		bytes = rdm(Adapter, uiPartOffset, (char *)pBuffer+uiIndex, uiBytesToRead);
 		if (bytes < 0) {
 			Status = bytes;
 			Adapter->SelectedChip = RESET_CHIP_SELECT;
@@ -457,7 +457,7 @@ static int BeceemFlashBulkRead(
 
 		uiBytesToRead = MIN(uiNumBytes, MAX_RW_SIZE);
 
-		bytes = rdm(Adapter, uiPartOffset, (PCHAR)pBuffer+uiIndex, uiBytesToRead);
+		bytes = rdm(Adapter, uiPartOffset, (char *)pBuffer+uiIndex, uiBytesToRead);
 		if (bytes < 0) {
 			Status = bytes;
 			break;
@@ -656,7 +656,7 @@ static int flashByteWrite(
 		pr_info("Write enable in FLASH_SPI_CMDQ_REG register fails\n");
 		return STATUS_FAILURE;
 	}
-	if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0 ) {
+	if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (char *)&ulData, 4) < 0 ) {
 		pr_info("DATA Write on FLASH_SPI_WRITEQ_REG fails\n");
 		return STATUS_FAILURE;
 	}
@@ -742,7 +742,7 @@ static int flashWrite(
 		pr_info("Write Enable of FLASH_SPI_CMDQ_REG fails\n");
 		return STATUS_FAILURE;
 	}
-	if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) {
+	if (wrm(Adapter, uiOffset, (char *)pData, MAX_RW_SIZE) < 0) {
 		pr_info("Data write fails...\n");
 		return STATUS_FAILURE;
 	}
@@ -820,7 +820,7 @@ static int flashByteWriteStatus(
 		pr_info("Write enable in FLASH_SPI_CMDQ_REG register fails\n");
 		return STATUS_SUCCESS;
 	}
-	if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) {
+	if (wrm(Adapter, FLASH_SPI_WRITEQ_REG, (char *)&ulData, 4) < 0) {
 		pr_info("DATA Write on FLASH_SPI_WRITEQ_REG fails\n");
 		return STATUS_FAILURE;
 	}
@@ -899,7 +899,7 @@ static int flashWriteStatus(
 		pr_info("Write Enable of FLASH_SPI_CMDQ_REG fails\n");
 		return STATUS_FAILURE;
 	}
-	if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) {
+	if (wrm(Adapter, uiOffset, (char *)pData, MAX_RW_SIZE) < 0) {
 		pr_info("Data write fails...\n");
 		return STATUS_FAILURE;
 	}
@@ -1076,7 +1076,7 @@ static int BeceemFlashBulkWrite(
 	UINT uiNumBytes,
 	BOOLEAN bVerify)
 {
-	PCHAR  pTempBuff			= NULL;
+	char *pTempBuff = NULL;
 	PUCHAR pcBuffer             = (PUCHAR)pBuffer;
 	UINT  uiIndex				= 0;
 	UINT  uiOffsetFromSectStart = 0;
@@ -1290,7 +1290,7 @@ static int BeceemFlashBulkWriteStatus(
 	UINT uiNumBytes,
 	BOOLEAN bVerify)
 {
-	PCHAR  pTempBuff			= NULL;
+	char *pTempBuff = NULL;
 	PUCHAR pcBuffer             = (PUCHAR)pBuffer;
 	UINT  uiIndex				= 0;
 	UINT  uiOffsetFromSectStart = 0;
@@ -1446,7 +1446,7 @@ BeceemFlashBulkWriteStatus_EXIT:
 
 int PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter)
 {
-	PCHAR pBuff = kmalloc(BUFFER_4K, GFP_KERNEL);
+	char *pBuff = kmalloc(BUFFER_4K, GFP_KERNEL);
 	UINT uiEepromSize = 0;
 	UINT uiIndex = 0;
 	UINT uiBytesToCopy = 0;
@@ -1478,7 +1478,7 @@ int PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter)
 			Status = -1;
 			break;
 		}
-		wrm(Adapter, uiMemoryLoc, (PCHAR)(((PULONG)pBuff)+uiIndex), uiBytesToCopy);
+		wrm(Adapter, uiMemoryLoc, (char *)(((PULONG)pBuff)+uiIndex), uiBytesToCopy);
 		uiMemoryLoc += uiBytesToCopy;
 		uiEepromSize -= uiBytesToCopy;
 		uiCalStartAddr += uiBytesToCopy;
@@ -1510,7 +1510,7 @@ int PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter)
 
 int PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter)
 {
-	PCHAR pBuff, pPtr;
+	char *pBuff, *pPtr;
 	UINT uiEepromSize = 0;
 	UINT uiBytesToCopy = 0;
 	//UINT uiIndex = 0;
@@ -1555,7 +1555,7 @@ int PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter)
 	uiBytesToCopy = MIN(BUFFER_4K, uiEepromSize);
 
 	while (uiBytesToCopy) {
-		Status = wrm(Adapter, uiMemoryLoc, (PCHAR)pPtr, uiBytesToCopy);
+		Status = wrm(Adapter, uiMemoryLoc, pPtr, uiBytesToCopy);
 		if (Status) {
 			pr_info("wrm failed with status :%d\n", Status);
 			break;
@@ -2013,11 +2013,11 @@ int BeceemNVMWrite(
 			uiMemoryLoc += (uiOffset - EEPROM_CALPARAM_START);
 			while (uiNumBytes) {
 				if (uiNumBytes > BUFFER_4K) {
-					wrm(Adapter, (uiMemoryLoc+uiIndex), (PCHAR)(pBuffer+(uiIndex/4)), BUFFER_4K);
+					wrm(Adapter, (uiMemoryLoc+uiIndex), (char *)(pBuffer+(uiIndex/4)), BUFFER_4K);
 					uiNumBytes -= BUFFER_4K;
 					uiIndex += BUFFER_4K;
 				} else {
-					wrm(Adapter, uiMemoryLoc+uiIndex, (PCHAR)(pBuffer+(uiIndex/4)), uiNumBytes);
+					wrm(Adapter, uiMemoryLoc+uiIndex, (char *)(pBuffer+(uiIndex/4)), uiNumBytes);
 					uiNumBytes = 0;
 					break;
 				}
@@ -2031,11 +2031,11 @@ int BeceemNVMWrite(
 				uiOffset += (EEPROM_CALPARAM_START - uiOffset);
 				while (uiNumBytes) {
 					if (uiNumBytes > BUFFER_4K) {
-						wrm(Adapter, uiMemoryLoc+uiIndex, (PCHAR )&pcBuffer[ulBytesTobeSkipped+uiIndex], BUFFER_4K);
+						wrm(Adapter, uiMemoryLoc+uiIndex, (char *)&pcBuffer[ulBytesTobeSkipped+uiIndex], BUFFER_4K);
 						uiNumBytes -= BUFFER_4K;
 						uiIndex += BUFFER_4K;
 					} else {
-						wrm(Adapter, uiMemoryLoc+uiIndex, (PCHAR)&pcBuffer[ulBytesTobeSkipped+uiIndex], uiNumBytes);
+						wrm(Adapter, uiMemoryLoc+uiIndex, (char *)&pcBuffer[ulBytesTobeSkipped+uiIndex], uiNumBytes);
 						uiNumBytes = 0;
 						break;
 					}
@@ -3803,7 +3803,7 @@ int BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV
 int BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut)
 {
 
-	PCHAR Buff = NULL;
+	char *Buff = NULL;
 	FLASH2X_SECTION_VAL eISOReadPart = 0, eISOWritePart = 0;
 	UINT uiReadOffsetWithinPart = 0, uiWriteOffsetWithinPart = 0;
 	UINT uiTotalDataToCopy = 0;
@@ -4376,7 +4376,7 @@ int	BcmCopySection(PMINI_ADAPTER Adapter,
 	else
 		BuffSize = numOfBytes ;
 
-	pBuff = (PCHAR)kzalloc(BuffSize, GFP_KERNEL);
+	pBuff = kzalloc(BuffSize, GFP_KERNEL);
 	if (pBuff == NULL) {
 		pr_info("Memory allocation failed..\n");
 		return -ENOMEM;
-- 
1.7.8.111.gad25c.dirty

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux