Skip to content

Commit

Permalink
rtlwifi_new: Reorder PCI initialization
Browse files Browse the repository at this point in the history
Both rtl_pci_init_aspm() and rtl_init_core() rely on init_sw_vars().
The order of them is important.

Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
  • Loading branch information
lwfinger committed Sep 11, 2014
1 parent 5ee581a commit 457223e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 38 deletions.
18 changes: 0 additions & 18 deletions core.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,6 @@ void rtl_fw_cb(const struct firmware *firmware, void *context)
memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
rtlpriv->rtlhal.fwsize = firmware->size;
release_firmware(firmware);

err = ieee80211_register_hw(hw);
if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't register mac80211 hw\n");
return;
} else {
rtlpriv->mac80211.mac80211_registered = 1;
}
set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);

/*init rfkill */
rtl_init_rfkill(hw);
}
EXPORT_SYMBOL(rtl_fw_cb);

Expand Down Expand Up @@ -205,8 +192,6 @@ static void rtl_op_stop(struct ieee80211_hw *hw)
mutex_unlock(&rtlpriv->locks.conf_mutex);
}



#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
static void rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
#else
Expand All @@ -227,8 +212,6 @@ static void rtl_op_tx(struct ieee80211_hw *hw,
if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
goto err_free;



#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
if (!rtlpriv->intf_ops->waitq_insert(hw, skb))
rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc);
Expand Down Expand Up @@ -624,7 +607,6 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
if (mac->skip_scan)
return 1;


mutex_lock(&rtlpriv->locks.conf_mutex);
if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /* BIT(2) */
RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
Expand Down
39 changes: 19 additions & 20 deletions pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw)
return status;
}


static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw,
struct rtl_priv **buddy_priv)
{
Expand Down Expand Up @@ -602,7 +601,6 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
u8 tid;
u8 *entry;


if (rtlpriv->use_new_trx_flow)
entry = (u8 *)(&ring->buffer_desc[ring->idx]);
else
Expand Down Expand Up @@ -781,9 +779,8 @@ static void _rtl_pci_hs_interrupt(struct ieee80211_hw *hw)
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[MAC_HSISR],
rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[MAC_HSISR]) |
rtlpci->sys_irq_mask);


}

static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
Expand Down Expand Up @@ -855,7 +852,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
(u8 *)buffer_desc,
hw_queue);


len = rtlpriv->cfg->ops->get_desc((u8 *)pdesc, false,
HW_DESC_RXPKT_LEN);

Expand Down Expand Up @@ -935,7 +931,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
rtlpci->rx_ring[hw_queue].next_rx_rp %=
RTL_PCI_MAX_RX_COUNT;


rx_remained_cnt--;
if (1/*rx_remained_cnt == 0*/) {
rtl_write_word(rtlpriv, 0x3B4,
Expand Down Expand Up @@ -969,8 +964,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
}
}



static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
{
struct ieee80211_hw *hw = dev_id;
Expand Down Expand Up @@ -998,17 +991,14 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
"beacon ok interrupt!\n");


if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER]))
RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
"beacon err interrupt!\n");


if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK])
RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
"beacon interrupt!\n");


if (inta & rtlpriv->cfg->maps[RTL_IMR_BcnInt]) {
RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
"prepare beacon for interrupt!\n");
Expand Down Expand Up @@ -1115,7 +1105,6 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
}
}


if (rtlpriv->rtlhal.earlymode_enable)
tasklet_schedule(&rtlpriv->works.irq_tasklet);

Expand Down Expand Up @@ -1880,7 +1869,6 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
if (rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_halt_notify();


/*
*should before disable interrrupt&adapter
*and will do it immediately.
Expand Down Expand Up @@ -2142,7 +2130,6 @@ static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw)
if (ret < 0)
return ret;


rtlpci->using_msi = false;
RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG,
"Pin-based Interrupt Mode!\n");
Expand Down Expand Up @@ -2278,6 +2265,13 @@ int rtl_pci_probe(struct pci_dev *pdev,
/*like read eeprom and so on */
rtlpriv->cfg->ops->read_eeprom_info(hw);

if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
err = -ENODEV;
goto fail3;
}
rtlpriv->cfg->ops->init_sw_leds(hw);

/*aspm */
rtl_pci_init_aspm(hw);

Expand All @@ -2296,14 +2290,14 @@ int rtl_pci_probe(struct pci_dev *pdev,
goto fail3;
}

if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
err = -ENODEV;
err = ieee80211_register_hw(hw);
if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't register mac80211 hw.\n");
goto fail3;
} else {
rtlpriv->mac80211.mac80211_registered = 1;
}

rtlpriv->cfg->ops->init_sw_leds(hw);

err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group);
if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
Expand All @@ -2313,6 +2307,9 @@ int rtl_pci_probe(struct pci_dev *pdev,
/* add for prov */
rtl_proc_add_one(hw);

/*init rfkill */
rtl_init_rfkill(hw); /* Init PCI sw */

rtlpci = rtl_pcidev(pcipriv);
err = rtl_pci_intr_mode_decide(hw);
if (err) {
Expand All @@ -2324,6 +2321,8 @@ int rtl_pci_probe(struct pci_dev *pdev,
rtlpci->irq_alloc = 1;
}

set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);

return 0;

fail3:
Expand Down

0 comments on commit 457223e

Please sign in to comment.