summaryrefslogtreecommitdiff
path: root/drivers/staging/bcm/InterfaceMisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/bcm/InterfaceMisc.c')
-rw-r--r--drivers/staging/bcm/InterfaceMisc.c124
1 files changed, 53 insertions, 71 deletions
diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c
index bbe909946091..afca010f9db5 100644
--- a/drivers/staging/bcm/InterfaceMisc.c
+++ b/drivers/staging/bcm/InterfaceMisc.c
@@ -1,17 +1,14 @@
#include "headers.h"
-INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
- UINT addr,
- PVOID buff,
- INT len)
+int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter,
+ unsigned int addr,
+ void *buff,
+ int len)
{
int bytes;
- USHORT usRetries = 0;
- if (psIntfAdapter == NULL) {
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
+ if (!psIntfAdapter)
return -EINVAL;
- }
if (psIntfAdapter->psAdapter->device_removed == TRUE) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
@@ -29,27 +26,21 @@ INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
}
psIntfAdapter->psAdapter->DeviceAccess = TRUE;
- do {
- bytes = usb_control_msg(psIntfAdapter->udev,
- usb_rcvctrlpipe(psIntfAdapter->udev, 0),
- 0x02,
- 0xC2,
- (addr & 0xFFFF),
- ((addr >> 16) & 0xFFFF),
- buff,
- len,
- 5000);
-
- usRetries++;
- if (-ENODEV == bytes) {
- psIntfAdapter->psAdapter->device_removed = TRUE;
- break;
- }
+ bytes = usb_control_msg(psIntfAdapter->udev,
+ usb_rcvctrlpipe(psIntfAdapter->udev, 0),
+ 0x02,
+ 0xC2,
+ (addr & 0xFFFF),
+ ((addr >> 16) & 0xFFFF),
+ buff,
+ len,
+ 5000);
- } while ((bytes < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
+ if (-ENODEV == bytes)
+ psIntfAdapter->psAdapter->device_removed = TRUE;
if (bytes < 0)
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", bytes, usRetries);
+ BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes);
else
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes);
@@ -57,18 +48,15 @@ INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
return bytes;
}
-INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
- UINT addr,
- PVOID buff,
- INT len)
+int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter,
+ unsigned int addr,
+ void *buff,
+ int len)
{
int retval = 0;
- USHORT usRetries = 0;
- if (psIntfAdapter == NULL) {
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
+ if (!psIntfAdapter)
return -EINVAL;
- }
if (psIntfAdapter->psAdapter->device_removed == TRUE) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
@@ -87,27 +75,21 @@ INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
psIntfAdapter->psAdapter->DeviceAccess = TRUE;
- do {
- retval = usb_control_msg(psIntfAdapter->udev,
- usb_sndctrlpipe(psIntfAdapter->udev, 0),
- 0x01,
- 0x42,
- (addr & 0xFFFF),
- ((addr >> 16) & 0xFFFF),
- buff,
- len,
- 5000);
-
- usRetries++;
- if (-ENODEV == retval) {
- psIntfAdapter->psAdapter->device_removed = TRUE;
- break;
- }
+ retval = usb_control_msg(psIntfAdapter->udev,
+ usb_sndctrlpipe(psIntfAdapter->udev, 0),
+ 0x01,
+ 0x42,
+ (addr & 0xFFFF),
+ ((addr >> 16) & 0xFFFF),
+ buff,
+ len,
+ 5000);
- } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
+ if (-ENODEV == retval)
+ psIntfAdapter->psAdapter->device_removed = TRUE;
if (retval < 0) {
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d, retires :%d", retval, usRetries);
+ BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d", retval);
psIntfAdapter->psAdapter->DeviceAccess = FALSE;
return retval;
} else {
@@ -117,26 +99,26 @@ INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
}
}
-INT BcmRDM(PVOID arg,
- UINT addr,
- PVOID buff,
- INT len)
+int BcmRDM(void *arg,
+ unsigned int addr,
+ void *buff,
+ int len)
{
- return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
+ return InterfaceRDM((struct bcm_interface_adapter*)arg, addr, buff, len);
}
-INT BcmWRM(PVOID arg,
- UINT addr,
- PVOID buff,
- INT len)
+int BcmWRM(void *arg,
+ unsigned int addr,
+ void *buff,
+ int len)
{
- return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
+ return InterfaceWRM((struct bcm_interface_adapter *)arg, addr, buff, len);
}
-INT Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
+int Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
{
- PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter);
- INT status = STATUS_SUCCESS;
+ struct bcm_interface_adapter *psIntfAdapter = (struct bcm_interface_adapter *)(Adapter->pvInterfaceAdapter);
+ int status = STATUS_SUCCESS;
/*
* usb_clear_halt - tells device to clear endpoint halt/stall condition
@@ -172,10 +154,10 @@ INT Bcm_clear_halt_of_endpoints(struct bcm_mini_adapter *Adapter)
return status;
}
-VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
+void Bcm_kill_all_URBs(struct bcm_interface_adapter *psIntfAdapter)
{
struct urb *tempUrb = NULL;
- UINT i;
+ unsigned int i;
/*
* usb_kill_urb - cancel a transfer request and wait for it to finish
@@ -193,7 +175,7 @@ VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
*/
/* Cancel submitted Interrupt-URB's */
- if (psIntfAdapter->psInterruptUrb != NULL) {
+ if (psIntfAdapter->psInterruptUrb) {
if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
usb_kill_urb(psIntfAdapter->psInterruptUrb);
}
@@ -222,11 +204,11 @@ VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
atomic_set(&psIntfAdapter->uCurrRcb, 0);
}
-VOID putUsbSuspend(struct work_struct *work)
+void putUsbSuspend(struct work_struct *work)
{
- PS_INTERFACE_ADAPTER psIntfAdapter = NULL;
+ struct bcm_interface_adapter *psIntfAdapter = NULL;
struct usb_interface *intf = NULL;
- psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER, usbSuspendWork);
+ psIntfAdapter = container_of(work, struct bcm_interface_adapter, usbSuspendWork);
intf = psIntfAdapter->interface;
if (psIntfAdapter->bSuspended == FALSE)