Commit 5d93f3a2 authored by Luca Coelho's avatar Luca Coelho Committed by Emmanuel Grumbach

iwlwifi: pcie: refcounting is not necessary anymore

We don't use the refcount value anymore, all the refcounting is done
in the runtime PM usage_count value.  Remove it.
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 18dcb9a9
...@@ -651,10 +651,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -651,10 +651,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* The PCI device starts with a reference taken and we are /* The PCI device starts with a reference taken and we are
* supposed to release it here. But to simplify the * supposed to release it here. But to simplify the
* interaction with the opmode, we don't do it now, but let * interaction with the opmode, we don't do it now, but let
* the opmode release it when it's ready. To account for this * the opmode release it when it's ready.
* reference, we start with ref_count set to 1.
*/ */
trans_pcie->ref_count = 1;
return 0; return 0;
......
...@@ -403,10 +403,6 @@ struct iwl_trans_pcie { ...@@ -403,10 +403,6 @@ struct iwl_trans_pcie {
bool cmd_hold_nic_awake; bool cmd_hold_nic_awake;
bool ref_cmd_in_flight; bool ref_cmd_in_flight;
/* protect ref counter */
spinlock_t ref_lock;
u32 ref_count;
dma_addr_t fw_mon_phys; dma_addr_t fw_mon_phys;
struct page *fw_mon_page; struct page *fw_mon_page;
u32 fw_mon_size; u32 fw_mon_size;
......
...@@ -2015,38 +2015,32 @@ static void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg, ...@@ -2015,38 +2015,32 @@ static void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg,
void iwl_trans_pcie_ref(struct iwl_trans *trans) void iwl_trans_pcie_ref(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
unsigned long flags;
if (iwlwifi_mod_params.d0i3_disable) if (iwlwifi_mod_params.d0i3_disable)
return; return;
spin_lock_irqsave(&trans_pcie->ref_lock, flags);
IWL_DEBUG_RPM(trans, "ref_counter: %d\n", trans_pcie->ref_count);
trans_pcie->ref_count++;
pm_runtime_get(&trans_pcie->pci_dev->dev); pm_runtime_get(&trans_pcie->pci_dev->dev);
spin_unlock_irqrestore(&trans_pcie->ref_lock, flags);
#ifdef CONFIG_PM
IWL_DEBUG_RPM(trans, "runtime usage count: %d\n",
atomic_read(&trans_pcie->pci_dev->dev.power.usage_count));
#endif /* CONFIG_PM */
} }
void iwl_trans_pcie_unref(struct iwl_trans *trans) void iwl_trans_pcie_unref(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
unsigned long flags;
if (iwlwifi_mod_params.d0i3_disable) if (iwlwifi_mod_params.d0i3_disable)
return; return;
spin_lock_irqsave(&trans_pcie->ref_lock, flags);
IWL_DEBUG_RPM(trans, "ref_counter: %d\n", trans_pcie->ref_count);
if (WARN_ON_ONCE(trans_pcie->ref_count == 0)) {
spin_unlock_irqrestore(&trans_pcie->ref_lock, flags);
return;
}
trans_pcie->ref_count--;
pm_runtime_mark_last_busy(&trans_pcie->pci_dev->dev); pm_runtime_mark_last_busy(&trans_pcie->pci_dev->dev);
pm_runtime_put_autosuspend(&trans_pcie->pci_dev->dev); pm_runtime_put_autosuspend(&trans_pcie->pci_dev->dev);
spin_unlock_irqrestore(&trans_pcie->ref_lock, flags); #ifdef CONFIG_PM
IWL_DEBUG_RPM(trans, "runtime usage count: %d\n",
atomic_read(&trans_pcie->pci_dev->dev.power.usage_count));
#endif /* CONFIG_PM */
} }
static const char *get_csr_string(int cmd) static const char *get_csr_string(int cmd)
...@@ -2794,7 +2788,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, ...@@ -2794,7 +2788,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
trans_pcie->trans = trans; trans_pcie->trans = trans;
spin_lock_init(&trans_pcie->irq_lock); spin_lock_init(&trans_pcie->irq_lock);
spin_lock_init(&trans_pcie->reg_lock); spin_lock_init(&trans_pcie->reg_lock);
spin_lock_init(&trans_pcie->ref_lock);
mutex_init(&trans_pcie->mutex); mutex_init(&trans_pcie->mutex);
init_waitqueue_head(&trans_pcie->ucode_write_waitq); init_waitqueue_head(&trans_pcie->ucode_write_waitq);
trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page); trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment