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

Staging: w35und: reformat wbhal.c

Impact: cleanup

In preparation for merging wbhal.c with wbusb.c, use Lindet to reformat
the file.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Pekka Enberg and committed by
Greg Kroah-Hartman
c6e523c0 833d0cd3

+99 -85
+99 -85
drivers/staging/winbond/wbhal.c
··· 2 2 #include "wbhal_f.h" 3 3 #include "wblinux_f.h" 4 4 5 - void hal_set_ethernet_address( struct hw_data * pHwData, u8 *current_address ) 5 + void hal_set_ethernet_address(struct hw_data *pHwData, u8 * current_address) 6 6 { 7 7 u32 ltmp[2]; 8 8 9 - if( pHwData->SurpriseRemove ) return; 9 + if (pHwData->SurpriseRemove) 10 + return; 10 11 11 - memcpy( pHwData->CurrentMacAddress, current_address, ETH_ALEN ); 12 + memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN); 12 13 13 - ltmp[0]= cpu_to_le32( *(u32 *)pHwData->CurrentMacAddress ); 14 - ltmp[1]= cpu_to_le32( *(u32 *)(pHwData->CurrentMacAddress + 4) ) & 0xffff; 14 + ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress); 15 + ltmp[1] = 16 + cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff; 15 17 16 - Wb35Reg_BurstWrite( pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT ); 18 + Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT); 17 19 } 18 20 19 - void hal_get_permanent_address( struct hw_data * pHwData, u8 *pethernet_address ) 21 + void hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address) 20 22 { 21 - if( pHwData->SurpriseRemove ) return; 23 + if (pHwData->SurpriseRemove) 24 + return; 22 25 23 - memcpy( pethernet_address, pHwData->PermanentMacAddress, 6 ); 26 + memcpy(pethernet_address, pHwData->PermanentMacAddress, 6); 24 27 } 25 28 26 29 //--------------------------------------------------------------------------------------------------- 27 - void hal_set_beacon_period( struct hw_data * pHwData, u16 beacon_period ) 30 + void hal_set_beacon_period(struct hw_data *pHwData, u16 beacon_period) 28 31 { 29 - u32 tmp; 32 + u32 tmp; 30 33 31 - if( pHwData->SurpriseRemove ) return; 34 + if (pHwData->SurpriseRemove) 35 + return; 32 36 33 37 pHwData->BeaconPeriod = beacon_period; 34 38 tmp = pHwData->BeaconPeriod << 16; 35 39 tmp |= pHwData->ProbeDelay; 36 - Wb35Reg_Write( pHwData, 0x0848, tmp ); 40 + Wb35Reg_Write(pHwData, 0x0848, tmp); 37 41 } 38 42 39 - 40 - static void hal_set_current_channel_ex( struct hw_data * pHwData, ChanInfo channel ) 43 + static void hal_set_current_channel_ex(struct hw_data *pHwData, 44 + ChanInfo channel) 41 45 { 42 46 struct wb35_reg *reg = &pHwData->reg; 43 47 44 - if( pHwData->SurpriseRemove ) 48 + if (pHwData->SurpriseRemove) 45 49 return; 46 50 47 51 printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo); 48 52 49 - RFSynthesizer_SwitchingChannel( pHwData, channel );// Switch channel 53 + RFSynthesizer_SwitchingChannel(pHwData, channel); // Switch channel 50 54 pHwData->Channel = channel.ChanNo; 51 55 pHwData->band = channel.band; 52 - #ifdef _PE_STATE_DUMP_ 53 - printk("Set channel is %d, band =%d\n", pHwData->Channel, pHwData->band); 54 - #endif 55 - reg->M28_MacControl &= ~0xff; // Clean channel information field 56 + #ifdef _PE_STATE_DUMP_ 57 + printk("Set channel is %d, band =%d\n", pHwData->Channel, 58 + pHwData->band); 59 + #endif 60 + reg->M28_MacControl &= ~0xff; // Clean channel information field 56 61 reg->M28_MacControl |= channel.ChanNo; 57 - Wb35Reg_WriteWithCallbackValue( pHwData, 0x0828, reg->M28_MacControl, 58 - (s8 *)&channel, sizeof(ChanInfo)); 62 + Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl, 63 + (s8 *) & channel, sizeof(ChanInfo)); 59 64 } 65 + 60 66 //--------------------------------------------------------------------------------------------------- 61 - void hal_set_current_channel( struct hw_data * pHwData, ChanInfo channel ) 67 + void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel) 62 68 { 63 - hal_set_current_channel_ex( pHwData, channel ); 69 + hal_set_current_channel_ex(pHwData, channel); 64 70 } 71 + 65 72 //--------------------------------------------------------------------------------------------------- 66 - void hal_set_accept_broadcast( struct hw_data * pHwData, u8 enable ) 73 + void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable) 67 74 { 68 75 struct wb35_reg *reg = &pHwData->reg; 69 76 70 - if( pHwData->SurpriseRemove ) return; 77 + if (pHwData->SurpriseRemove) 78 + return; 71 79 72 - reg->M00_MacControl &= ~0x02000000;//The HW value 80 + reg->M00_MacControl &= ~0x02000000; //The HW value 73 81 74 82 if (enable) 75 - reg->M00_MacControl |= 0x02000000;//The HW value 83 + reg->M00_MacControl |= 0x02000000; //The HW value 76 84 77 - Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl ); 85 + Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); 78 86 } 79 87 80 88 //for wep key error detection, we need to accept broadcast packets to be received temporary. 81 - void hal_set_accept_promiscuous( struct hw_data * pHwData, u8 enable) 89 + void hal_set_accept_promiscuous(struct hw_data *pHwData, u8 enable) 82 90 { 83 91 struct wb35_reg *reg = &pHwData->reg; 84 92 85 - if (pHwData->SurpriseRemove) return; 93 + if (pHwData->SurpriseRemove) 94 + return; 86 95 if (enable) { 87 96 reg->M00_MacControl |= 0x00400000; 88 - Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl ); 97 + Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); 89 98 } else { 90 - reg->M00_MacControl&=~0x00400000; 91 - Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl ); 99 + reg->M00_MacControl &= ~0x00400000; 100 + Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); 92 101 } 93 102 } 94 103 95 - void hal_set_accept_multicast( struct hw_data * pHwData, u8 enable ) 104 + void hal_set_accept_multicast(struct hw_data *pHwData, u8 enable) 96 105 { 97 106 struct wb35_reg *reg = &pHwData->reg; 98 107 99 - if( pHwData->SurpriseRemove ) return; 100 - 101 - reg->M00_MacControl &= ~0x01000000;//The HW value 102 - if (enable) reg->M00_MacControl |= 0x01000000;//The HW value 103 - Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl ); 104 - } 105 - 106 - void hal_set_accept_beacon( struct hw_data * pHwData, u8 enable ) 107 - { 108 - struct wb35_reg *reg = &pHwData->reg; 109 - 110 - if( pHwData->SurpriseRemove ) return; 111 - 112 - // 20040108 debug 113 - if( !enable )//Due to SME and MLME are not suitable for 35 108 + if (pHwData->SurpriseRemove) 114 109 return; 115 110 116 - reg->M00_MacControl &= ~0x04000000;//The HW value 117 - if( enable ) 118 - reg->M00_MacControl |= 0x04000000;//The HW value 119 - 120 - Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl ); 111 + reg->M00_MacControl &= ~0x01000000; //The HW value 112 + if (enable) 113 + reg->M00_MacControl |= 0x01000000; //The HW value 114 + Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); 121 115 } 116 + 117 + void hal_set_accept_beacon(struct hw_data *pHwData, u8 enable) 118 + { 119 + struct wb35_reg *reg = &pHwData->reg; 120 + 121 + if (pHwData->SurpriseRemove) 122 + return; 123 + 124 + // 20040108 debug 125 + if (!enable) //Due to SME and MLME are not suitable for 35 126 + return; 127 + 128 + reg->M00_MacControl &= ~0x04000000; //The HW value 129 + if (enable) 130 + reg->M00_MacControl |= 0x04000000; //The HW value 131 + 132 + Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); 133 + } 134 + 122 135 //--------------------------------------------------------------------------------------------------- 123 136 124 - void hal_stop( struct hw_data * pHwData ) 137 + void hal_stop(struct hw_data *pHwData) 125 138 { 126 139 struct wb35_reg *reg = &pHwData->reg; 127 140 128 141 pHwData->Wb35Rx.rx_halt = 1; 129 - Wb35Rx_stop( pHwData ); 142 + Wb35Rx_stop(pHwData); 130 143 131 144 pHwData->Wb35Tx.tx_halt = 1; 132 - Wb35Tx_stop( pHwData ); 145 + Wb35Tx_stop(pHwData); 133 146 134 - reg->D00_DmaControl &= ~0xc0000000;//Tx Off, Rx Off 135 - Wb35Reg_Write( pHwData, 0x0400, reg->D00_DmaControl ); 147 + reg->D00_DmaControl &= ~0xc0000000; //Tx Off, Rx Off 148 + Wb35Reg_Write(pHwData, 0x0400, reg->D00_DmaControl); 136 149 } 137 150 138 - unsigned char hal_idle(struct hw_data * pHwData) 151 + unsigned char hal_idle(struct hw_data *pHwData) 139 152 { 140 153 struct wb35_reg *reg = &pHwData->reg; 141 154 struct wb_usb *pWbUsb = &pHwData->WbUsb; 142 155 143 - if( !pHwData->SurpriseRemove && ( pWbUsb->DetectCount || reg->EP0vm_state!=VM_STOP ) ) 156 + if (!pHwData->SurpriseRemove 157 + && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP)) 144 158 return false; 145 159 146 160 return true; 147 161 } 148 162 149 - void hal_set_radio_mode( struct hw_data * pHwData, unsigned char radio_off) 163 + void hal_set_radio_mode(struct hw_data *pHwData, unsigned char radio_off) 150 164 { 151 165 struct wb35_reg *reg = &pHwData->reg; 152 166 153 - if( pHwData->SurpriseRemove ) return; 167 + if (pHwData->SurpriseRemove) 168 + return; 154 169 155 - if (radio_off) //disable Baseband receive off 170 + if (radio_off) //disable Baseband receive off 156 171 { 157 - pHwData->CurrentRadioSw = 1; // off 172 + pHwData->CurrentRadioSw = 1; // off 158 173 reg->M24_MacControl &= 0xffffffbf; 159 - } 160 - else 161 - { 162 - pHwData->CurrentRadioSw = 0; // on 174 + } else { 175 + pHwData->CurrentRadioSw = 0; // on 163 176 reg->M24_MacControl |= 0x00000040; 164 177 } 165 - Wb35Reg_Write( pHwData, 0x0824, reg->M24_MacControl ); 178 + Wb35Reg_Write(pHwData, 0x0824, reg->M24_MacControl); 166 179 } 167 180 168 - u8 hal_get_antenna_number( struct hw_data * pHwData ) 181 + u8 hal_get_antenna_number(struct hw_data *pHwData) 169 182 { 170 183 struct wb35_reg *reg = &pHwData->reg; 171 184 ··· 190 177 191 178 //---------------------------------------------------------------------------------------------------- 192 179 //0 : radio on; 1: radio off 193 - u8 hal_get_hw_radio_off( struct hw_data * pHwData ) 180 + u8 hal_get_hw_radio_off(struct hw_data * pHwData) 194 181 { 195 182 struct wb35_reg *reg = &pHwData->reg; 196 183 197 - if( pHwData->SurpriseRemove ) return 1; 184 + if (pHwData->SurpriseRemove) 185 + return 1; 198 186 199 187 //read the bit16 of register U1B0 200 - Wb35Reg_Read( pHwData, 0x3b0, &reg->U1B0 ); 188 + Wb35Reg_Read(pHwData, 0x3b0, &reg->U1B0); 201 189 if ((reg->U1B0 & 0x00010000)) { 202 190 pHwData->CurrentRadioHw = 1; 203 191 return 1; ··· 208 194 } 209 195 } 210 196 211 - unsigned char hal_get_dxx_reg( struct hw_data * pHwData, u16 number, u32 * pValue ) 197 + unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue) 212 198 { 213 - if( number < 0x1000 ) 199 + if (number < 0x1000) 214 200 number += 0x1000; 215 - return Wb35Reg_ReadSync( pHwData, number, pValue ); 201 + return Wb35Reg_ReadSync(pHwData, number, pValue); 216 202 } 217 203 218 - unsigned char hal_set_dxx_reg( struct hw_data * pHwData, u16 number, u32 value ) 204 + unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 value) 219 205 { 220 - unsigned char ret; 206 + unsigned char ret; 221 207 222 - if( number < 0x1000 ) 208 + if (number < 0x1000) 223 209 number += 0x1000; 224 - ret = Wb35Reg_WriteSync( pHwData, number, value ); 210 + ret = Wb35Reg_WriteSync(pHwData, number, value); 225 211 return ret; 226 212 } 227 213 228 - void hal_set_rf_power(struct hw_data * pHwData, u8 PowerIndex) 214 + void hal_set_rf_power(struct hw_data *pHwData, u8 PowerIndex) 229 215 { 230 - RFSynthesizer_SetPowerIndex( pHwData, PowerIndex ); 216 + RFSynthesizer_SetPowerIndex(pHwData, PowerIndex); 231 217 }