From: Ana Rey Date: Wed, 26 Feb 2014 14:32:23 +0000 (+0100) Subject: staging: rtl8187se: Convert _link_detect_t typedef into a struct. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=12f2200f98471090228c70dc6b60b125452ca8a7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: rtl8187se: Convert _link_detect_t typedef into a struct. The Documentation/CodingStyle doesn't recommend the use of typedef, convert this to structure. While at it, I have also renamed the variable names that were used in this typedef not to use Hungarian notation. Signed-off-by: Ana Rey Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 1fc1c0948b1a..f81e6b51d277 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -217,27 +217,27 @@ struct stats { #define POWER_PROFILE_AC 0 #define POWER_PROFILE_BATTERY 1 -typedef struct _link_detect_t { - u32 RxFrameNum[MAX_LD_SLOT_NUM]; /* number of Rx Frame. - * CheckForHang_period to determine - * link status. - */ - u16 SlotNum; /* number of CheckForHang period to determine link status, - * default is 2. - */ - u16 SlotIndex; - - u32 NumTxOkInPeriod; /* number of packet transmitted during - * CheckForHang. - */ - u32 NumRxOkInPeriod; /* number of packet received during CheckForHang */ - - u8 IdleCount; /* (KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD) */ - u32 LastNumTxUnicast; - u32 LastNumRxUnicast; - - bool bBusyTraffic; /* when it is set to 1, UI cann't scan at will. */ -} link_detect_t, *plink_detect_t; +struct link_detect_t { + u32 rx_frame_num[MAX_LD_SLOT_NUM]; /* number of Rx Frame. + * CheckForHang_period to determine + * link status. + */ + u16 slot_num; /* number of CheckForHang period to determine link status, + * default is 2. + */ + u16 slot_index; + u32 num_tx_ok_in_period; /* number of packet transmitted during + * CheckForHang. + */ + u32 num_rx_ok_in_period; /* number of packet received during + * CheckForHang. + */ + u8 idle_count; /* (KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD) */ + u32 last_num_tx_unicast; + u32 last_num_rx_unicast; + + bool b_busy_traffic; /* when it is set to 1, UI cann't scan at will. */ +}; /* YJ,modified,080828,end */ @@ -373,7 +373,7 @@ typedef struct r8180_priv { short promisc; /* stats */ struct stats stats; - struct _link_detect_t link_detect; /* YJ,add,080828 */ + struct link_detect_t link_detect; /* YJ,add,080828 */ struct iw_statistics wstats; /* RX stuff. */ diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 1882da86a78e..7480a39165e7 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -2261,10 +2261,10 @@ static void rtl8180_statistics_init(struct stats *pstats) memset(pstats, 0, sizeof(struct stats)); } -static void rtl8180_link_detect_init(plink_detect_t plink_detect) +static void rtl8180_link_detect_init(struct link_detect_t *plink_detect) { - memset(plink_detect, 0, sizeof(link_detect_t)); - plink_detect->SlotNum = DEFAULT_SLOT_NUM; + memset(plink_detect, 0, sizeof(struct link_detect_t)); + plink_detect->slot_num = DEFAULT_SLOT_NUM; } /* YJ,add,080828,end */ @@ -2846,23 +2846,23 @@ static void MgntLinkKeepAlive(struct r8180_priv *priv) */ if ((priv->keepAliveLevel == 2) || - (priv->link_detect.LastNumTxUnicast == priv->NumTxUnicast && - priv->link_detect.LastNumRxUnicast == priv->ieee80211->NumRxUnicast) + (priv->link_detect.last_num_tx_unicast == priv->NumTxUnicast && + priv->link_detect.last_num_rx_unicast == priv->ieee80211->NumRxUnicast) ) { - priv->link_detect.IdleCount++; + priv->link_detect.idle_count++; /* * Send a Keep-Alive packet packet to AP if we had been idle for a while. */ - if (priv->link_detect.IdleCount >= ((KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD)-1)) { - priv->link_detect.IdleCount = 0; + if (priv->link_detect.idle_count >= ((KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD)-1)) { + priv->link_detect.idle_count = 0; ieee80211_sta_ps_send_null_frame(priv->ieee80211, false); } } else { - priv->link_detect.IdleCount = 0; + priv->link_detect.idle_count = 0; } - priv->link_detect.LastNumTxUnicast = priv->NumTxUnicast; - priv->link_detect.LastNumRxUnicast = priv->ieee80211->NumRxUnicast; + priv->link_detect.last_num_tx_unicast = priv->NumTxUnicast; + priv->link_detect.last_num_rx_unicast = priv->ieee80211->NumRxUnicast; } } @@ -2883,10 +2883,10 @@ void rtl8180_watch_dog(struct net_device *dev) } /* YJ,add,080828,for link state check */ if ((priv->ieee80211->state == IEEE80211_LINKED) && (priv->ieee80211->iw_mode == IW_MODE_INFRA)) { - SlotIndex = (priv->link_detect.SlotIndex++) % priv->link_detect.SlotNum; - priv->link_detect.RxFrameNum[SlotIndex] = priv->ieee80211->NumRxDataInPeriod + priv->ieee80211->NumRxBcnInPeriod; - for (i = 0; i < priv->link_detect.SlotNum; i++) - TotalRxNum += priv->link_detect.RxFrameNum[i]; + SlotIndex = (priv->link_detect.slot_index++) % priv->link_detect.slot_num; + priv->link_detect.rx_frame_num[SlotIndex] = priv->ieee80211->NumRxDataInPeriod + priv->ieee80211->NumRxBcnInPeriod; + for (i = 0; i < priv->link_detect.slot_num; i++) + TotalRxNum += priv->link_detect.rx_frame_num[i]; if (TotalRxNum == 0) { priv->ieee80211->state = IEEE80211_ASSOCIATING; @@ -2901,13 +2901,13 @@ void rtl8180_watch_dog(struct net_device *dev) LeisurePSLeave(priv); if (priv->ieee80211->state == IEEE80211_LINKED) { - priv->link_detect.NumRxOkInPeriod = priv->ieee80211->NumRxDataInPeriod; - if (priv->link_detect.NumRxOkInPeriod > 666 || - priv->link_detect.NumTxOkInPeriod > 666) { + priv->link_detect.num_rx_ok_in_period = priv->ieee80211->NumRxDataInPeriod; + if (priv->link_detect.num_rx_ok_in_period > 666 || + priv->link_detect.num_tx_ok_in_period > 666) { bBusyTraffic = true; } - if (((priv->link_detect.NumRxOkInPeriod + priv->link_detect.NumTxOkInPeriod) > 8) - || (priv->link_detect.NumRxOkInPeriod > 2)) { + if (((priv->link_detect.num_rx_ok_in_period + priv->link_detect.num_tx_ok_in_period) > 8) + || (priv->link_detect.num_rx_ok_in_period > 2)) { bEnterPS = false; } else bEnterPS = true; @@ -2918,9 +2918,9 @@ void rtl8180_watch_dog(struct net_device *dev) LeisurePSLeave(priv); } else LeisurePSLeave(priv); - priv->link_detect.bBusyTraffic = bBusyTraffic; - priv->link_detect.NumRxOkInPeriod = 0; - priv->link_detect.NumTxOkInPeriod = 0; + priv->link_detect.b_busy_traffic = bBusyTraffic; + priv->link_detect.num_rx_ok_in_period = 0; + priv->link_detect.num_tx_ok_in_period = 0; priv->ieee80211->NumRxDataInPeriod = 0; priv->ieee80211->NumRxBcnInPeriod = 0; } @@ -3542,7 +3542,7 @@ static irqreturn_t rtl8180_interrupt(int irq, void *netdev) } if (inta & ISR_THPDOK) { /* High priority tx ok */ - priv->link_detect.NumTxOkInPeriod++; /* YJ,add,080828 */ + priv->link_detect.num_tx_ok_in_period++; /* YJ,add,080828 */ priv->stats.txhpokint++; rtl8180_tx_isr(dev, HI_PRIORITY, 0); } @@ -3605,14 +3605,14 @@ static irqreturn_t rtl8180_interrupt(int irq, void *netdev) priv->stats.txoverflow++; if (inta & ISR_TNPDOK) { /* Normal priority tx ok */ - priv->link_detect.NumTxOkInPeriod++; /* YJ,add,080828 */ + priv->link_detect.num_tx_ok_in_period++; /* YJ,add,080828 */ priv->stats.txnpokint++; rtl8180_tx_isr(dev, NORM_PRIORITY, 0); rtl8180_try_wake_queue(dev, NORM_PRIORITY); } if (inta & ISR_TLPDOK) { /* Low priority tx ok */ - priv->link_detect.NumTxOkInPeriod++; /* YJ,add,080828 */ + priv->link_detect.num_tx_ok_in_period++; /* YJ,add,080828 */ priv->stats.txlpokint++; rtl8180_tx_isr(dev, LOW_PRIORITY, 0); rtl8180_try_wake_queue(dev, LOW_PRIORITY); @@ -3620,14 +3620,14 @@ static irqreturn_t rtl8180_interrupt(int irq, void *netdev) if (inta & ISR_TBKDOK) { /* corresponding to BK_PRIORITY */ priv->stats.txbkpokint++; - priv->link_detect.NumTxOkInPeriod++; /* YJ,add,080828 */ + priv->link_detect.num_tx_ok_in_period++; /* YJ,add,080828 */ rtl8180_tx_isr(dev, BK_PRIORITY, 0); rtl8180_try_wake_queue(dev, BE_PRIORITY); } if (inta & ISR_TBEDOK) { /* corresponding to BE_PRIORITY */ priv->stats.txbeperr++; - priv->link_detect.NumTxOkInPeriod++; /* YJ,add,080828 */ + priv->link_detect.num_tx_ok_in_period++; /* YJ,add,080828 */ rtl8180_tx_isr(dev, BE_PRIORITY, 0); rtl8180_try_wake_queue(dev, BE_PRIORITY); } diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c index 498da41c408b..b55249170f18 100644 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ b/drivers/staging/rtl8187se/r8180_wx.c @@ -337,7 +337,7 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a, } else { /* prevent scan in BusyTraffic */ /* FIXME: Need to consider last scan time */ - if ((priv->link_detect.bBusyTraffic) && (true)) { + if ((priv->link_detect.b_busy_traffic) && (true)) { ret = 0; printk("Now traffic is busy, please try later!\n"); } else