ARM: OMAP2+: Fix booting with configs that don't have MFD_SYSCON
[firefly-linux-kernel-4.4.55.git] / drivers / staging / vt6655 / channel.c
index 70f870541f9268b598d78c8bf04792877b635231..3c17725d5910d1c2ccae323b3a56fc48b93bfbc9 100644 (file)
@@ -174,12 +174,12 @@ void vnt_init_bands(struct vnt_private *priv)
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
+bool set_channel(void *pDeviceHandler, struct ieee80211_channel *ch)
 {
        struct vnt_private *pDevice = pDeviceHandler;
        bool bResult = true;
 
-       if (pDevice->byCurrentCh == uConnectionChannel)
+       if (pDevice->byCurrentCh == ch->hw_value)
                return bResult;
 
        /* Set VGA to max sensitivity */
@@ -197,19 +197,23 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
 
        if (pDevice->byRFType == RF_AIROHA7230)
                RFbAL7230SelectChannelPostProcess(pDevice, pDevice->byCurrentCh,
-                                                 (unsigned char)uConnectionChannel);
+                                                 ch->hw_value);
 
-       pDevice->byCurrentCh = (unsigned char)uConnectionChannel;
+       pDevice->byCurrentCh = ch->hw_value;
        bResult &= RFbSelectChannel(pDevice, pDevice->byRFType,
-                                   (unsigned char)uConnectionChannel);
+                                   ch->hw_value);
 
        /* Init Synthesizer Table */
        if (pDevice->bEnablePSMode)
-               RFvWriteWakeProgSyn(pDevice, pDevice->byRFType, uConnectionChannel);
+               RFvWriteWakeProgSyn(pDevice, pDevice->byRFType, ch->hw_value);
 
        BBvSoftwareReset(pDevice);
 
        if (pDevice->byLocalID > REV_ID_VT3253_B1) {
+               unsigned long flags;
+
+               spin_lock_irqsave(&pDevice->lock, flags);
+
                /* set HW default power register */
                MACvSelectPage1(pDevice->PortOffset);
                RFbSetPower(pDevice, RATE_1M, pDevice->byCurrentCh);
@@ -217,6 +221,8 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
                RFbSetPower(pDevice, RATE_6M, pDevice->byCurrentCh);
                VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWROFDM, pDevice->byCurPwr);
                MACvSelectPage0(pDevice->PortOffset);
+
+               spin_unlock_irqrestore(&pDevice->lock, flags);
        }
 
        if (pDevice->byBBType == BB_TYPE_11B)