@@ -2504,6 +2504,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
25042504 return ; /* another wiphy still in use */
25052505 }
25062506
2507+ /* Ensure HW is awake when we try to shut it down. */
2508+ ath9k_ps_wakeup (sc );
2509+
25072510 if (ah -> btcoex_hw .enabled ) {
25082511 ath9k_hw_btcoex_disable (ah );
25092512 if (ah -> btcoex_hw .scheme == ATH_BTCOEX_CFG_3WIRE )
@@ -2524,6 +2527,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
25242527 /* disable HAL and put h/w to sleep */
25252528 ath9k_hw_disable (ah );
25262529 ath9k_hw_configpcipowersave (ah , 1 , 1 );
2530+ ath9k_ps_restore (sc );
2531+
2532+ /* Finally, put the chip in FULL SLEEP mode */
25272533 ath9k_setpower (sc , ATH9K_PM_FULL_SLEEP );
25282534
25292535 sc -> sc_flags |= SC_OP_INVALID ;
@@ -2534,12 +2540,12 @@ static void ath9k_stop(struct ieee80211_hw *hw)
25342540}
25352541
25362542static int ath9k_add_interface (struct ieee80211_hw * hw ,
2537- struct ieee80211_if_init_conf * conf )
2543+ struct ieee80211_vif * vif )
25382544{
25392545 struct ath_wiphy * aphy = hw -> priv ;
25402546 struct ath_softc * sc = aphy -> sc ;
25412547 struct ath_common * common = ath9k_hw_common (sc -> sc_ah );
2542- struct ath_vif * avp = (void * )conf -> vif -> drv_priv ;
2548+ struct ath_vif * avp = (void * )vif -> drv_priv ;
25432549 enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED ;
25442550 int ret = 0 ;
25452551
@@ -2551,7 +2557,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
25512557 goto out ;
25522558 }
25532559
2554- switch (conf -> type ) {
2560+ switch (vif -> type ) {
25552561 case NL80211_IFTYPE_STATION :
25562562 ic_opmode = NL80211_IFTYPE_STATION ;
25572563 break ;
@@ -2562,11 +2568,11 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
25622568 ret = - ENOBUFS ;
25632569 goto out ;
25642570 }
2565- ic_opmode = conf -> type ;
2571+ ic_opmode = vif -> type ;
25662572 break ;
25672573 default :
25682574 ath_print (common , ATH_DBG_FATAL ,
2569- "Interface type %d not yet supported\n" , conf -> type );
2575+ "Interface type %d not yet supported\n" , vif -> type );
25702576 ret = - EOPNOTSUPP ;
25712577 goto out ;
25722578 }
@@ -2598,18 +2604,18 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
25982604 * Enable MIB interrupts when there are hardware phy counters.
25992605 * Note we only do this (at the moment) for station mode.
26002606 */
2601- if ((conf -> type == NL80211_IFTYPE_STATION ) ||
2602- (conf -> type == NL80211_IFTYPE_ADHOC ) ||
2603- (conf -> type == NL80211_IFTYPE_MESH_POINT )) {
2607+ if ((vif -> type == NL80211_IFTYPE_STATION ) ||
2608+ (vif -> type == NL80211_IFTYPE_ADHOC ) ||
2609+ (vif -> type == NL80211_IFTYPE_MESH_POINT )) {
26042610 sc -> imask |= ATH9K_INT_MIB ;
26052611 sc -> imask |= ATH9K_INT_TSFOOR ;
26062612 }
26072613
26082614 ath9k_hw_set_interrupts (sc -> sc_ah , sc -> imask );
26092615
2610- if (conf -> type == NL80211_IFTYPE_AP ||
2611- conf -> type == NL80211_IFTYPE_ADHOC ||
2612- conf -> type == NL80211_IFTYPE_MONITOR )
2616+ if (vif -> type == NL80211_IFTYPE_AP ||
2617+ vif -> type == NL80211_IFTYPE_ADHOC ||
2618+ vif -> type == NL80211_IFTYPE_MONITOR )
26132619 ath_start_ani (common );
26142620
26152621out :
@@ -2618,12 +2624,12 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
26182624}
26192625
26202626static void ath9k_remove_interface (struct ieee80211_hw * hw ,
2621- struct ieee80211_if_init_conf * conf )
2627+ struct ieee80211_vif * vif )
26222628{
26232629 struct ath_wiphy * aphy = hw -> priv ;
26242630 struct ath_softc * sc = aphy -> sc ;
26252631 struct ath_common * common = ath9k_hw_common (sc -> sc_ah );
2626- struct ath_vif * avp = (void * )conf -> vif -> drv_priv ;
2632+ struct ath_vif * avp = (void * )vif -> drv_priv ;
26272633 int i ;
26282634
26292635 ath_print (common , ATH_DBG_CONFIG , "Detach Interface\n" );
@@ -2637,14 +2643,16 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
26372643 if ((sc -> sc_ah -> opmode == NL80211_IFTYPE_AP ) ||
26382644 (sc -> sc_ah -> opmode == NL80211_IFTYPE_ADHOC ) ||
26392645 (sc -> sc_ah -> opmode == NL80211_IFTYPE_MESH_POINT )) {
2646+ ath9k_ps_wakeup (sc );
26402647 ath9k_hw_stoptxdma (sc -> sc_ah , sc -> beacon .beaconq );
26412648 ath_beacon_return (sc , avp );
2649+ ath9k_ps_restore (sc );
26422650 }
26432651
26442652 sc -> sc_flags &= ~SC_OP_BEACONS ;
26452653
26462654 for (i = 0 ; i < ARRAY_SIZE (sc -> beacon .bslot ); i ++ ) {
2647- if (sc -> beacon .bslot [i ] == conf -> vif ) {
2655+ if (sc -> beacon .bslot [i ] == vif ) {
26482656 printk (KERN_DEBUG "%s: vif had allocated beacon "
26492657 "slot\n" , __func__ );
26502658 sc -> beacon .bslot [i ] = NULL ;
@@ -3087,15 +3095,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
30873095 case IEEE80211_AMPDU_RX_STOP :
30883096 break ;
30893097 case IEEE80211_AMPDU_TX_START :
3098+ ath9k_ps_wakeup (sc );
30903099 ath_tx_aggr_start (sc , sta , tid , ssn );
30913100 ieee80211_start_tx_ba_cb_irqsafe (vif , sta -> addr , tid );
3101+ ath9k_ps_restore (sc );
30923102 break ;
30933103 case IEEE80211_AMPDU_TX_STOP :
3104+ ath9k_ps_wakeup (sc );
30943105 ath_tx_aggr_stop (sc , sta , tid );
30953106 ieee80211_stop_tx_ba_cb_irqsafe (vif , sta -> addr , tid );
3107+ ath9k_ps_restore (sc );
30963108 break ;
30973109 case IEEE80211_AMPDU_TX_OPERATIONAL :
3110+ ath9k_ps_wakeup (sc );
30983111 ath_tx_aggr_resume (sc , sta , tid );
3112+ ath9k_ps_restore (sc );
30993113 break ;
31003114 default :
31013115 ath_print (ath9k_hw_common (sc -> sc_ah ), ATH_DBG_FATAL ,
0 commit comments