diff options
Diffstat (limited to 'drivers/staging/winbond')
-rw-r--r-- | drivers/staging/winbond/phy_calibration.c | 2 | ||||
-rw-r--r-- | drivers/staging/winbond/reg.c | 25 | ||||
-rw-r--r-- | drivers/staging/winbond/wb35reg.c | 265 | ||||
-rw-r--r-- | drivers/staging/winbond/wb35rx.c | 3 |
4 files changed, 150 insertions, 145 deletions
diff --git a/drivers/staging/winbond/phy_calibration.c b/drivers/staging/winbond/phy_calibration.c index cabae34..cfbfbbb 100644 --- a/drivers/staging/winbond/phy_calibration.c +++ b/drivers/staging/winbond/phy_calibration.c @@ -296,7 +296,7 @@ void _sin_cos(s32 angle, s32 *sin, s32 *cos) } } -static unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue) +static unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 *pValue) { if (number < 0x1000) number += 0x1000; diff --git a/drivers/staging/winbond/reg.c b/drivers/staging/winbond/reg.c index 5ecf9a1..75b7752 100644 --- a/drivers/staging/winbond/reg.c +++ b/drivers/staging/winbond/reg.c @@ -920,20 +920,20 @@ void Uxx_power_on_procedure(struct hw_data *pHwData) Wb35Reg_WriteSync(pHwData, 0x03f8, 0x7ff); } -void Set_ChanIndep_RfData_al7230_24(struct hw_data *pHwData, u32 *pltmp , char number) +static void Set_ChanIndep_RfData_al7230_24(struct hw_data *pHwData, u32 *pltmp, + char number) { u8 i; - for (i = 0; i < number; i++) { pHwData->phy_para[i] = al7230_rf_data_24[i]; pltmp[i] = (1 << 31) | (0 << 30) | (24 << 24) | (al7230_rf_data_24[i] & 0xffffff); } } -void Set_ChanIndep_RfData_al7230_50(struct hw_data *pHwData, u32 *pltmp, char number) +static void Set_ChanIndep_RfData_al7230_50(struct hw_data *pHwData, u32 *pltmp, + char number) { u8 i; - for (i = 0; i < number; i++) { pHwData->phy_para[i] = al7230_rf_data_50[i]; pltmp[i] = (1 << 31) | (0 << 30) | (24 << 24) | (al7230_rf_data_50[i] & 0xffffff); @@ -1263,7 +1263,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) } } -void BBProcessor_AL7230_2400(struct hw_data *pHwData) +static void BBProcessor_AL7230_2400(struct hw_data *pHwData) { struct wb35_reg *reg = &pHwData->reg; u32 pltmp[12]; @@ -1304,7 +1304,7 @@ void BBProcessor_AL7230_2400(struct hw_data *pHwData) Wb35Reg_BurstWrite(pHwData, 0x1030, pltmp, 12, AUTO_INCREMENT); } -void BBProcessor_AL7230_5000(struct hw_data *pHwData) +static void BBProcessor_AL7230_5000(struct hw_data *pHwData) { struct wb35_reg *reg = &pHwData->reg; u32 pltmp[12]; @@ -1620,22 +1620,24 @@ void BBProcessor_initial(struct hw_data *pHwData) reg->SQ3_filter[i] = 0x2f; /* half of Bit 0 ~ 6 */ } -void set_tx_power_per_channel_max2829(struct hw_data *pHwData, struct chan_info Channel) +static inline void set_tx_power_per_channel_max2829(struct hw_data *pHwData, + struct chan_info Channel) { RFSynthesizer_SetPowerIndex(pHwData, 100); } -void set_tx_power_per_channel_al2230(struct hw_data *pHwData, struct chan_info Channel) +static void set_tx_power_per_channel_al2230(struct hw_data *pHwData, + struct chan_info Channel) { u8 index = 100; - if (pHwData->TxVgaFor24[Channel.ChanNo - 1] != 0xff) index = pHwData->TxVgaFor24[Channel.ChanNo - 1]; RFSynthesizer_SetPowerIndex(pHwData, index); } -void set_tx_power_per_channel_al7230(struct hw_data *pHwData, struct chan_info Channel) +static void set_tx_power_per_channel_al7230(struct hw_data *pHwData, + struct chan_info Channel) { u8 i, index = 100; @@ -1658,7 +1660,8 @@ void set_tx_power_per_channel_al7230(struct hw_data *pHwData, struct chan_info RFSynthesizer_SetPowerIndex(pHwData, index); } -void set_tx_power_per_channel_wb242(struct hw_data *pHwData, struct chan_info Channel) +static void set_tx_power_per_channel_wb242(struct hw_data *pHwData, + struct chan_info Channel) { u8 index = 100; diff --git a/drivers/staging/winbond/wb35reg.c b/drivers/staging/winbond/wb35reg.c index 1bff7d1..9be1b3b 100644 --- a/drivers/staging/winbond/wb35reg.c +++ b/drivers/staging/winbond/wb35reg.c @@ -30,46 +30,46 @@ unsigned char Wb35Reg_BurstWrite(struct hw_data *pHwData, u16 RegisterNo, u32 *p /* Trying to use burst write function if use new hardware */ UrbSize = sizeof(struct wb35_reg_queue) + DataSize + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); + if (reg_queue == NULL) + return false; + urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 2; /* burst write register */ - reg_queue->INDEX = RegisterNo; - reg_queue->pBuffer = (u32 *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - memcpy(reg_queue->pBuffer, pRegisterData, DataSize); - /* the function for reversing register data from little endian to big endian */ - for (i = 0; i < NumberOfData ; i++) - reg_queue->pBuffer[i] = cpu_to_le32(reg_queue->pBuffer[i]); - - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue) + DataSize); - dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; - dr->bRequest = 0x04; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(Flag); /* 0: Register number auto-increment, 1: No auto increment */ - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(DataSize); - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; + if (urb == NULL) { + kfree(reg_queue); + return false; + } - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; + reg_queue->DIRECT = 2; /* burst write register */ + reg_queue->INDEX = RegisterNo; + reg_queue->pBuffer = (u32 *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + memcpy(reg_queue->pBuffer, pRegisterData, DataSize); + /* the function for reversing register data from little endian to big endian */ + for (i = 0; i < NumberOfData ; i++) + reg_queue->pBuffer[i] = cpu_to_le32(reg_queue->pBuffer[i]); + + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue) + DataSize); + dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; + dr->bRequest = 0x04; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(Flag); /* 0: Register number auto-increment, 1: No auto increment */ + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(DataSize); + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; - spin_unlock_irq(®->EP0VM_spin_lock); + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); + spin_unlock_irq(®->EP0VM_spin_lock); - return true; - } else { - if (urb) - usb_free_urb(urb); - kfree(reg_queue); - return false; - } - return false; + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } void Wb35Reg_Update(struct hw_data *pHwData, u16 RegisterNo, u32 RegisterValue) @@ -174,43 +174,44 @@ unsigned char Wb35Reg_Write(struct hw_data *pHwData, u16 RegisterNo, u32 Registe /* update the register by send urb request */ UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); + if (reg_queue == NULL) + return false; + urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 1; /* burst write register */ - reg_queue->INDEX = RegisterNo; - reg_queue->VALUE = cpu_to_le32(RegisterValue); - reg_queue->RESERVED_VALID = false; - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; - dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(0x0); - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(4); - - /* Enter the sending queue */ - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; + if (urb == NULL) { + kfree(reg_queue); + return false; + } - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; + reg_queue->DIRECT = 1; /* burst write register */ + reg_queue->INDEX = RegisterNo; + reg_queue->VALUE = cpu_to_le32(RegisterValue); + reg_queue->RESERVED_VALID = false; + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; + dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(0x0); + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(4); + + /* Enter the sending queue */ + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; - spin_unlock_irq(®->EP0VM_spin_lock); + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); + spin_unlock_irq(®->EP0VM_spin_lock); - return true; - } else { - if (urb) - usb_free_urb(urb); - kfree(reg_queue); - return false; - } + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } /* @@ -238,43 +239,45 @@ unsigned char Wb35Reg_WriteWithCallbackValue(struct hw_data *pHwData, /* update the register by send urb request */ UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 1; /* burst write register */ - reg_queue->INDEX = RegisterNo; - reg_queue->VALUE = cpu_to_le32(RegisterValue); - /* NOTE : Users must guarantee the size of value will not exceed the buffer size. */ - memcpy(reg_queue->RESERVED, pValue, Len); - reg_queue->RESERVED_VALID = true; - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; - dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(0x0); - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(4); - - /* Enter the sending queue */ - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; - - spin_unlock_irq(®->EP0VM_spin_lock); + if (reg_queue == NULL) + return false; - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); - return true; - } else { - if (urb) - usb_free_urb(urb); + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { kfree(reg_queue); return false; } + + reg_queue->DIRECT = 1; /* burst write register */ + reg_queue->INDEX = RegisterNo; + reg_queue->VALUE = cpu_to_le32(RegisterValue); + /* NOTE : Users must guarantee the size of value will not exceed the buffer size. */ + memcpy(reg_queue->RESERVED, pValue, Len); + reg_queue->RESERVED_VALID = true; + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; + dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(0x0); + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(4); + + /* Enter the sending queue */ + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; + + spin_unlock_irq(®->EP0VM_spin_lock); + + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } /* @@ -344,41 +347,41 @@ unsigned char Wb35Reg_Read(struct hw_data *pHwData, u16 RegisterNo, u32 *pRegist /* update the variable by send Urb to read register */ UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 0; /* read register */ - reg_queue->INDEX = RegisterNo; - reg_queue->pBuffer = pRegisterValue; - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN; - dr->bRequest = 0x01; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(0x0); - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(4); - - /* Enter the sending queue */ - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; - - spin_unlock_irq(®->EP0VM_spin_lock); - - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); + if (reg_queue == NULL) + return false; - return true; - } else { - if (urb) - usb_free_urb(urb); + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { kfree(reg_queue); return false; } + reg_queue->DIRECT = 0; /* read register */ + reg_queue->INDEX = RegisterNo; + reg_queue->pBuffer = pRegisterValue; + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN; + dr->bRequest = 0x01; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(0x0); + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(4); + + /* Enter the sending queue */ + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; + + spin_unlock_irq(®->EP0VM_spin_lock); + + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } diff --git a/drivers/staging/winbond/wb35rx.c b/drivers/staging/winbond/wb35rx.c index f118eeb..8d71bc2 100644 --- a/drivers/staging/winbond/wb35rx.c +++ b/drivers/staging/winbond/wb35rx.c @@ -343,8 +343,7 @@ void Wb35Rx_destroy(struct hw_data *pHwData) } while (pWb35Rx->EP3vm_state != VM_STOP); msleep(10); /* Delay for waiting function exit */ - if (pWb35Rx->RxUrb) - usb_free_urb(pWb35Rx->RxUrb); + usb_free_urb(pWb35Rx->RxUrb); pr_debug("Wb35Rx_destroy OK\n"); } |