[PATCH 6/7] Staging: vt6656: Simplify setting of power state in frame header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simplify setting of power state in power.c when sending power
state notifications to the access point.

Signed-off-by: Philip Worrall <philip.worrall@xxxxxxxxxxxxxx>
---
 drivers/staging/vt6656/power.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
index 44dd189..fbc3702 100644
--- a/drivers/staging/vt6656/power.c
+++ b/drivers/staging/vt6656/power.c
@@ -274,6 +274,7 @@ BOOL PSbSendNullPacket(void *hDeviceContext)
 	PSDevice pDevice = (PSDevice)hDeviceContext;
 	PSTxMgmtPacket pTxPacket = NULL;
 	PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+	__u16 flags = 0;
 
 	if (pDevice->bLinkPass == FALSE)
 		return FALSE;
@@ -287,21 +288,15 @@ BOOL PSbSendNullPacket(void *hDeviceContext)
 	pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
 	pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket));
 
+	flags = WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
+			WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL);
+
 	if (pDevice->bEnablePSMode) {
-		pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
-			(
-				WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
-				WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
-				WLAN_SET_FC_PWRMGT(1)
-			));
-	} else {
-		pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
-			(
-				WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
-				WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
-				WLAN_SET_FC_PWRMGT(0)
-			));
-	}
+		flags |= WLAN_SET_FC_PWRMGT(1);
+	else
+		flags |= WLAN_SET_FC_PWRMGT(0);
+
+	pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(flags);
 
 	if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA)
 		pTxPacket->p80211Header->sA3.wFrameCtl |= cpu_to_le16((WORD)WLAN_SET_FC_TODS(1));
-- 
1.7.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux