Commit a32b9810 authored by Pekka Enberg's avatar Pekka Enberg Committed by Greg Kroah-Hartman
Browse files

Staging: w35und: reformat wbusb.c



Impact: cleanup

Use scripts/Lindent on the file and clean up the rest by hand.

Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9ca748ce
Loading
Loading
Loading
Loading
+270 −293
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
	return NETDEV_TX_OK;
}


static int wbsoft_start(struct ieee80211_hw *dev)
{
	struct wbsoft_priv *priv = dev->priv;
@@ -178,7 +177,8 @@ static void hal_led_control(unsigned long data)
	u32 TimeInterval = 500, ltmp, ltmp2;
	ltmp = 0;

	if( pHwData->SurpriseRemove ) return;
	if (pHwData->SurpriseRemove)
		return;

	if (pHwData->LED_control) {
		ltmp2 = pHwData->LED_control & 0xff;
@@ -186,8 +186,7 @@ static void hal_led_control(unsigned long data)
		{
			TimeInterval = 100;
			ltmp2 = (pHwData->LED_control >> 8) & 0xff;
			switch( ltmp2 )
			{
			switch (ltmp2) {
			case 1:	// [0.2 On][0.1 Off]...
				pHwData->LED_Blinking %= 3;
				ltmp = 0x1010;	// Led 1 & 0 Green and Red
@@ -222,55 +221,40 @@ static void hal_led_control(unsigned long data)
			}
			Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);
		}
	}
	else if( pHwData->CurrentRadioSw || pHwData->CurrentRadioHw ) // If radio off
	{
		if( reg->U1BC_LEDConfigure & 0x1010 )
	} else if (pHwData->CurrentRadioSw || pHwData->CurrentRadioHw)	// If radio off
	{
		if (reg->U1BC_LEDConfigure & 0x1010) {
			reg->U1BC_LEDConfigure &= ~0x1010;
			Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);
		}
	}
	else
	{
		switch( LEDSet )
		{
	} else {
		switch (LEDSet) {
		case 4:	// [100] Only 1 Led be placed on PCB and use pin 21 of IC. Use LED_0 for showing
			if (!pHwData->LED_LinkOn)	// Blink only if not Link On
			{
				// Blinking if scanning is on progress
					if( pHwData->LED_Scanning )
					{
						if( pHwData->LED_Blinking == 0 )
						{
				if (pHwData->LED_Scanning) {
					if (pHwData->LED_Blinking == 0) {
						reg->U1BC_LEDConfigure |= 0x10;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 On
						pHwData->LED_Blinking = 1;
						TimeInterval = 300;
						}
						else
						{
					} else {
						reg->U1BC_LEDConfigure &= ~0x10;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 Off
						pHwData->LED_Blinking = 0;
						TimeInterval = 300;
					}
					}
					else
					{
				} else {
					//Turn Off LED_0
						if( reg->U1BC_LEDConfigure & 0x10 )
						{
					if (reg->U1BC_LEDConfigure & 0x10) {
						reg->U1BC_LEDConfigure &= ~0x10;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 Off
					}
				}
				}
				else
				{
			} else {
				// Turn On LED_0
					if( (reg->U1BC_LEDConfigure & 0x10) == 0 )
					{
				if ((reg->U1BC_LEDConfigure & 0x10) == 0) {
					reg->U1BC_LEDConfigure |= 0x10;
					Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 Off
				}
@@ -281,45 +265,36 @@ static void hal_led_control(unsigned long data)
			if (!pHwData->LED_LinkOn)	// Blink only if not Link On
			{
				// Blinking if scanning is on progress
					if( pHwData->LED_Scanning )
					{
						if( pHwData->LED_Blinking == 0 )
						{
				if (pHwData->LED_Scanning) {
					if (pHwData->LED_Blinking == 0) {
						reg->U1BC_LEDConfigure &= ~0xf;
						reg->U1BC_LEDConfigure |= 0x10;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 On
						pHwData->LED_Blinking = 1;
						TimeInterval = 300;
						}
						else
						{
					} else {
						reg->U1BC_LEDConfigure &= ~0x1f;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 Off
						pHwData->LED_Blinking = 0;
						TimeInterval = 300;
					}
					}
					else
					{
				} else {
					// 20060901 Gray blinking if in disconnect state and not scanning
					ltmp = reg->U1BC_LEDConfigure;
					reg->U1BC_LEDConfigure &= ~0x1f;
						if( LEDgray2[(pHwData->LED_Blinking%30)] )
						{
					if (LEDgray2[(pHwData->LED_Blinking % 30)]) {
						reg->U1BC_LEDConfigure |= 0x10;
							reg->U1BC_LEDConfigure |= LEDgray2[ (pHwData->LED_Blinking%30) ];
						reg->U1BC_LEDConfigure |=
						    LEDgray2[(pHwData->LED_Blinking % 30)];
					}
					pHwData->LED_Blinking++;
					if (reg->U1BC_LEDConfigure != ltmp)
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 Off
					TimeInterval = 100;
				}
				}
				else
				{
			} else {
				// Turn On LED_0
					if( (reg->U1BC_LEDConfigure & 0x10) == 0 )
					{
				if ((reg->U1BC_LEDConfigure & 0x10) == 0) {
					reg->U1BC_LEDConfigure |= 0x10;
					Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_0 Off
				}
@@ -330,57 +305,54 @@ static void hal_led_control(unsigned long data)
			if (!pHwData->LED_LinkOn)	// Blink only if not Link On
			{
				// Blinking if scanning is on progress
					if( pHwData->LED_Scanning )
					{
						if( pHwData->LED_Blinking == 0 )
						{
							reg->U1BC_LEDConfigure |= 0x1000;
				if (pHwData->LED_Scanning) {
					if (pHwData->LED_Blinking == 0) {
						reg->U1BC_LEDConfigure |=
						    0x1000;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_1 On
						pHwData->LED_Blinking = 1;
						TimeInterval = 300;
						}
						else
						{
							reg->U1BC_LEDConfigure &= ~0x1000;
					} else {
						reg->U1BC_LEDConfigure &=
						    ~0x1000;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_1 Off
						pHwData->LED_Blinking = 0;
						TimeInterval = 300;
					}
					}
					else
					{
				} else {
					//Turn Off LED_1
						if( reg->U1BC_LEDConfigure & 0x1000 )
						{
							reg->U1BC_LEDConfigure &= ~0x1000;
					if (reg->U1BC_LEDConfigure & 0x1000) {
						reg->U1BC_LEDConfigure &=
						    ~0x1000;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_1 Off
					}
				}
				}
				else
				{
			} else {
				// Is transmitting/receiving ??
					if( (adapter->RxByteCount != pHwData->RxByteCountLast ) ||
						(adapter->TxByteCount != pHwData->TxByteCountLast ) )
					{
						if( (reg->U1BC_LEDConfigure & 0x3000) != 0x3000 )
						{
							reg->U1BC_LEDConfigure |= 0x3000;
				if ((adapter->RxByteCount !=
				     pHwData->RxByteCountLast)
				    || (adapter->TxByteCount !=
					pHwData->TxByteCountLast)) {
					if ((reg->U1BC_LEDConfigure & 0x3000) !=
					    0x3000) {
						reg->U1BC_LEDConfigure |=
						    0x3000;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_1 On
					}

					// Update variable
						pHwData->RxByteCountLast = adapter->RxByteCount;
						pHwData->TxByteCountLast = adapter->TxByteCount;
					pHwData->RxByteCountLast =
					    adapter->RxByteCount;
					pHwData->TxByteCountLast =
					    adapter->TxByteCount;
					TimeInterval = 200;
					}
					else
					{
				} else {
					// Turn On LED_1 and blinking if transmitting/receiving
						 if( (reg->U1BC_LEDConfigure & 0x3000) != 0x1000 )
						 {
							 reg->U1BC_LEDConfigure &= ~0x3000;
							 reg->U1BC_LEDConfigure |= 0x1000;
					if ((reg->U1BC_LEDConfigure & 0x3000) !=
					    0x1000) {
						reg->U1BC_LEDConfigure &=
						    ~0x3000;
						reg->U1BC_LEDConfigure |=
						    0x1000;
						Wb35Reg_Write(pHwData, 0x03bc, reg->U1BC_LEDConfigure);	// LED_1 On
					}
				}
@@ -388,34 +360,34 @@ static void hal_led_control(unsigned long data)
			break;

		default:	// Default setting. 2 LED be placed on PCB. LED_0: Link On LED_1 Active
				if( (reg->U1BC_LEDConfigure & 0x3000) != 0x3000 )
				{
			if ((reg->U1BC_LEDConfigure & 0x3000) != 0x3000) {
				reg->U1BC_LEDConfigure |= 0x3000;	// LED_1 is always on and event enable
					Wb35Reg_Write( pHwData, 0x03bc, reg->U1BC_LEDConfigure );
				Wb35Reg_Write(pHwData, 0x03bc,
					      reg->U1BC_LEDConfigure);
			}

				if( pHwData->LED_Blinking )
				{
			if (pHwData->LED_Blinking) {
				// Gray blinking
				reg->U1BC_LEDConfigure &= ~0x0f;
				reg->U1BC_LEDConfigure |= 0x10;
					reg->U1BC_LEDConfigure |= LEDgray[ (pHwData->LED_Blinking-1)%20 ];
					Wb35Reg_Write( pHwData, 0x03bc, reg->U1BC_LEDConfigure );
				reg->U1BC_LEDConfigure |=
				    LEDgray[(pHwData->LED_Blinking - 1) % 20];
				Wb35Reg_Write(pHwData, 0x03bc,
					      reg->U1BC_LEDConfigure);

				pHwData->LED_Blinking += 2;
				if (pHwData->LED_Blinking < 40)
					TimeInterval = 100;
					else
					{
				else {
					pHwData->LED_Blinking = 0;	// Stop blinking
					reg->U1BC_LEDConfigure &= ~0x0f;
						Wb35Reg_Write( pHwData, 0x03bc, reg->U1BC_LEDConfigure );
					Wb35Reg_Write(pHwData, 0x03bc,
						      reg->U1BC_LEDConfigure);
				}
				break;
			}

				if( pHwData->LED_LinkOn )
				{
			if (pHwData->LED_LinkOn) {
				if (!(reg->U1BC_LEDConfigure & 0x10))	// Check the LED_0
				{
					//Try to turn ON LED_0 after gray blinking
@@ -423,24 +395,22 @@ static void hal_led_control(unsigned long data)
					pHwData->LED_Blinking = 1;	//Start blinking
					TimeInterval = 50;
				}
				}
				else
				{
			} else {
				if (reg->U1BC_LEDConfigure & 0x10)	// Check the LED_0
				{
					reg->U1BC_LEDConfigure &= ~0x10;
						Wb35Reg_Write( pHwData, 0x03bc, reg->U1BC_LEDConfigure );
					Wb35Reg_Write(pHwData, 0x03bc,
						      reg->U1BC_LEDConfigure);
				}
			}
			break;
		}

		//20060828.1 Active send null packet to avoid AP disconnect
		if( pHwData->LED_LinkOn )
		{
		if (pHwData->LED_LinkOn) {
			pHwData->NullPacketCount += TimeInterval;
			if( pHwData->NullPacketCount >= DEFAULT_NULL_PACKET_COUNT )
			{
			if (pHwData->NullPacketCount >=
			    DEFAULT_NULL_PACKET_COUNT) {
				pHwData->NullPacketCount = 0;
			}
		}
@@ -505,27 +475,28 @@ static int wb35_hw_init(struct ieee80211_hw *hw)
{
	struct wbsoft_priv *priv = hw->priv;
	struct hw_data *pHwData = &priv->sHwData;
	u8		*pMacAddr;
	u8		*pMacAddr2;
	u8 EEPROM_region;
	u8 HwRadioOff;
	u8 *pMacAddr2;
	u8 *pMacAddr;
	int err;

	pHwData->phy_type = RF_DECIDE_BY_INF;

	priv->Mds.TxRTSThreshold		= DEFAULT_RTSThreshold;
	priv->Mds.TxFragmentThreshold		= DEFAULT_FRAGMENT_THRESHOLD;

	priv->sLocalPara.region_INF		= REGION_AUTO;
	priv->sLocalPara.TxRateMode		= RATE_AUTO;
	priv->sLocalPara.bMacOperationMode	= MODE_802_11_BG;
	priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold;
	priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
	priv->sLocalPara.MTUsize		= MAX_ETHERNET_PACKET_SIZE;
	priv->sLocalPara.bPreambleMode		= AUTO_MODE;
	priv->sLocalPara.RadioOffStatus.boSwRadioOff = false;

	pHwData->phy_type = RF_DECIDE_BY_INF;

	priv->sLocalPara.bWepKeyError		= false;
	priv->sLocalPara.bToSelfPacketReceived	= false;
	priv->sLocalPara.WepKeyDetectTimerCount	= 2 * 100; /* 2 seconds */

	priv->sLocalPara.RadioOffStatus.boSwRadioOff = false;

	err = hal_init_hardware(hw);
	if (err)
		goto error;
@@ -560,7 +531,8 @@ static int wb35_hw_init(struct ieee80211_hw *hw)
		memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH);
	else {
		/* Set the user define MAC address */
		hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress);
		hal_set_ethernet_address(pHwData,
					 priv->sLocalPara.ThisMacAddress);
	}

	priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData);
@@ -578,7 +550,11 @@ static int wb35_hw_init(struct ieee80211_hw *hw)
	HwRadioOff = hal_get_hw_radio_off(pHwData);
	priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff;

	hal_set_radio_mode( pHwData, (unsigned char)(priv->sLocalPara.RadioOffStatus.boSwRadioOff || priv->sLocalPara.RadioOffStatus.boHwRadioOff) );
	hal_set_radio_mode(pHwData,
			   (unsigned char)(priv->sLocalPara.RadioOffStatus.
					   boSwRadioOff
					   || priv->sLocalPara.RadioOffStatus.
					   boHwRadioOff));

	/* Notify hal that the driver is ready now. */
	hal_driver_init_OK(pHwData) = 1;
@@ -587,22 +563,24 @@ static int wb35_hw_init(struct ieee80211_hw *hw)
	return err;
}

static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
static int wb35_probe(struct usb_interface *intf,
		      const struct usb_device_id *id_table)
{
	struct wb_usb *pWbUsb;
        struct usb_host_interface *interface;
	struct usb_endpoint_descriptor *endpoint;
	u32	ltmp;
	struct usb_device *udev = interface_to_usbdev(intf);
	struct wbsoft_priv *priv;
	struct usb_endpoint_descriptor *endpoint;
	struct usb_host_interface *interface;
	struct ieee80211_hw *dev;
	struct wbsoft_priv *priv;
	struct wb_usb *pWbUsb;
	int nr, err;
	u32 ltmp;

	usb_get_dev(udev);

	/* Check the device if it already be opened */
	nr = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
			     0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN,
			     0x01,
			     USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
			     0x0, 0x400, &ltmp, 4, HZ * 100);
	if (nr < 0) {
		err = nr;
@@ -699,7 +677,6 @@ static void wb35_hw_halt(struct wbsoft_priv *adapter)
	hal_halt(&adapter->sHwData);
}


static void wb35_disconnect(struct usb_interface *intf)
{
	struct ieee80211_hw *hw = usb_get_intfdata(intf);