提交 6f482e37 编写于 作者: S Sara Sharon 提交者: Luca Coelho

iwlwifi: move iwl_drv to be shared across transports

All transports has this structure. By moving it to be
shared, we can get rid of casting to the specific transport
in probe and remove.
Signed-off-by: NSara Sharon <sara.sharon@intel.com>
Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
上级 38398efb
...@@ -761,6 +761,7 @@ enum iwl_plat_pm_mode { ...@@ -761,6 +761,7 @@ enum iwl_plat_pm_mode {
* @ops - pointer to iwl_trans_ops * @ops - pointer to iwl_trans_ops
* @op_mode - pointer to the op_mode * @op_mode - pointer to the op_mode
* @cfg - pointer to the configuration * @cfg - pointer to the configuration
* @drv - pointer to iwl_drv
* @status: a bit-mask of transport status flags * @status: a bit-mask of transport status flags
* @dev - pointer to struct device * that represents the device * @dev - pointer to struct device * that represents the device
* @max_skb_frags: maximum number of fragments an SKB can have when transmitted. * @max_skb_frags: maximum number of fragments an SKB can have when transmitted.
...@@ -804,6 +805,7 @@ struct iwl_trans { ...@@ -804,6 +805,7 @@ struct iwl_trans {
const struct iwl_trans_ops *ops; const struct iwl_trans_ops *ops;
struct iwl_op_mode *op_mode; struct iwl_op_mode *op_mode;
const struct iwl_cfg *cfg; const struct iwl_cfg *cfg;
struct iwl_drv *drv;
enum iwl_trans_state state; enum iwl_trans_state state;
unsigned long status; unsigned long status;
......
...@@ -610,7 +610,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -610,7 +610,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
const struct iwl_cfg *cfg_7265d __maybe_unused = NULL; const struct iwl_cfg *cfg_7265d __maybe_unused = NULL;
const struct iwl_cfg *cfg_9260lc __maybe_unused = NULL; const struct iwl_cfg *cfg_9260lc __maybe_unused = NULL;
struct iwl_trans *iwl_trans; struct iwl_trans *iwl_trans;
struct iwl_trans_pcie *trans_pcie;
int ret; int ret;
iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
...@@ -648,12 +647,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -648,12 +647,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif #endif
pci_set_drvdata(pdev, iwl_trans); pci_set_drvdata(pdev, iwl_trans);
iwl_trans->drv = iwl_drv_start(iwl_trans, cfg);
trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); if (IS_ERR(iwl_trans->drv)) {
trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); ret = PTR_ERR(iwl_trans->drv);
if (IS_ERR(trans_pcie->drv)) {
ret = PTR_ERR(trans_pcie->drv);
goto out_free_trans; goto out_free_trans;
} }
...@@ -692,7 +689,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -692,7 +689,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
out_free_drv: out_free_drv:
iwl_drv_stop(trans_pcie->drv); iwl_drv_stop(iwl_trans->drv);
out_free_trans: out_free_trans:
iwl_trans_pcie_free(iwl_trans); iwl_trans_pcie_free(iwl_trans);
return ret; return ret;
...@@ -701,7 +698,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -701,7 +698,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
static void iwl_pci_remove(struct pci_dev *pdev) static void iwl_pci_remove(struct pci_dev *pdev)
{ {
struct iwl_trans *trans = pci_get_drvdata(pdev); struct iwl_trans *trans = pci_get_drvdata(pdev);
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
/* if RTPM was in use, restore it to the state before probe */ /* if RTPM was in use, restore it to the state before probe */
if (trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) { if (trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) {
...@@ -712,7 +708,7 @@ static void iwl_pci_remove(struct pci_dev *pdev) ...@@ -712,7 +708,7 @@ static void iwl_pci_remove(struct pci_dev *pdev)
pm_runtime_forbid(trans->dev); pm_runtime_forbid(trans->dev);
} }
iwl_drv_stop(trans_pcie->drv); iwl_drv_stop(trans->drv);
iwl_trans_pcie_free(trans); iwl_trans_pcie_free(trans);
} }
......
...@@ -314,7 +314,6 @@ struct iwl_tso_hdr_page { ...@@ -314,7 +314,6 @@ struct iwl_tso_hdr_page {
* @rx_pool: initial pool of iwl_rx_mem_buffer for all the queues * @rx_pool: initial pool of iwl_rx_mem_buffer for all the queues
* @global_table: table mapping received VID from hw to rxb * @global_table: table mapping received VID from hw to rxb
* @rba: allocator for RX replenishing * @rba: allocator for RX replenishing
* @drv - pointer to iwl_drv
* @trans: pointer to the generic transport area * @trans: pointer to the generic transport area
* @scd_base_addr: scheduler sram base address in SRAM * @scd_base_addr: scheduler sram base address in SRAM
* @scd_bc_tbls: pointer to the byte count table of the scheduler * @scd_bc_tbls: pointer to the byte count table of the scheduler
...@@ -352,7 +351,6 @@ struct iwl_trans_pcie { ...@@ -352,7 +351,6 @@ struct iwl_trans_pcie {
struct iwl_rx_mem_buffer *global_table[RX_POOL_SIZE]; struct iwl_rx_mem_buffer *global_table[RX_POOL_SIZE];
struct iwl_rb_allocator rba; struct iwl_rb_allocator rba;
struct iwl_trans *trans; struct iwl_trans *trans;
struct iwl_drv *drv;
struct net_device napi_dev; struct net_device napi_dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册