Staging: w35und: OS_MEMORY_ALLOC wrapper removal
authorPekka Enberg <penberg@cs.helsinki.fi>
Mon, 27 Oct 2008 20:47:12 +0000 (22:47 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Jan 2009 21:51:44 +0000 (13:51 -0800)
This patch removes the rather scary OS_MEMORY_ALLOC macro.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/winbond/adapter.h
drivers/staging/winbond/linux/wb35reg.c
drivers/staging/winbond/linux/wb35rx.c
drivers/staging/winbond/wblinux.c
drivers/staging/winbond/wblinux_f.h

index fc4205de988fccd53259e2f80e114a6dc9ebd4d8..e102dcb150521c7695b77edf98d0e95ca181e45d 100644 (file)
@@ -1,4 +1,3 @@
-#define OS_MEMORY_ALLOC( _V, _S )      WBLINUX_MemoryAlloc( _V, _S )
 #define OS_LINK_STATUS                 (adapter->LinkStatus == OS_CONNECTED)
 #define OS_SET_SHUTDOWN( _A )          _A->shutdown=1
 #define OS_SET_RESUME( _A )            _A->shutdown=0
index 47b5a7d801f6df465339ab61421555e8cb8203d1..56ad504bb06d966dd2cb0bf719d60a8bb1323800 100644 (file)
@@ -25,7 +25,7 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 N
 
        // Trying to use burst write function if use new hardware
        UrbSize = sizeof(struct wb35_reg_queue) + DataSize + sizeof(struct usb_ctrlrequest);
-       OS_MEMORY_ALLOC( (void* *)&reg_queue, UrbSize );
+       reg_queue = kzalloc(UrbSize, GFP_ATOMIC);
        urb = usb_alloc_urb(0, GFP_ATOMIC);
        if( urb && reg_queue ) {
                reg_queue->DIRECT = 2;// burst write register
@@ -174,7 +174,7 @@ Wb35Reg_Write(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue )
 
        // update the register by send urb request------------------------------------
        UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest);
-       OS_MEMORY_ALLOC( (void* *)&reg_queue, UrbSize );
+       reg_queue = kzalloc(UrbSize, GFP_ATOMIC);
        urb = usb_alloc_urb(0, GFP_ATOMIC);
        if (urb && reg_queue) {
                reg_queue->DIRECT = 1;// burst write register
@@ -234,7 +234,7 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
 
        // update the register by send urb request------------------------------------
        UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest);
-       OS_MEMORY_ALLOC((void* *) &reg_queue, UrbSize );
+       reg_queue = kzalloc(UrbSize, GFP_ATOMIC);
        urb = usb_alloc_urb(0, GFP_ATOMIC);
        if (urb && reg_queue) {
                reg_queue->DIRECT = 1;// burst write register
@@ -341,7 +341,7 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo,  u32 * pRegisterValue )
 
        // update the variable by send Urb to read register ------------------------------------
        UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest);
-       OS_MEMORY_ALLOC( (void* *)&reg_queue, UrbSize );
+       reg_queue = kzalloc(UrbSize, GFP_ATOMIC);
        urb = usb_alloc_urb(0, GFP_ATOMIC);
        if( urb && reg_queue )
        {
index 9593a60f8bbb3d27aa1651bd201219504b5d959c..e492fa581a49aaada8d8257557d49ebf245550b3 100644 (file)
@@ -57,7 +57,8 @@ void Wb35Rx(  phw_data_t pHwData )
 
        pWb35Rx->CurrentRxBufferId = RxBufferId;
 
-       if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) {
+       pWb35Rx->pDRx = kzalloc(MAX_USB_RX_BUFFER, GFP_ATOMIC);
+       if (!pWb35Rx->pDRx) {
                printk("w35und: Rx memory alloc failed\n");
                goto error;
        }
index 460f42ad8971b1114a1303c782066e8d6176ac37..a9a605b0feef6ec4be2f011c51e5689070a57b27 100644 (file)
 //============================================================================
 #include "os_common.h"
 
-u32
-WBLINUX_MemoryAlloc(void* *VirtualAddress, u32 Length)
-{
-       *VirtualAddress = kzalloc( Length, GFP_ATOMIC ); //GFP_KERNEL is not suitable
-
-       if (*VirtualAddress == NULL)
-               return 0;
-       return 1;
-}
-
 s32
 EncapAtomicInc(struct wb35_adapter * adapter, void* pAtomic)
 {
index 1d09c659a77d5a28687b897b20fef38c5642089f..f19c0ee73bdbf5d2ae732b912139a11b8c91b7ac 100644 (file)
@@ -3,7 +3,6 @@
 //
 // wblinux_f.h
 //
-u32 WBLINUX_MemoryAlloc(  void* *VirtualAddress,  u32 Length );
 s32 EncapAtomicInc(  struct wb35_adapter *adapter,  void* pAtomic );
 s32 EncapAtomicDec(  struct wb35_adapter *adapter,  void* pAtomic );
 void WBLinux_ReceivePacket(  struct wb35_adapter *adapter,  PRXLAYER1 pRxLayer1 );