aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-03-26 11:51:09 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-04-18 10:20:06 -0400
commit9130bab137844d9ad3db6ab524de299cd2b9e39d (patch)
tree4a2b641fe5cb716540d049f11b35cd1d06d5e993
parentb5abcf0219263f4e961dca71cbe26e06c5b0ee68 (diff)
iwlwifi: kill shrd->drv, driver points to transport
The driver layer now holds a pointer to the transport, and shrd->drv is not needed any more, so kill it. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.h10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c33
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h2
5 files changed, 42 insertions, 32 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 17485e715424..8e296213938d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -88,6 +88,7 @@ struct iwl_drv {
88 88
89 struct iwl_shared *shrd; 89 struct iwl_shared *shrd;
90 struct iwl_op_mode *op_mode; 90 struct iwl_op_mode *op_mode;
91 struct iwl_trans *trans;
91 92
92 int fw_index; /* firmware we're trying to load */ 93 int fw_index; /* firmware we're trying to load */
93 char firmware_name[25]; /* name of firmware file to load */ 94 char firmware_name[25]; /* name of firmware file to load */
@@ -858,7 +859,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
858 release_firmware(ucode_raw); 859 release_firmware(ucode_raw);
859 complete(&drv->request_firmware_complete); 860 complete(&drv->request_firmware_complete);
860 861
861 drv->op_mode = iwl_dvm_ops.start(drv->shrd->trans, &drv->fw); 862 drv->op_mode = iwl_dvm_ops.start(drv->trans, &drv->fw);
862 863
863 if (!drv->op_mode) 864 if (!drv->op_mode)
864 goto out_unbind; 865 goto out_unbind;
@@ -881,8 +882,9 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
881 device_release_driver(trans(drv)->dev); 882 device_release_driver(trans(drv)->dev);
882} 883}
883 884
884int iwl_drv_start(struct iwl_shared *shrd, 885struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd,
885 struct iwl_trans *trans, const struct iwl_cfg *cfg) 886 struct iwl_trans *trans,
887 const struct iwl_cfg *cfg)
886{ 888{
887 struct iwl_drv *drv; 889 struct iwl_drv *drv;
888 int ret; 890 int ret;
@@ -892,10 +894,11 @@ int iwl_drv_start(struct iwl_shared *shrd,
892 drv = kzalloc(sizeof(*drv), GFP_KERNEL); 894 drv = kzalloc(sizeof(*drv), GFP_KERNEL);
893 if (!drv) { 895 if (!drv) {
894 dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); 896 dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv");
895 return -ENOMEM; 897 return NULL;
896 } 898 }
899 /* For printing only - temporary until we change the logger */
897 drv->shrd = shrd; 900 drv->shrd = shrd;
898 shrd->drv = drv; 901 drv->trans = trans;
899 902
900 init_completion(&drv->request_firmware_complete); 903 init_completion(&drv->request_firmware_complete);
901 904
@@ -904,16 +907,14 @@ int iwl_drv_start(struct iwl_shared *shrd,
904 if (ret) { 907 if (ret) {
905 dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw"); 908 dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw");
906 kfree(drv); 909 kfree(drv);
907 shrd->drv = NULL; 910 drv = NULL;
908 } 911 }
909 912
910 return ret; 913 return drv;
911} 914}
912 915
913void iwl_drv_stop(struct iwl_shared *shrd) 916void iwl_drv_stop(struct iwl_drv *drv)
914{ 917{
915 struct iwl_drv *drv = shrd->drv;
916
917 wait_for_completion(&drv->request_firmware_complete); 918 wait_for_completion(&drv->request_firmware_complete);
918 919
919 /* op_mode can be NULL if its start failed */ 920 /* op_mode can be NULL if its start failed */
@@ -923,5 +924,4 @@ void iwl_drv_stop(struct iwl_shared *shrd)
923 iwl_dealloc_ucode(drv); 924 iwl_dealloc_ucode(drv);
924 925
925 kfree(drv); 926 kfree(drv);
926 shrd->drv = NULL;
927} 927}
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.h b/drivers/net/wireless/iwlwifi/iwl-drv.h
index 3b771c1d9096..290a3680ed3e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.h
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.h
@@ -90,6 +90,7 @@
90 * 8) iwl_ucode_callback starts the wifi implementation to matches the fw 90 * 8) iwl_ucode_callback starts the wifi implementation to matches the fw
91 */ 91 */
92 92
93struct iwl_drv;
93/** 94/**
94 * iwl_drv_start - start the drv 95 * iwl_drv_start - start the drv
95 * 96 *
@@ -102,10 +103,11 @@
102 * starts the driver: fetches the firmware. This should be called by bus 103 * starts the driver: fetches the firmware. This should be called by bus
103 * specific system flows implementations. For example, the bus specific probe 104 * specific system flows implementations. For example, the bus specific probe
104 * function should do bus related operations only, and then call to this 105 * function should do bus related operations only, and then call to this
105 * function. 106 * function. It returns the driver object or %NULL if an error occured.
106 */ 107 */
107int iwl_drv_start(struct iwl_shared *shrd, 108struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd,
108 struct iwl_trans *trans, const struct iwl_cfg *cfg); 109 struct iwl_trans *trans,
110 const struct iwl_cfg *cfg);
109 111
110/** 112/**
111 * iwl_drv_stop - stop the drv 113 * iwl_drv_stop - stop the drv
@@ -118,6 +120,6 @@ int iwl_drv_start(struct iwl_shared *shrd,
118 * implementations. For example, the bus specific remove function should first 120 * implementations. For example, the bus specific remove function should first
119 * call this function and then do the bus related operations only. 121 * call this function and then do the bus related operations only.
120 */ 122 */
121void iwl_drv_stop(struct iwl_shared *shrd); 123void iwl_drv_stop(struct iwl_drv *drv);
122 124
123#endif /* __iwl_drv_h__ */ 125#endif /* __iwl_drv_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 754001581340..00a6dda984be 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -72,6 +72,7 @@
72#include "iwl-cfg.h" 72#include "iwl-cfg.h"
73#include "iwl-drv.h" 73#include "iwl-drv.h"
74#include "iwl-trans.h" 74#include "iwl-trans.h"
75#include "iwl-trans-pcie-int.h"
75 76
76#define IWL_PCI_DEVICE(dev, subdev, cfg) \ 77#define IWL_PCI_DEVICE(dev, subdev, cfg) \
77 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ 78 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
@@ -262,11 +263,14 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
262/* PCI registers */ 263/* PCI registers */
263#define PCI_CFG_RETRY_TIMEOUT 0x041 264#define PCI_CFG_RETRY_TIMEOUT 0x041
264 265
266#ifndef CONFIG_IWLWIFI_IDI
267
265static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 268static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
266{ 269{
267 const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); 270 const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
268 struct iwl_shared *shrd; 271 struct iwl_shared *shrd;
269 struct iwl_trans *iwl_trans; 272 struct iwl_trans *iwl_trans;
273 struct iwl_trans_pcie *trans_pcie;
270 int err; 274 int err;
271 275
272 shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL); 276 shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL);
@@ -277,11 +281,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
277 goto out_free_bus; 281 goto out_free_bus;
278 } 282 }
279 283
280#ifdef CONFIG_IWLWIFI_IDI
281 iwl_trans = iwl_trans_idi_alloc(shrd, pdev, ent);
282#else
283 iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent); 284 iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent);
284#endif
285 if (iwl_trans == NULL) { 285 if (iwl_trans == NULL) {
286 err = -ENOMEM; 286 err = -ENOMEM;
287 goto out_free_bus; 287 goto out_free_bus;
@@ -290,8 +290,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
290 shrd->trans = iwl_trans; 290 shrd->trans = iwl_trans;
291 pci_set_drvdata(pdev, iwl_trans); 291 pci_set_drvdata(pdev, iwl_trans);
292 292
293 err = iwl_drv_start(shrd, iwl_trans, cfg); 293 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
294 if (err) 294 trans_pcie->drv = iwl_drv_start(shrd, iwl_trans, cfg);
295 if (!trans_pcie->drv)
295 goto out_free_trans; 296 goto out_free_trans;
296 297
297 return 0; 298 return 0;
@@ -306,17 +307,20 @@ out_free_bus:
306 307
307static void __devexit iwl_pci_remove(struct pci_dev *pdev) 308static void __devexit iwl_pci_remove(struct pci_dev *pdev)
308{ 309{
309 struct iwl_trans *iwl_trans = pci_get_drvdata(pdev); 310 struct iwl_trans *trans = pci_get_drvdata(pdev);
310 struct iwl_shared *shrd = iwl_trans->shrd; 311 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
312 struct iwl_shared *shrd = trans->shrd;
311 313
312 iwl_drv_stop(shrd); 314 iwl_drv_stop(trans_pcie->drv);
313 iwl_trans_free(shrd->trans); 315 iwl_trans_free(trans);
314 316
315 pci_set_drvdata(pdev, NULL); 317 pci_set_drvdata(pdev, NULL);
316 318
317 kfree(shrd); 319 kfree(shrd);
318} 320}
319 321
322#endif /* CONFIG_IWLWIFI_IDI */
323
320#ifdef CONFIG_PM_SLEEP 324#ifdef CONFIG_PM_SLEEP
321 325
322static int iwl_pci_suspend(struct device *device) 326static int iwl_pci_suspend(struct device *device)
@@ -361,6 +365,15 @@ static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
361 365
362#endif 366#endif
363 367
368#ifdef CONFIG_IWLWIFI_IDI
369/*
370 * Defined externally in iwl-idi.c
371 */
372int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
373void __devexit iwl_pci_remove(struct pci_dev *pdev);
374
375#endif /* CONFIG_IWLWIFI_IDI */
376
364static struct pci_driver iwl_pci_driver = { 377static struct pci_driver iwl_pci_driver = {
365 .name = DRV_NAME, 378 .name = DRV_NAME,
366 .id_table = iwl_hw_card_ids, 379 .id_table = iwl_hw_card_ids,
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 35bd83ce3dae..d5194879988a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -150,19 +150,12 @@ struct iwl_mod_params {
150/** 150/**
151 * struct iwl_shared - shared fields for all the layers of the driver 151 * struct iwl_shared - shared fields for all the layers of the driver
152 * 152 *
153 * @wowlan: are we running wowlan uCode
154 * @bus: pointer to the bus layer data
155 * @cfg: see struct iwl_cfg 153 * @cfg: see struct iwl_cfg
156 * @priv: pointer to the upper layer data
157 * @trans: pointer to the transport layer data 154 * @trans: pointer to the transport layer data
158 * @nic: pointer to the nic data
159 * @lock: protect general shared data
160 * @eeprom: pointer to the eeprom/OTP image
161 */ 155 */
162struct iwl_shared { 156struct iwl_shared {
163 const struct iwl_cfg *cfg; 157 const struct iwl_cfg *cfg;
164 struct iwl_trans *trans; 158 struct iwl_trans *trans;
165 void *drv;
166}; 159};
167 160
168/*Whatever _m is (iwl_trans, iwl_priv, these macros will work */ 161/*Whatever _m is (iwl_trans, iwl_priv, these macros will work */
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 70bdd0e2df38..22e84f1de2dc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -215,6 +215,7 @@ struct iwl_tx_queue {
215 * struct iwl_trans_pcie - PCIe transport specific data 215 * struct iwl_trans_pcie - PCIe transport specific data
216 * @rxq: all the RX queue data 216 * @rxq: all the RX queue data
217 * @rx_replenish: work that will be called when buffers need to be allocated 217 * @rx_replenish: work that will be called when buffers need to be allocated
218 * @drv - pointer to iwl_drv
218 * @trans: pointer to the generic transport area 219 * @trans: pointer to the generic transport area
219 * @irq - the irq number for the device 220 * @irq - the irq number for the device
220 * @irq_requested: true when the irq has been requested 221 * @irq_requested: true when the irq has been requested
@@ -235,6 +236,7 @@ struct iwl_trans_pcie {
235 struct iwl_rx_queue rxq; 236 struct iwl_rx_queue rxq;
236 struct work_struct rx_replenish; 237 struct work_struct rx_replenish;
237 struct iwl_trans *trans; 238 struct iwl_trans *trans;
239 struct iwl_drv *drv;
238 240
239 /* INT ICT Table */ 241 /* INT ICT Table */
240 __le32 *ict_tbl; 242 __le32 *ict_tbl;