lkml.org 
[lkml]   [2008]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] w35und: purb typedef removal
> From: Pekka Enberg <penberg@cs.helsinki.fi>
>
> This patch removes the struct urb pointer typedef from the driver code and
> fixes up variable names that use the typedef while we're at it.
>
> Cc: Pavel Machek <pavel@suse.cz>
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>

ACK and thanks...
Pavel
> ---
> drivers/staging/winbond/linux/common.h | 4 --
> drivers/staging/winbond/linux/wb35reg.c | 74 ++++++++++++++--------------
> drivers/staging/winbond/linux/wb35reg_f.h | 2 +-
> drivers/staging/winbond/linux/wb35reg_s.h | 2 +-
> drivers/staging/winbond/linux/wb35rx.c | 14 +++---
> drivers/staging/winbond/linux/wb35rx_f.h | 2 +-
> drivers/staging/winbond/linux/wb35tx_f.h | 4 +-
> drivers/staging/winbond/linux/wbusb_s.h | 2 +-
> 8 files changed, 50 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/staging/winbond/linux/common.h b/drivers/staging/winbond/linux/common.h
> index 712a86c..64bd1c7 100644
> --- a/drivers/staging/winbond/linux/common.h
> +++ b/drivers/staging/winbond/linux/common.h
> @@ -69,10 +69,6 @@
> #define BIT(x) (1 << (x))
> #endif
>
> -typedef struct urb * PURB;
> -
> -
> -
> //==================================================================================================
> // Common function definition
> //==================================================================================================
> diff --git a/drivers/staging/winbond/linux/wb35reg.c b/drivers/staging/winbond/linux/wb35reg.c
> index ebb6db5..4383a61 100644
> --- a/drivers/staging/winbond/linux/wb35reg.c
> +++ b/drivers/staging/winbond/linux/wb35reg.c
> @@ -13,7 +13,7 @@ unsigned char
> Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 NumberOfData, u8 Flag)
> {
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> - PURB pUrb = NULL;
> + struct urb *urb = NULL;
> PREG_QUEUE pRegQueue = NULL;
> u16 UrbSize;
> struct usb_ctrlrequest *dr;
> @@ -26,8 +26,8 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 N
> // Trying to use burst write function if use new hardware
> UrbSize = sizeof(REG_QUEUE) + DataSize + sizeof(struct usb_ctrlrequest);
> OS_MEMORY_ALLOC( (void* *)&pRegQueue, UrbSize );
> - pUrb = wb_usb_alloc_urb(0);
> - if( pUrb && pRegQueue ) {
> + urb = wb_usb_alloc_urb(0);
> + if( urb && pRegQueue ) {
> pRegQueue->DIRECT = 2;// burst write register
> pRegQueue->INDEX = RegisterNo;
> pRegQueue->pBuffer = (u32 *)((u8 *)pRegQueue + sizeof(REG_QUEUE));
> @@ -44,7 +44,7 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 N
> dr->wLength = cpu_to_le16( DataSize );
> pRegQueue->Next = NULL;
> pRegQueue->pUsbReq = dr;
> - pRegQueue->pUrb = pUrb;
> + pRegQueue->urb = urb;
>
> spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
> if (pWb35Reg->pRegFirst == NULL)
> @@ -60,8 +60,8 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 N
>
> return TRUE;
> } else {
> - if (pUrb)
> - usb_free_urb(pUrb);
> + if (urb)
> + usb_free_urb(urb);
> if (pRegQueue)
> kfree(pRegQueue);
> return FALSE;
> @@ -163,7 +163,7 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue )
> {
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> struct usb_ctrlrequest *dr;
> - PURB pUrb = NULL;
> + struct urb *urb = NULL;
> PREG_QUEUE pRegQueue = NULL;
> u16 UrbSize;
>
> @@ -175,8 +175,8 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue )
> // update the register by send urb request------------------------------------
> UrbSize = sizeof(REG_QUEUE) + sizeof(struct usb_ctrlrequest);
> OS_MEMORY_ALLOC( (void* *)&pRegQueue, UrbSize );
> - pUrb = wb_usb_alloc_urb(0);
> - if (pUrb && pRegQueue) {
> + urb = wb_usb_alloc_urb(0);
> + if (urb && pRegQueue) {
> pRegQueue->DIRECT = 1;// burst write register
> pRegQueue->INDEX = RegisterNo;
> pRegQueue->VALUE = cpu_to_le32(RegisterValue);
> @@ -191,7 +191,7 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue )
> // Enter the sending queue
> pRegQueue->Next = NULL;
> pRegQueue->pUsbReq = dr;
> - pRegQueue->pUrb = pUrb;
> + pRegQueue->urb = urb;
>
> spin_lock_irq(&pWb35Reg->EP0VM_spin_lock );
> if (pWb35Reg->pRegFirst == NULL)
> @@ -207,8 +207,8 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue )
>
> return TRUE;
> } else {
> - if (pUrb)
> - usb_free_urb(pUrb);
> + if (urb)
> + usb_free_urb(urb);
> kfree(pRegQueue);
> return FALSE;
> }
> @@ -224,7 +224,7 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
> {
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> struct usb_ctrlrequest *dr;
> - PURB pUrb = NULL;
> + struct urb *urb = NULL;
> PREG_QUEUE pRegQueue = NULL;
> u16 UrbSize;
>
> @@ -235,8 +235,8 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
> // update the register by send urb request------------------------------------
> UrbSize = sizeof(REG_QUEUE) + sizeof(struct usb_ctrlrequest);
> OS_MEMORY_ALLOC((void* *) &pRegQueue, UrbSize );
> - pUrb = wb_usb_alloc_urb(0);
> - if (pUrb && pRegQueue) {
> + urb = wb_usb_alloc_urb(0);
> + if (urb && pRegQueue) {
> pRegQueue->DIRECT = 1;// burst write register
> pRegQueue->INDEX = RegisterNo;
> pRegQueue->VALUE = cpu_to_le32(RegisterValue);
> @@ -253,7 +253,7 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
> // Enter the sending queue
> pRegQueue->Next = NULL;
> pRegQueue->pUsbReq = dr;
> - pRegQueue->pUrb = pUrb;
> + pRegQueue->urb = urb;
> spin_lock_irq (&pWb35Reg->EP0VM_spin_lock );
> if( pWb35Reg->pRegFirst == NULL )
> pWb35Reg->pRegFirst = pRegQueue;
> @@ -267,8 +267,8 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
> Wb35Reg_EP0VM_start(pHwData);
> return TRUE;
> } else {
> - if (pUrb)
> - usb_free_urb(pUrb);
> + if (urb)
> + usb_free_urb(urb);
> kfree(pRegQueue);
> return FALSE;
> }
> @@ -331,7 +331,7 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue )
> {
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> struct usb_ctrlrequest * dr;
> - PURB pUrb;
> + struct urb *urb;
> PREG_QUEUE pRegQueue;
> u16 UrbSize;
>
> @@ -342,8 +342,8 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue )
> // update the variable by send Urb to read register ------------------------------------
> UrbSize = sizeof(REG_QUEUE) + sizeof(struct usb_ctrlrequest);
> OS_MEMORY_ALLOC( (void* *)&pRegQueue, UrbSize );
> - pUrb = wb_usb_alloc_urb(0);
> - if( pUrb && pRegQueue )
> + urb = wb_usb_alloc_urb(0);
> + if( urb && pRegQueue )
> {
> pRegQueue->DIRECT = 0;// read register
> pRegQueue->INDEX = RegisterNo;
> @@ -358,7 +358,7 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue )
> // Enter the sending queue
> pRegQueue->Next = NULL;
> pRegQueue->pUsbReq = dr;
> - pRegQueue->pUrb = pUrb;
> + pRegQueue->urb = urb;
> spin_lock_irq ( &pWb35Reg->EP0VM_spin_lock );
> if( pWb35Reg->pRegFirst == NULL )
> pWb35Reg->pRegFirst = pRegQueue;
> @@ -373,8 +373,8 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue )
>
> return TRUE;
> } else {
> - if (pUrb)
> - usb_free_urb( pUrb );
> + if (urb)
> + usb_free_urb( urb );
> kfree(pRegQueue);
> return FALSE;
> }
> @@ -397,7 +397,7 @@ void
> Wb35Reg_EP0VM(phw_data_t pHwData )
> {
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> - PURB pUrb;
> + struct urb *urb;
> struct usb_ctrlrequest *dr;
> u32 * pBuffer;
> int ret = -1;
> @@ -419,22 +419,22 @@ Wb35Reg_EP0VM(phw_data_t pHwData )
> goto cleanup;
>
> // Get an Urb, send it
> - pUrb = (PURB)pRegQueue->pUrb;
> + urb = (struct urb *)pRegQueue->urb;
>
> dr = pRegQueue->pUsbReq;
> - pUrb = pRegQueue->pUrb;
> + urb = pRegQueue->urb;
> pBuffer = pRegQueue->pBuffer;
> if (pRegQueue->DIRECT == 1) // output
> pBuffer = &pRegQueue->VALUE;
>
> - usb_fill_control_urb( pUrb, pHwData->WbUsb.udev,
> + usb_fill_control_urb( urb, pHwData->WbUsb.udev,
> REG_DIRECTION(pHwData->WbUsb.udev,pRegQueue),
> (u8 *)dr,pBuffer,cpu_to_le16(dr->wLength),
> Wb35Reg_EP0VM_complete, (void*)pHwData);
>
> pWb35Reg->EP0vm_state = VM_RUNNING;
>
> - ret = wb_usb_submit_urb( pUrb );
> + ret = wb_usb_submit_urb( urb );
>
> if (ret < 0) {
> #ifdef _PE_REG_DUMP_
> @@ -452,16 +452,16 @@ Wb35Reg_EP0VM(phw_data_t pHwData )
>
>
> void
> -Wb35Reg_EP0VM_complete(PURB pUrb)
> +Wb35Reg_EP0VM_complete(struct urb *urb)
> {
> - phw_data_t pHwData = (phw_data_t)pUrb->context;
> + phw_data_t pHwData = (phw_data_t)urb->context;
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> PREG_QUEUE pRegQueue;
>
>
> // Variable setting
> pWb35Reg->EP0vm_state = VM_COMPLETED;
> - pWb35Reg->EP0VM_status = pUrb->status;
> + pWb35Reg->EP0VM_status = urb->status;
>
> if (pHwData->SurpriseRemove) { // Let WbWlanHalt to handle surprise remove
> pWb35Reg->EP0vm_state = VM_STOP;
> @@ -492,7 +492,7 @@ Wb35Reg_EP0VM_complete(PURB pUrb)
> kfree(pRegQueue);
> }
>
> - usb_free_urb(pUrb);
> + usb_free_urb(urb);
> }
>
>
> @@ -500,7 +500,7 @@ void
> Wb35Reg_destroy(phw_data_t pHwData)
> {
> PWB35REG pWb35Reg = &pHwData->Wb35Reg;
> - PURB pUrb;
> + struct urb *urb;
> PREG_QUEUE pRegQueue;
>
>
> @@ -520,10 +520,10 @@ Wb35Reg_destroy(phw_data_t pHwData)
> pWb35Reg->pRegLast = NULL;
> pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next;
>
> - pUrb = pRegQueue->pUrb;
> + urb = pRegQueue->urb;
> spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
> - if (pUrb) {
> - usb_free_urb(pUrb);
> + if (urb) {
> + usb_free_urb(urb);
> kfree(pRegQueue);
> } else {
> #ifdef _PE_REG_DUMP_
> diff --git a/drivers/staging/winbond/linux/wb35reg_f.h b/drivers/staging/winbond/linux/wb35reg_f.h
> index 3006cfe..fc94091 100644
> --- a/drivers/staging/winbond/linux/wb35reg_f.h
> +++ b/drivers/staging/winbond/linux/wb35reg_f.h
> @@ -42,7 +42,7 @@ unsigned char Wb35Reg_BurstWrite( phw_data_t pHwData, u16 RegisterNo, u32 * p
>
> void Wb35Reg_EP0VM( phw_data_t pHwData );
> void Wb35Reg_EP0VM_start( phw_data_t pHwData );
> -void Wb35Reg_EP0VM_complete( PURB pUrb );
> +void Wb35Reg_EP0VM_complete(struct urb *urb);
>
> u32 BitReverse( u32 dwData, u32 DataLength);
>
> diff --git a/drivers/staging/winbond/linux/wb35reg_s.h b/drivers/staging/winbond/linux/wb35reg_s.h
> index 8b35b93..c633b92 100644
> --- a/drivers/staging/winbond/linux/wb35reg_s.h
> +++ b/drivers/staging/winbond/linux/wb35reg_s.h
> @@ -69,7 +69,7 @@
>
> typedef struct _REG_QUEUE
> {
> - struct urb *pUrb;
> + struct urb *urb;
> void* pUsbReq;
> void* Next;
> union
> diff --git a/drivers/staging/winbond/linux/wb35rx.c b/drivers/staging/winbond/linux/wb35rx.c
> index b4b9f5f..f286019 100644
> --- a/drivers/staging/winbond/linux/wb35rx.c
> +++ b/drivers/staging/winbond/linux/wb35rx.c
> @@ -28,7 +28,7 @@ void Wb35Rx( phw_data_t pHwData )
> {
> PWB35RX pWb35Rx = &pHwData->Wb35Rx;
> u8 * pRxBufferAddress;
> - PURB pUrb = (PURB)pWb35Rx->RxUrb;
> + struct urb *urb = pWb35Rx->RxUrb;
> int retv;
> u32 RxBufferId;
>
> @@ -63,14 +63,14 @@ void Wb35Rx( phw_data_t pHwData )
> }
> pRxBufferAddress = pWb35Rx->pDRx;
>
> - usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
> + usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
> usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
> pRxBufferAddress, MAX_USB_RX_BUFFER,
> Wb35Rx_Complete, pHwData);
>
> pWb35Rx->EP3vm_state = VM_RUNNING;
>
> - retv = wb_usb_submit_urb(pUrb);
> + retv = wb_usb_submit_urb(urb);
>
> if (retv != 0) {
> printk("Rx URB sending error\n");
> @@ -84,9 +84,9 @@ error:
> OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter );
> }
>
> -void Wb35Rx_Complete(PURB pUrb)
> +void Wb35Rx_Complete(struct urb *urb)
> {
> - phw_data_t pHwData = pUrb->context;
> + phw_data_t pHwData = urb->context;
> PWB35RX pWb35Rx = &pHwData->Wb35Rx;
> u8 * pRxBufferAddress;
> u32 SizeCheck;
> @@ -96,12 +96,12 @@ void Wb35Rx_Complete(PURB pUrb)
>
> // Variable setting
> pWb35Rx->EP3vm_state = VM_COMPLETED;
> - pWb35Rx->EP3VM_status = pUrb->status;//Store the last result of Irp
> + pWb35Rx->EP3VM_status = urb->status;//Store the last result of Irp
>
> RxBufferId = pWb35Rx->CurrentRxBufferId;
>
> pRxBufferAddress = pWb35Rx->pDRx;
> - BulkLength = (u16)pUrb->actual_length;
> + BulkLength = (u16)urb->actual_length;
>
> // The IRP is completed
> pWb35Rx->EP3vm_state = VM_COMPLETED;
> diff --git a/drivers/staging/winbond/linux/wb35rx_f.h b/drivers/staging/winbond/linux/wb35rx_f.h
> index daa3e73..565280e 100644
> --- a/drivers/staging/winbond/linux/wb35rx_f.h
> +++ b/drivers/staging/winbond/linux/wb35rx_f.h
> @@ -10,7 +10,7 @@ void Wb35Rx_adjust( PDESCRIPTOR pRxDes );
> void Wb35Rx_start( phw_data_t pHwData );
>
> void Wb35Rx( phw_data_t pHwData );
> -void Wb35Rx_Complete( PURB pUrb );
> +void Wb35Rx_Complete(struct urb *urb);
>
>
>
> diff --git a/drivers/staging/winbond/linux/wb35tx_f.h b/drivers/staging/winbond/linux/wb35tx_f.h
> index 107b129..1815c10 100644
> --- a/drivers/staging/winbond/linux/wb35tx_f.h
> +++ b/drivers/staging/winbond/linux/wb35tx_f.h
> @@ -7,12 +7,12 @@ unsigned char Wb35Tx_get_tx_buffer( phw_data_t pHwData, u8 **pBuffer );
>
> void Wb35Tx_EP2VM( phw_data_t pHwData );
> void Wb35Tx_EP2VM_start( phw_data_t pHwData );
> -void Wb35Tx_EP2VM_complete( PURB purb );
> +void Wb35Tx_EP2VM_complete(struct urb *urb);
>
> void Wb35Tx_start( phw_data_t pHwData );
> void Wb35Tx_stop( phw_data_t pHwData );
> void Wb35Tx( phw_data_t pHwData );
> -void Wb35Tx_complete( PURB purb );
> +void Wb35Tx_complete(struct urb *urb);
> void Wb35Tx_reset_descriptor( phw_data_t pHwData );
>
> void Wb35Tx_CurrentTime( phw_data_t pHwData, u32 TimeCount );
> diff --git a/drivers/staging/winbond/linux/wbusb_s.h b/drivers/staging/winbond/linux/wbusb_s.h
> index d5c1d53..562ddc0 100644
> --- a/drivers/staging/winbond/linux/wbusb_s.h
> +++ b/drivers/staging/winbond/linux/wbusb_s.h
> @@ -23,7 +23,7 @@
> typedef struct _RW_CONTEXT
> {
> void* pHwData;
> - PURB pUrb;
> + struct urb *urb;
> void* pCallBackFunctionParameter;
> } RW_CONTEXT, *PRW_CONTEXT;
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


\
 
 \ /
  Last update: 2008-10-22 12:43    [W:0.045 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site