diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2012-03-26 12:03:18 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2012-04-18 10:31:23 -0400 |
commit | 87ce05a251227c0b607c6395f24ace96fc592806 (patch) | |
tree | ab9e5437a83d63fecf46bd25476ce6ef56407b61 | |
parent | 4b9844f5d887e31c18b9aad862b7ef5fde016d9b (diff) |
iwlwifi: remove the shared area
It is not needed any more.
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-agn.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-drv.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-drv.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-pci.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-shared.h | 38 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 10 |
8 files changed, 16 insertions, 90 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 3f8b30dda568..948529f4b736 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1507,7 +1507,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1507 | op_mode = hw->priv; | 1507 | op_mode = hw->priv; |
1508 | op_mode->ops = &iwl_dvm_ops; | 1508 | op_mode->ops = &iwl_dvm_ops; |
1509 | priv = IWL_OP_MODE_GET_DVM(op_mode); | 1509 | priv = IWL_OP_MODE_GET_DVM(op_mode); |
1510 | priv->shrd = trans->shrd; | ||
1511 | priv->trans = trans; | 1510 | priv->trans = trans; |
1512 | priv->dev = trans->dev; | 1511 | priv->dev = trans->dev; |
1513 | priv->cfg = cfg; | 1512 | priv->cfg = cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 185289f0323a..22386a71a790 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -758,8 +758,6 @@ struct iwl_wipan_noa_data { | |||
758 | 758 | ||
759 | struct iwl_priv { | 759 | struct iwl_priv { |
760 | 760 | ||
761 | /*data shared among all the driver's layers */ | ||
762 | struct iwl_shared *shrd; | ||
763 | struct iwl_trans *trans; | 761 | struct iwl_trans *trans; |
764 | struct device *dev; /* for debug prints only */ | 762 | struct device *dev; /* for debug prints only */ |
765 | const struct iwl_cfg *cfg; | 763 | const struct iwl_cfg *cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index 1221a8c15a1f..1219c0de5730 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -77,7 +77,6 @@ | |||
77 | /** | 77 | /** |
78 | * struct iwl_drv - drv common data | 78 | * struct iwl_drv - drv common data |
79 | * @fw: the iwl_fw structure | 79 | * @fw: the iwl_fw structure |
80 | * @shrd: pointer to common shared structure | ||
81 | * @op_mode: the running op_mode | 80 | * @op_mode: the running op_mode |
82 | * @trans: transport layer | 81 | * @trans: transport layer |
83 | * @dev: for debug prints only | 82 | * @dev: for debug prints only |
@@ -89,7 +88,6 @@ | |||
89 | struct iwl_drv { | 88 | struct iwl_drv { |
90 | struct iwl_fw fw; | 89 | struct iwl_fw fw; |
91 | 90 | ||
92 | struct iwl_shared *shrd; | ||
93 | struct iwl_op_mode *op_mode; | 91 | struct iwl_op_mode *op_mode; |
94 | struct iwl_trans *trans; | 92 | struct iwl_trans *trans; |
95 | struct device *dev; | 93 | struct device *dev; |
@@ -885,8 +883,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
885 | device_release_driver(drv->trans->dev); | 883 | device_release_driver(drv->trans->dev); |
886 | } | 884 | } |
887 | 885 | ||
888 | struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, | 886 | struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, |
889 | struct iwl_trans *trans, | ||
890 | const struct iwl_cfg *cfg) | 887 | const struct iwl_cfg *cfg) |
891 | { | 888 | { |
892 | struct iwl_drv *drv; | 889 | struct iwl_drv *drv; |
@@ -897,8 +894,6 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, | |||
897 | dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); | 894 | dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); |
898 | return NULL; | 895 | return NULL; |
899 | } | 896 | } |
900 | /* For printing only - temporary until we change the logger */ | ||
901 | drv->shrd = shrd; | ||
902 | drv->trans = trans; | 897 | drv->trans = trans; |
903 | drv->dev = trans->dev; | 898 | drv->dev = trans->dev; |
904 | drv->cfg = cfg; | 899 | drv->cfg = cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.h b/drivers/net/wireless/iwlwifi/iwl-drv.h index 290a3680ed3e..b6739826ff71 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.h +++ b/drivers/net/wireless/iwlwifi/iwl-drv.h | |||
@@ -91,30 +91,25 @@ | |||
91 | */ | 91 | */ |
92 | 92 | ||
93 | struct iwl_drv; | 93 | struct iwl_drv; |
94 | struct iwl_trans; | ||
94 | /** | 95 | /** |
95 | * iwl_drv_start - start the drv | 96 | * iwl_drv_start - start the drv |
96 | * | 97 | * |
97 | * @shrd: the shrd area | ||
98 | * @trans_ops: the ops of the transport | 98 | * @trans_ops: the ops of the transport |
99 | * @cfg: device specific constants / virtual functions | 99 | * @cfg: device specific constants / virtual functions |
100 | * | 100 | * |
101 | * TODO: review the parameters given to this function | ||
102 | * | ||
103 | * starts the driver: fetches the firmware. This should be called by bus | 101 | * starts the driver: fetches the firmware. This should be called by bus |
104 | * specific system flows implementations. For example, the bus specific probe | 102 | * specific system flows implementations. For example, the bus specific probe |
105 | * function should do bus related operations only, and then call to this | 103 | * function should do bus related operations only, and then call to this |
106 | * function. It returns the driver object or %NULL if an error occured. | 104 | * function. It returns the driver object or %NULL if an error occured. |
107 | */ | 105 | */ |
108 | struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, | 106 | struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, |
109 | struct iwl_trans *trans, | ||
110 | const struct iwl_cfg *cfg); | 107 | const struct iwl_cfg *cfg); |
111 | 108 | ||
112 | /** | 109 | /** |
113 | * iwl_drv_stop - stop the drv | 110 | * iwl_drv_stop - stop the drv |
114 | * | 111 | * |
115 | * @shrd: the shrd area | 112 | * @drv: |
116 | * | ||
117 | * TODO: review the parameters given to this function | ||
118 | * | 113 | * |
119 | * Stop the driver. This should be called by bus specific system flows | 114 | * Stop the driver. This should be called by bus specific system flows |
120 | * implementations. For example, the bus specific remove function should first | 115 | * implementations. For example, the bus specific remove function should first |
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index 68974a996136..47db96f12c90 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -268,30 +268,17 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | |||
268 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 268 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
269 | { | 269 | { |
270 | const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 270 | const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
271 | struct iwl_shared *shrd; | ||
272 | struct iwl_trans *iwl_trans; | 271 | struct iwl_trans *iwl_trans; |
273 | struct iwl_trans_pcie *trans_pcie; | 272 | struct iwl_trans_pcie *trans_pcie; |
274 | int err; | 273 | |
275 | 274 | iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); | |
276 | shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL); | 275 | if (iwl_trans == NULL) |
277 | if (!shrd) { | 276 | return -ENOMEM; |
278 | dev_printk(KERN_ERR, &pdev->dev, | 277 | |
279 | "Couldn't allocate iwl_shared"); | ||
280 | err = -ENOMEM; | ||
281 | goto out_free_bus; | ||
282 | } | ||
283 | |||
284 | iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent, cfg); | ||
285 | if (iwl_trans == NULL) { | ||
286 | err = -ENOMEM; | ||
287 | goto out_free_bus; | ||
288 | } | ||
289 | |||
290 | shrd->trans = iwl_trans; | ||
291 | pci_set_drvdata(pdev, iwl_trans); | 278 | pci_set_drvdata(pdev, iwl_trans); |
292 | 279 | ||
293 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); | 280 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); |
294 | trans_pcie->drv = iwl_drv_start(shrd, iwl_trans, cfg); | 281 | trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); |
295 | if (!trans_pcie->drv) | 282 | if (!trans_pcie->drv) |
296 | goto out_free_trans; | 283 | goto out_free_trans; |
297 | 284 | ||
@@ -300,23 +287,18 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
300 | out_free_trans: | 287 | out_free_trans: |
301 | iwl_trans_free(iwl_trans); | 288 | iwl_trans_free(iwl_trans); |
302 | pci_set_drvdata(pdev, NULL); | 289 | pci_set_drvdata(pdev, NULL); |
303 | out_free_bus: | 290 | return -EFAULT; |
304 | kfree(shrd); | ||
305 | return err; | ||
306 | } | 291 | } |
307 | 292 | ||
308 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) | 293 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) |
309 | { | 294 | { |
310 | struct iwl_trans *trans = pci_get_drvdata(pdev); | 295 | struct iwl_trans *trans = pci_get_drvdata(pdev); |
311 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 296 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
312 | struct iwl_shared *shrd = trans->shrd; | ||
313 | 297 | ||
314 | iwl_drv_stop(trans_pcie->drv); | 298 | iwl_drv_stop(trans_pcie->drv); |
315 | iwl_trans_free(trans); | 299 | iwl_trans_free(trans); |
316 | 300 | ||
317 | pci_set_drvdata(pdev, NULL); | 301 | pci_set_drvdata(pdev, NULL); |
318 | |||
319 | kfree(shrd); | ||
320 | } | 302 | } |
321 | 303 | ||
322 | #endif /* CONFIG_IWLWIFI_IDI */ | 304 | #endif /* CONFIG_IWLWIFI_IDI */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index 3ebe96eb346b..8bb56f2b6152 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
@@ -72,32 +72,6 @@ | |||
72 | #include "iwl-fw.h" | 72 | #include "iwl-fw.h" |
73 | #include "iwl-config.h" | 73 | #include "iwl-config.h" |
74 | 74 | ||
75 | /** | ||
76 | * DOC: shared area - role and goal | ||
77 | * | ||
78 | * The shared area contains all the data exported by the upper layer to the | ||
79 | * other layers. Since the bus and transport layer shouldn't dereference | ||
80 | * iwl_priv, all the data needed by the upper layer and the transport / bus | ||
81 | * layer must be here. | ||
82 | * The shared area also holds pointer to all the other layers. This allows a | ||
83 | * layer to call a function from another layer. | ||
84 | * | ||
85 | * NOTE: All the layers hold a pointer to the shared area which must be shrd. | ||
86 | * A few macros assume that (_m)->shrd points to the shared area no matter | ||
87 | * what _m is. | ||
88 | * | ||
89 | * gets notifications about enumeration, suspend, resume. | ||
90 | * For the moment, the bus layer is not a linux kernel module as itself, and | ||
91 | * the module_init function of the driver must call the bus specific | ||
92 | * registration functions. These functions are listed at the end of this file. | ||
93 | * For the moment, there is only one implementation of this interface: PCI-e. | ||
94 | * This implementation is iwl-pci.c | ||
95 | */ | ||
96 | |||
97 | struct iwl_priv; | ||
98 | struct iwl_trans; | ||
99 | struct iwl_trans_ops; | ||
100 | |||
101 | #define DRV_NAME "iwlwifi" | 75 | #define DRV_NAME "iwlwifi" |
102 | #define IWLWIFI_VERSION "in-tree:" | 76 | #define IWLWIFI_VERSION "in-tree:" |
103 | #define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation" | 77 | #define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation" |
@@ -147,18 +121,6 @@ struct iwl_mod_params { | |||
147 | bool auto_agg; | 121 | bool auto_agg; |
148 | }; | 122 | }; |
149 | 123 | ||
150 | /** | ||
151 | * struct iwl_shared - shared fields for all the layers of the driver | ||
152 | * | ||
153 | * @trans: pointer to the transport layer data | ||
154 | */ | ||
155 | struct iwl_shared { | ||
156 | struct iwl_trans *trans; | ||
157 | }; | ||
158 | |||
159 | /*Whatever _m is (iwl_trans, iwl_priv, these macros will work */ | ||
160 | #define trans(_m) ((_m)->shrd->trans) | ||
161 | |||
162 | static inline bool iwl_have_debug_level(u32 level) | 124 | static inline bool iwl_have_debug_level(u32 level) |
163 | { | 125 | { |
164 | return iwlagn_mod_params.debug_level & level; | 126 | return iwlagn_mod_params.debug_level & level; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index 76f05ea1ad38..72ee1e6fcb9f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -1567,7 +1567,6 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans) | |||
1567 | pci_release_regions(trans_pcie->pci_dev); | 1567 | pci_release_regions(trans_pcie->pci_dev); |
1568 | pci_disable_device(trans_pcie->pci_dev); | 1568 | pci_disable_device(trans_pcie->pci_dev); |
1569 | 1569 | ||
1570 | trans->shrd->trans = NULL; | ||
1571 | kfree(trans); | 1570 | kfree(trans); |
1572 | } | 1571 | } |
1573 | 1572 | ||
@@ -2083,8 +2082,7 @@ const struct iwl_trans_ops trans_ops_pcie = { | |||
2083 | .set_pmi = iwl_trans_pcie_set_pmi, | 2082 | .set_pmi = iwl_trans_pcie_set_pmi, |
2084 | }; | 2083 | }; |
2085 | 2084 | ||
2086 | struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, | 2085 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
2087 | struct pci_dev *pdev, | ||
2088 | const struct pci_device_id *ent, | 2086 | const struct pci_device_id *ent, |
2089 | const struct iwl_cfg *cfg) | 2087 | const struct iwl_cfg *cfg) |
2090 | { | 2088 | { |
@@ -2102,7 +2100,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, | |||
2102 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 2100 | trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
2103 | 2101 | ||
2104 | trans->ops = &trans_ops_pcie; | 2102 | trans->ops = &trans_ops_pcie; |
2105 | trans->shrd = shrd; | ||
2106 | trans->cfg = cfg; | 2103 | trans->cfg = cfg; |
2107 | trans_pcie->trans = trans; | 2104 | trans_pcie->trans = trans; |
2108 | spin_lock_init(&trans_pcie->irq_lock); | 2105 | spin_lock_init(&trans_pcie->irq_lock); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 80e33997a9e1..b28de2bfe647 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -326,6 +326,8 @@ struct iwl_trans_config { | |||
326 | const char **command_names; | 326 | const char **command_names; |
327 | }; | 327 | }; |
328 | 328 | ||
329 | struct iwl_trans; | ||
330 | |||
329 | /** | 331 | /** |
330 | * struct iwl_trans_ops - transport specific operations | 332 | * struct iwl_trans_ops - transport specific operations |
331 | * | 333 | * |
@@ -428,7 +430,6 @@ enum iwl_trans_state { | |||
428 | * | 430 | * |
429 | * @ops - pointer to iwl_trans_ops | 431 | * @ops - pointer to iwl_trans_ops |
430 | * @op_mode - pointer to the op_mode | 432 | * @op_mode - pointer to the op_mode |
431 | * @shrd - pointer to iwl_shared which holds shared data from the upper layer | ||
432 | * @cfg - pointer to the configuration | 433 | * @cfg - pointer to the configuration |
433 | * @reg_lock - protect hw register access | 434 | * @reg_lock - protect hw register access |
434 | * @dev - pointer to struct device * that represents the device | 435 | * @dev - pointer to struct device * that represents the device |
@@ -441,7 +442,6 @@ enum iwl_trans_state { | |||
441 | struct iwl_trans { | 442 | struct iwl_trans { |
442 | const struct iwl_trans_ops *ops; | 443 | const struct iwl_trans_ops *ops; |
443 | struct iwl_op_mode *op_mode; | 444 | struct iwl_op_mode *op_mode; |
444 | struct iwl_shared *shrd; | ||
445 | const struct iwl_cfg *cfg; | 445 | const struct iwl_cfg *cfg; |
446 | enum iwl_trans_state state; | 446 | enum iwl_trans_state state; |
447 | spinlock_t reg_lock; | 447 | spinlock_t reg_lock; |
@@ -625,16 +625,14 @@ static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) | |||
625 | struct pci_dev; | 625 | struct pci_dev; |
626 | struct pci_device_id; | 626 | struct pci_device_id; |
627 | extern const struct iwl_trans_ops trans_ops_pcie; | 627 | extern const struct iwl_trans_ops trans_ops_pcie; |
628 | struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, | 628 | struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
629 | struct pci_dev *pdev, | ||
630 | const struct pci_device_id *ent, | 629 | const struct pci_device_id *ent, |
631 | const struct iwl_cfg *cfg); | 630 | const struct iwl_cfg *cfg); |
632 | int __must_check iwl_pci_register_driver(void); | 631 | int __must_check iwl_pci_register_driver(void); |
633 | void iwl_pci_unregister_driver(void); | 632 | void iwl_pci_unregister_driver(void); |
634 | 633 | ||
635 | extern const struct iwl_trans_ops trans_ops_idi; | 634 | extern const struct iwl_trans_ops trans_ops_idi; |
636 | struct iwl_trans *iwl_trans_idi_alloc(struct iwl_shared *shrd, | 635 | struct iwl_trans *iwl_trans_idi_alloc(void *pdev_void, |
637 | void *pdev_void, | ||
638 | const void *ent_void, | 636 | const void *ent_void, |
639 | const struct iwl_cfg *cfg); | 637 | const struct iwl_cfg *cfg); |
640 | #endif /* __iwl_trans_h__ */ | 638 | #endif /* __iwl_trans_h__ */ |