Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kevin McKinney and committed by
Greg Kroah-Hartman
54ced006 ca45e700

+157 -185
+157 -185
drivers/staging/bcm/InterfaceMisc.c
··· 1 1 #include "headers.h" 2 2 3 - INT 4 - InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter, 5 - UINT addr, 6 - PVOID buff, 7 - INT len) 3 + INT InterfaceRDM(PS_INTERFACE_ADAPTER psIntfAdapter, 4 + UINT addr, 5 + PVOID buff, 6 + INT len) 8 7 { 9 8 int retval = 0; 10 - USHORT usRetries = 0 ; 11 - if(psIntfAdapter == NULL ) 12 - { 13 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_PRINTK, 0, 0,"Interface Adapter is NULL"); 14 - return -EINVAL ; 15 - } 9 + USHORT usRetries = 0; 16 10 17 - if(psIntfAdapter->psAdapter->device_removed == TRUE) 18 - { 19 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_PRINTK, 0, 0,"Device got removed"); 20 - return -ENODEV; 21 - } 22 - 23 - if((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) 24 - { 25 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL,"Currently Xaction is not allowed on the bus"); 26 - return -EACCES; 27 - } 28 - 29 - if(psIntfAdapter->bSuspended ==TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) 30 - { 31 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL,"Bus is in suspended states hence RDM not allowed.."); 32 - return -EACCES; 33 - } 34 - psIntfAdapter->psAdapter->DeviceAccess = TRUE ; 35 - do { 36 - retval = usb_control_msg(psIntfAdapter->udev, 37 - usb_rcvctrlpipe(psIntfAdapter->udev,0), 38 - 0x02, 39 - 0xC2, 40 - (addr & 0xFFFF), 41 - ((addr >> 16) & 0xFFFF), 42 - buff, 43 - len, 44 - 5000); 45 - 46 - usRetries++ ; 47 - if(-ENODEV == retval) 48 - { 49 - psIntfAdapter->psAdapter->device_removed =TRUE; 50 - break; 51 - } 52 - 53 - }while((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES ) ); 54 - 55 - if(retval < 0) 56 - { 57 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", retval,usRetries); 58 - psIntfAdapter->psAdapter->DeviceAccess = FALSE ; 59 - return retval; 60 - } 61 - else 62 - { 63 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", retval); 64 - psIntfAdapter->psAdapter->DeviceAccess = FALSE ; 65 - return STATUS_SUCCESS; 66 - } 67 - } 68 - 69 - INT 70 - InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter, 71 - UINT addr, 72 - PVOID buff, 73 - INT len) 74 - { 75 - int retval = 0; 76 - USHORT usRetries = 0 ; 77 - 78 - if(psIntfAdapter == NULL ) 79 - { 80 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL"); 11 + if (psIntfAdapter == NULL) { 12 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL"); 81 13 return -EINVAL; 82 14 } 83 - if(psIntfAdapter->psAdapter->device_removed == TRUE) 84 - { 85 15 86 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_PRINTK, 0, 0,"Device got removed"); 16 + if (psIntfAdapter->psAdapter->device_removed == TRUE) { 17 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); 87 18 return -ENODEV; 88 19 } 89 20 90 - if((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) 91 - { 92 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL,"Currently Xaction is not allowed on the bus..."); 21 + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { 22 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); 93 23 return -EACCES; 94 24 } 95 25 96 - if(psIntfAdapter->bSuspended ==TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) 97 - { 98 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL,"Bus is in suspended states hence RDM not allowed.."); 26 + if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { 27 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); 99 28 return -EACCES; 100 29 } 101 - psIntfAdapter->psAdapter->DeviceAccess = TRUE ; 102 - do{ 30 + psIntfAdapter->psAdapter->DeviceAccess = TRUE; 31 + 32 + do { 103 33 retval = usb_control_msg(psIntfAdapter->udev, 104 - usb_sndctrlpipe(psIntfAdapter->udev,0), 105 - 0x01, 106 - 0x42, 107 - (addr & 0xFFFF), 108 - ((addr >> 16) & 0xFFFF), 109 - buff, 110 - len, 111 - 5000); 34 + usb_rcvctrlpipe(psIntfAdapter->udev, 0), 35 + 0x02, 36 + 0xC2, 37 + (addr & 0xFFFF), 38 + ((addr >> 16) & 0xFFFF), 39 + buff, 40 + len, 41 + 5000); 112 42 113 - usRetries++ ; 114 - if(-ENODEV == retval) 115 - { 116 - psIntfAdapter->psAdapter->device_removed = TRUE ; 43 + usRetries++; 44 + if (-ENODEV == retval) { 45 + psIntfAdapter->psAdapter->device_removed = TRUE; 117 46 break; 118 47 } 119 48 120 - }while((retval < 0) && ( usRetries < MAX_RDM_WRM_RETIRES)); 49 + } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES)); 121 50 122 - if(retval < 0) 123 - { 124 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d, retires :%d", retval, usRetries); 125 - psIntfAdapter->psAdapter->DeviceAccess = FALSE ; 51 + if (retval < 0) { 52 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d, retires :%d", retval, usRetries); 53 + psIntfAdapter->psAdapter->DeviceAccess = FALSE; 126 54 return retval; 127 - } 128 - else 129 - { 130 - psIntfAdapter->psAdapter->DeviceAccess = FALSE ; 131 - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval); 55 + } else { 56 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", retval); 57 + psIntfAdapter->psAdapter->DeviceAccess = FALSE; 132 58 return STATUS_SUCCESS; 133 - 134 59 } 135 - 136 60 } 137 61 138 - INT 139 - BcmRDM(PVOID arg, 140 - UINT addr, 141 - PVOID buff, 142 - INT len) 62 + INT InterfaceWRM(PS_INTERFACE_ADAPTER psIntfAdapter, 63 + UINT addr, 64 + PVOID buff, 65 + INT len) 66 + { 67 + int retval = 0; 68 + USHORT usRetries = 0; 69 + 70 + if (psIntfAdapter == NULL) { 71 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Interface Adapter is NULL"); 72 + return -EINVAL; 73 + } 74 + 75 + if (psIntfAdapter->psAdapter->device_removed == TRUE) { 76 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); 77 + return -ENODEV; 78 + } 79 + 80 + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { 81 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); 82 + return -EACCES; 83 + } 84 + 85 + if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { 86 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); 87 + return -EACCES; 88 + } 89 + 90 + psIntfAdapter->psAdapter->DeviceAccess = TRUE; 91 + 92 + do { 93 + retval = usb_control_msg(psIntfAdapter->udev, 94 + usb_sndctrlpipe(psIntfAdapter->udev, 0), 95 + 0x01, 96 + 0x42, 97 + (addr & 0xFFFF), 98 + ((addr >> 16) & 0xFFFF), 99 + buff, 100 + len, 101 + 5000); 102 + 103 + usRetries++; 104 + if (-ENODEV == retval) { 105 + psIntfAdapter->psAdapter->device_removed = TRUE; 106 + break; 107 + } 108 + 109 + } while ((retval < 0) && (usRetries < MAX_RDM_WRM_RETIRES)); 110 + 111 + if (retval < 0) { 112 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM failed status :%d, retires :%d", retval, usRetries); 113 + psIntfAdapter->psAdapter->DeviceAccess = FALSE; 114 + return retval; 115 + } else { 116 + psIntfAdapter->psAdapter->DeviceAccess = FALSE; 117 + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "WRM sent %d", retval); 118 + return STATUS_SUCCESS; 119 + } 120 + } 121 + 122 + INT BcmRDM(PVOID arg, 123 + UINT addr, 124 + PVOID buff, 125 + INT len) 143 126 { 144 127 return InterfaceRDM((PS_INTERFACE_ADAPTER)arg, addr, buff, len); 145 128 } 146 129 147 - INT 148 - BcmWRM(PVOID arg, 149 - UINT addr, 150 - PVOID buff, 151 - INT len) 130 + INT BcmWRM(PVOID arg, 131 + UINT addr, 132 + PVOID buff, 133 + INT len) 152 134 { 153 135 return InterfaceWRM((PS_INTERFACE_ADAPTER)arg, addr, buff, len); 154 136 } 155 137 156 - 157 - 158 138 INT Bcm_clear_halt_of_endpoints(PMINI_ADAPTER Adapter) 159 139 { 160 140 PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter); 161 - INT status = STATUS_SUCCESS ; 141 + INT status = STATUS_SUCCESS; 162 142 163 143 /* 164 - usb_clear_halt - tells device to clear endpoint halt/stall condition 165 - @dev: device whose endpoint is halted 166 - @pipe: endpoint "pipe" being cleared 167 - @ Context: !in_interrupt () 144 + * usb_clear_halt - tells device to clear endpoint halt/stall condition 145 + * @dev: device whose endpoint is halted 146 + * @pipe: endpoint "pipe" being cleared 147 + * @ Context: !in_interrupt () 148 + * 149 + * usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code. 150 + * This is used to clear halt conditions for bulk and interrupt endpoints only. 151 + * Control and isochronous endpoints never halts. 152 + * 153 + * Any URBs queued for such an endpoint should normally be unlinked by the driver 154 + * before clearing the halt condition. 155 + * 156 + */ 168 157 169 - usb_clear_halt is the synchrnous call and returns 0 on success else returns with error code. 170 - This is used to clear halt conditions for bulk and interrupt endpoints only. 171 - Control and isochronous endpoints never halts. 172 - 173 - Any URBs queued for such an endpoint should normally be unlinked by the driver 174 - before clearing the halt condition. 175 - 176 - */ 177 - 178 - //Killing all the submitted urbs to different end points. 158 + /* Killing all the submitted urbs to different end points. */ 179 159 Bcm_kill_all_URBs(psIntfAdapter); 180 160 161 + /* clear the halted/stalled state for every end point */ 162 + status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sIntrIn.int_in_pipe); 163 + if (status != STATUS_SUCCESS) 164 + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status); 181 165 182 - //clear the halted/stalled state for every end point 183 - status = usb_clear_halt(psIntfAdapter->udev,psIntfAdapter->sIntrIn.int_in_pipe); 184 - if(status != STATUS_SUCCESS) 185 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Interrupt IN end point. :%d ", status); 166 + status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkIn.bulk_in_pipe); 167 + if (status != STATUS_SUCCESS) 168 + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk IN end point. :%d ", status); 186 169 187 - status = usb_clear_halt(psIntfAdapter->udev,psIntfAdapter->sBulkIn.bulk_in_pipe); 188 - if(status != STATUS_SUCCESS) 189 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk IN end point. :%d ", status); 170 + status = usb_clear_halt(psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe); 171 + if (status != STATUS_SUCCESS) 172 + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk OUT end point. :%d ", status); 190 173 191 - status = usb_clear_halt(psIntfAdapter->udev,psIntfAdapter->sBulkOut.bulk_out_pipe); 192 - if(status != STATUS_SUCCESS) 193 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Unable to Clear Halt of Bulk OUT end point. :%d ", status); 194 - 195 - return status ; 174 + return status; 196 175 } 197 - 198 176 199 177 VOID Bcm_kill_all_URBs(PS_INTERFACE_ADAPTER psIntfAdapter) 200 178 { 201 179 struct urb *tempUrb = NULL; 202 180 UINT i; 203 181 204 - /** 205 - * usb_kill_urb - cancel a transfer request and wait for it to finish 206 - * @urb: pointer to URB describing a previously submitted request, 207 - * returns nothing as it is void returned API. 208 - * 209 - * This routine cancels an in-progress request. It is guaranteed that 210 - * upon return all completion handlers will have finished and the URB 211 - * will be totally idle and available for reuse 212 - 213 - * This routine may not be used in an interrupt context (such as a bottom 214 - * half or a completion handler), or when holding a spinlock, or in other 215 - * situations where the caller can't schedule(). 216 - * 217 - **/ 182 + /* 183 + * usb_kill_urb - cancel a transfer request and wait for it to finish 184 + * @urb: pointer to URB describing a previously submitted request, 185 + * returns nothing as it is void returned API. 186 + * 187 + * This routine cancels an in-progress request. It is guaranteed that 188 + * upon return all completion handlers will have finished and the URB 189 + * will be totally idle and available for reuse 190 + * 191 + * This routine may not be used in an interrupt context (such as a bottom 192 + * half or a completion handler), or when holding a spinlock, or in other 193 + * situations where the caller can't schedule(). 194 + * 195 + */ 218 196 219 197 /* Cancel submitted Interrupt-URB's */ 220 - if(psIntfAdapter->psInterruptUrb != NULL) 221 - { 222 - if(psIntfAdapter->psInterruptUrb->status == -EINPROGRESS) 223 - usb_kill_urb(psIntfAdapter->psInterruptUrb); 198 + if (psIntfAdapter->psInterruptUrb != NULL) { 199 + if (psIntfAdapter->psInterruptUrb->status == -EINPROGRESS) 200 + usb_kill_urb(psIntfAdapter->psInterruptUrb); 224 201 } 225 202 226 203 /* Cancel All submitted TX URB's */ 227 - for(i = 0; i < MAXIMUM_USB_TCB; i++) 228 - { 204 + for (i = 0; i < MAXIMUM_USB_TCB; i++) { 229 205 tempUrb = psIntfAdapter->asUsbTcb[i].urb; 230 - if(tempUrb) 231 - { 232 - if(tempUrb->status == -EINPROGRESS) 206 + if (tempUrb) { 207 + if (tempUrb->status == -EINPROGRESS) 233 208 usb_kill_urb(tempUrb); 234 209 } 235 210 } 236 211 237 - for(i = 0; i < MAXIMUM_USB_RCB; i++) 238 - { 212 + for (i = 0; i < MAXIMUM_USB_RCB; i++) { 239 213 tempUrb = psIntfAdapter->asUsbRcb[i].urb; 240 - if(tempUrb) 241 - { 242 - if(tempUrb->status == -EINPROGRESS) 243 - usb_kill_urb(tempUrb); 214 + if (tempUrb) { 215 + if (tempUrb->status == -EINPROGRESS) 216 + usb_kill_urb(tempUrb); 244 217 } 245 218 } 246 219 ··· 226 253 227 254 VOID putUsbSuspend(struct work_struct *work) 228 255 { 229 - PS_INTERFACE_ADAPTER psIntfAdapter = NULL ; 230 - struct usb_interface *intf = NULL ; 231 - psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER,usbSuspendWork); 232 - intf=psIntfAdapter->interface ; 256 + PS_INTERFACE_ADAPTER psIntfAdapter = NULL; 257 + struct usb_interface *intf = NULL; 258 + psIntfAdapter = container_of(work, S_INTERFACE_ADAPTER, usbSuspendWork); 259 + intf = psIntfAdapter->interface; 233 260 234 - if(psIntfAdapter->bSuspended == FALSE) 261 + if (psIntfAdapter->bSuspended == FALSE) 235 262 usb_autopm_put_interface(intf); 236 - 237 263 } 238 264