Staging: bcm: Fix coding style issues in InterfaceMisc.c

This patch cleans up several code style issues found
in InterfaceMisc.c reported by checkpatch.pl.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Kevin McKinney
2011-10-10 21:01:50 -04:00
committed by Greg Kroah-Hartman
parent ca45e70029
commit 54ced00639

View File

@@ -1,37 +1,34 @@
#include "headers.h" #include "headers.h"
INT INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
UINT addr, UINT addr,
PVOID buff, PVOID buff,
INT len) INT len)
{ {
int retval = 0; int retval = 0;
USHORT usRetries = 0; USHORT usRetries = 0;
if(psIntfAdapter == NULL )
{ if (psIntfAdapter == NULL) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
return -EINVAL; return -EINVAL;
} }
if(psIntfAdapter->psAdapter->device_removed == TRUE) if (psIntfAdapter->psAdapter->device_removed == TRUE) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
return -ENODEV; return -ENODEV;
} }
if((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus");
return -EACCES; return -EACCES;
} }
if(psIntfAdapter->bSuspended ==TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
return -EACCES; return -EACCES;
} }
psIntfAdapter->psAdapter->DeviceAccess = TRUE; psIntfAdapter->psAdapter->DeviceAccess = TRUE;
do { do {
retval = usb_control_msg(psIntfAdapter->udev, retval = usb_control_msg(psIntfAdapter->udev,
usb_rcvctrlpipe(psIntfAdapter->udev, 0), usb_rcvctrlpipe(psIntfAdapter->udev, 0),
@@ -44,30 +41,25 @@ InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter,
5000); 5000);
usRetries++; usRetries++;
if(-ENODEV == retval) if (-ENODEV == retval) {
{
psIntfAdapter->psAdapter->device_removed = TRUE; psIntfAdapter->psAdapter->device_removed = TRUE;
break; break;
} }
} while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES)); } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
if(retval < 0) if (retval < 0) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", retval, usRetries); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", retval, usRetries);
psIntfAdapter->psAdapter->DeviceAccess = FALSE; psIntfAdapter->psAdapter->DeviceAccess = FALSE;
return retval; return retval;
} } else {
else
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", retval); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", retval);
psIntfAdapter->psAdapter->DeviceAccess = FALSE; psIntfAdapter->psAdapter->DeviceAccess = FALSE;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
} }
INT INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
UINT addr, UINT addr,
PVOID buff, PVOID buff,
INT len) INT len)
@@ -75,30 +67,28 @@ InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
int retval = 0; int retval = 0;
USHORT usRetries = 0; USHORT usRetries = 0;
if(psIntfAdapter == NULL ) if (psIntfAdapter == NULL) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL");
return -EINVAL; return -EINVAL;
} }
if(psIntfAdapter->psAdapter->device_removed == TRUE)
{
if (psIntfAdapter->psAdapter->device_removed == TRUE) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed");
return -ENODEV; return -ENODEV;
} }
if((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus...");
return -EACCES; return -EACCES;
} }
if(psIntfAdapter->bSuspended ==TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) {
{
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed..");
return -EACCES; return -EACCES;
} }
psIntfAdapter->psAdapter->DeviceAccess = TRUE; psIntfAdapter->psAdapter->DeviceAccess = TRUE;
do { do {
retval = usb_control_msg(psIntfAdapter->udev, retval = usb_control_msg(psIntfAdapter->udev,
usb_sndctrlpipe(psIntfAdapter->udev, 0), usb_sndctrlpipe(psIntfAdapter->udev, 0),
@@ -111,32 +101,25 @@ InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter,
5000); 5000);
usRetries++; usRetries++;
if(-ENODEV == retval) if (-ENODEV == retval) {
{
psIntfAdapter->psAdapter->device_removed = TRUE; psIntfAdapter->psAdapter->device_removed = TRUE;
break; break;
} }
} while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES)); } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES));
if(retval < 0) 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, retires :%d", retval, usRetries);
psIntfAdapter->psAdapter->DeviceAccess = FALSE; psIntfAdapter->psAdapter->DeviceAccess = FALSE;
return retval; return retval;
} } else {
else
{
psIntfAdapter->psAdapter->DeviceAccess = FALSE; psIntfAdapter->psAdapter->DeviceAccess = FALSE;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval);
return STATUS_SUCCESS; return STATUS_SUCCESS;
}
} }
} INT BcmRDM(PVOID arg,
INT
BcmRDM(PVOID arg,
UINT addr, UINT addr,
PVOID buff, PVOID buff,
INT len) INT len)
@@ -144,8 +127,7 @@ BcmRDM(PVOID arg,
return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len); return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
} }
INT INT BcmWRM(PVOID arg,
BcmWRM(PVOID arg,
UINT addr, UINT addr,
PVOID buff, PVOID buff,
INT len) INT len)
@@ -153,33 +135,30 @@ BcmWRM(PVOID arg,
return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len); return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len);
} }
INT Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter) INT Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter)
{ {
PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter); PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter);
INT status = STATUS_SUCCESS; INT status = STATUS_SUCCESS;
/* /*
usb_clear_halt - tells device to clear endpoint halt/stall condition * usb_clear_halt - tells device to clear endpoint halt/stall condition
@dev: device whose endpoint is halted * @dev: device whose endpoint is halted
@pipe: endpoint "pipe" being cleared * @pipe: endpoint "pipe" being cleared
@ Context: !in_interrupt () * @ Context: !in_interrupt ()
*
usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code. * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code.
This is used to clear halt conditions for bulk and interrupt endpoints only. * This is used to clear halt conditions for bulk and interrupt endpoints only.
Control and isochronous endpoints never halts. * Control and isochronous endpoints never halts.
*
Any URBs queued for such an endpoint should normally be unlinked by the driver * Any URBs queued for such an endpoint should normally be unlinked by the driver
before clearing the halt condition. * before clearing the halt condition.
*
*/ */
//Killing all the submitted urbs to different end points. /* Killing all the submitted urbs to different end points. */
Bcm_kill_all_URBs(psIntfAdapter); Bcm_kill_all_URBs(psIntfAdapter);
/* clear the halted/stalled state for every end point */
//clear the halted/stalled state for every end point
status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_in_pipe); status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_in_pipe);
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status);
@@ -195,13 +174,12 @@ INT Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter)
return status; return status;
} }
VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter) VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
{ {
struct urb *tempUrb = NULL; struct urb *tempUrb = NULL;
UINT i; UINT i;
/** /*
* usb_kill_urb - cancel a transfer request and wait for it to finish * usb_kill_urb - cancel a transfer request and wait for it to finish
* @urb: pointer to URB describing a previously submitted request, * @urb: pointer to URB describing a previously submitted request,
* returns nothing as it is void returned API. * returns nothing as it is void returned API.
@@ -209,36 +187,31 @@ VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter)
* This routine cancels an in-progress request. It is guaranteed that * This routine cancels an in-progress request. It is guaranteed that
* upon return all completion handlers will have finished and the URB * upon return all completion handlers will have finished and the URB
* will be totally idle and available for reuse * will be totally idle and available for reuse
*
* This routine may not be used in an interrupt context (such as a bottom * This routine may not be used in an interrupt context (such as a bottom
* half or a completion handler), or when holding a spinlock, or in other * half or a completion handler), or when holding a spinlock, or in other
* situations where the caller can't schedule(). * situations where the caller can't schedule().
* *
**/ */
/* Cancel submitted Interrupt-URB's */ /* Cancel submitted Interrupt-URB's */
if(psIntfAdapter->psInterruptUrb != NULL) if (psIntfAdapter->psInterruptUrb != NULL) {
{
if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS) if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS)
usb_kill_urb(psIntfAdapter->psInterruptUrb); usb_kill_urb(psIntfAdapter->psInterruptUrb);
} }
/* Cancel All submitted TX URB's */ /* Cancel All submitted TX URB's */
for(i = 0; i < MAXIMUM_USB_TCB; i++) for (i = 0; i < MAXIMUM_USB_TCB; i++) {
{
tempUrb = psIntfAdapter->asUsbTcb[i].urb; tempUrb = psIntfAdapter->asUsbTcb[i].urb;
if(tempUrb) if (tempUrb) {
{
if (tempUrb->status == -EINPROGRESS) if (tempUrb->status == -EINPROGRESS)
usb_kill_urb(tempUrb); usb_kill_urb(tempUrb);
} }
} }
for(i = 0; i < MAXIMUM_USB_RCB; i++) for (i = 0; i < MAXIMUM_USB_RCB; i++) {
{
tempUrb = psIntfAdapter->asUsbRcb[i].urb; tempUrb = psIntfAdapter->asUsbRcb[i].urb;
if(tempUrb) if (tempUrb) {
{
if (tempUrb->status == -EINPROGRESS) if (tempUrb->status == -EINPROGRESS)
usb_kill_urb(tempUrb); usb_kill_urb(tempUrb);
} }
@@ -260,6 +233,5 @@ VOID putUsbSuspend(struct work_struct *work)
if (psIntfAdapter->bSuspended == FALSE) if (psIntfAdapter->bSuspended == FALSE)
usb_autopm_put_interface(intf); usb_autopm_put_interface(intf);
} }