Commit 87ce05a2 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Wey-Yi Guy

iwlwifi: remove the shared area

It is not needed any more.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 4b9844f5
...@@ -1507,7 +1507,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, ...@@ -1507,7 +1507,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
op_mode = hw->priv; op_mode = hw->priv;
op_mode->ops = &iwl_dvm_ops; op_mode->ops = &iwl_dvm_ops;
priv = IWL_OP_MODE_GET_DVM(op_mode); priv = IWL_OP_MODE_GET_DVM(op_mode);
priv->shrd = trans->shrd;
priv->trans = trans; priv->trans = trans;
priv->dev = trans->dev; priv->dev = trans->dev;
priv->cfg = cfg; priv->cfg = cfg;
......
...@@ -758,8 +758,6 @@ struct iwl_wipan_noa_data { ...@@ -758,8 +758,6 @@ struct iwl_wipan_noa_data {
struct iwl_priv { struct iwl_priv {
/*data shared among all the driver's layers */
struct iwl_shared *shrd;
struct iwl_trans *trans; struct iwl_trans *trans;
struct device *dev; /* for debug prints only */ struct device *dev; /* for debug prints only */
const struct iwl_cfg *cfg; const struct iwl_cfg *cfg;
......
...@@ -77,7 +77,6 @@ ...@@ -77,7 +77,6 @@
/** /**
* struct iwl_drv - drv common data * struct iwl_drv - drv common data
* @fw: the iwl_fw structure * @fw: the iwl_fw structure
* @shrd: pointer to common shared structure
* @op_mode: the running op_mode * @op_mode: the running op_mode
* @trans: transport layer * @trans: transport layer
* @dev: for debug prints only * @dev: for debug prints only
...@@ -89,7 +88,6 @@ ...@@ -89,7 +88,6 @@
struct iwl_drv { struct iwl_drv {
struct iwl_fw fw; struct iwl_fw fw;
struct iwl_shared *shrd;
struct iwl_op_mode *op_mode; struct iwl_op_mode *op_mode;
struct iwl_trans *trans; struct iwl_trans *trans;
struct device *dev; struct device *dev;
...@@ -885,8 +883,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -885,8 +883,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
device_release_driver(drv->trans->dev); device_release_driver(drv->trans->dev);
} }
struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
struct iwl_trans *trans,
const struct iwl_cfg *cfg) const struct iwl_cfg *cfg)
{ {
struct iwl_drv *drv; struct iwl_drv *drv;
...@@ -897,8 +894,6 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, ...@@ -897,8 +894,6 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd,
dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv"); dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_drv");
return NULL; return NULL;
} }
/* For printing only - temporary until we change the logger */
drv->shrd = shrd;
drv->trans = trans; drv->trans = trans;
drv->dev = trans->dev; drv->dev = trans->dev;
drv->cfg = cfg; drv->cfg = cfg;
......
...@@ -91,30 +91,25 @@ ...@@ -91,30 +91,25 @@
*/ */
struct iwl_drv; struct iwl_drv;
struct iwl_trans;
/** /**
* iwl_drv_start - start the drv * iwl_drv_start - start the drv
* *
* @shrd: the shrd area
* @trans_ops: the ops of the transport * @trans_ops: the ops of the transport
* @cfg: device specific constants / virtual functions * @cfg: device specific constants / virtual functions
* *
* TODO: review the parameters given to this function
*
* starts the driver: fetches the firmware. This should be called by bus * starts the driver: fetches the firmware. This should be called by bus
* specific system flows implementations. For example, the bus specific probe * specific system flows implementations. For example, the bus specific probe
* function should do bus related operations only, and then call to this * function should do bus related operations only, and then call to this
* function. It returns the driver object or %NULL if an error occured. * function. It returns the driver object or %NULL if an error occured.
*/ */
struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
struct iwl_trans *trans,
const struct iwl_cfg *cfg); const struct iwl_cfg *cfg);
/** /**
* iwl_drv_stop - stop the drv * iwl_drv_stop - stop the drv
* *
* @shrd: the shrd area * @drv:
*
* TODO: review the parameters given to this function
* *
* Stop the driver. This should be called by bus specific system flows * Stop the driver. This should be called by bus specific system flows
* implementations. For example, the bus specific remove function should first * implementations. For example, the bus specific remove function should first
......
...@@ -268,30 +268,17 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); ...@@ -268,30 +268,17 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
struct iwl_shared *shrd;
struct iwl_trans *iwl_trans; struct iwl_trans *iwl_trans;
struct iwl_trans_pcie *trans_pcie; struct iwl_trans_pcie *trans_pcie;
int err;
iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL); if (iwl_trans == NULL)
if (!shrd) { return -ENOMEM;
dev_printk(KERN_ERR, &pdev->dev,
"Couldn't allocate iwl_shared");
err = -ENOMEM;
goto out_free_bus;
}
iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent, cfg);
if (iwl_trans == NULL) {
err = -ENOMEM;
goto out_free_bus;
}
shrd->trans = iwl_trans;
pci_set_drvdata(pdev, iwl_trans); pci_set_drvdata(pdev, iwl_trans);
trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
trans_pcie->drv = iwl_drv_start(shrd, iwl_trans, cfg); trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);
if (!trans_pcie->drv) if (!trans_pcie->drv)
goto out_free_trans; goto out_free_trans;
...@@ -300,23 +287,18 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -300,23 +287,18 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
out_free_trans: out_free_trans:
iwl_trans_free(iwl_trans); iwl_trans_free(iwl_trans);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
out_free_bus: return -EFAULT;
kfree(shrd);
return err;
} }
static void __devexit iwl_pci_remove(struct pci_dev *pdev) static void __devexit 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); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_shared *shrd = trans->shrd;
iwl_drv_stop(trans_pcie->drv); iwl_drv_stop(trans_pcie->drv);
iwl_trans_free(trans); iwl_trans_free(trans);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(shrd);
} }
#endif /* CONFIG_IWLWIFI_IDI */ #endif /* CONFIG_IWLWIFI_IDI */
......
...@@ -72,32 +72,6 @@ ...@@ -72,32 +72,6 @@
#include "iwl-fw.h" #include "iwl-fw.h"
#include "iwl-config.h" #include "iwl-config.h"
/**
* DOC: shared area - role and goal
*
* The shared area contains all the data exported by the upper layer to the
* other layers. Since the bus and transport layer shouldn't dereference
* iwl_priv, all the data needed by the upper layer and the transport / bus
* layer must be here.
* The shared area also holds pointer to all the other layers. This allows a
* layer to call a function from another layer.
*
* NOTE: All the layers hold a pointer to the shared area which must be shrd.
* A few macros assume that (_m)->shrd points to the shared area no matter
* what _m is.
*
* gets notifications about enumeration, suspend, resume.
* For the moment, the bus layer is not a linux kernel module as itself, and
* the module_init function of the driver must call the bus specific
* registration functions. These functions are listed at the end of this file.
* For the moment, there is only one implementation of this interface: PCI-e.
* This implementation is iwl-pci.c
*/
struct iwl_priv;
struct iwl_trans;
struct iwl_trans_ops;
#define DRV_NAME "iwlwifi" #define DRV_NAME "iwlwifi"
#define IWLWIFI_VERSION "in-tree:" #define IWLWIFI_VERSION "in-tree:"
#define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation" #define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation"
...@@ -147,18 +121,6 @@ struct iwl_mod_params { ...@@ -147,18 +121,6 @@ struct iwl_mod_params {
bool auto_agg; bool auto_agg;
}; };
/**
* struct iwl_shared - shared fields for all the layers of the driver
*
* @trans: pointer to the transport layer data
*/
struct iwl_shared {
struct iwl_trans *trans;
};
/*Whatever _m is (iwl_trans, iwl_priv, these macros will work */
#define trans(_m) ((_m)->shrd->trans)
static inline bool iwl_have_debug_level(u32 level) static inline bool iwl_have_debug_level(u32 level)
{ {
return iwlagn_mod_params.debug_level & level; return iwlagn_mod_params.debug_level & level;
......
...@@ -1567,7 +1567,6 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans) ...@@ -1567,7 +1567,6 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans)
pci_release_regions(trans_pcie->pci_dev); pci_release_regions(trans_pcie->pci_dev);
pci_disable_device(trans_pcie->pci_dev); pci_disable_device(trans_pcie->pci_dev);
trans->shrd->trans = NULL;
kfree(trans); kfree(trans);
} }
...@@ -2083,8 +2082,7 @@ const struct iwl_trans_ops trans_ops_pcie = { ...@@ -2083,8 +2082,7 @@ const struct iwl_trans_ops trans_ops_pcie = {
.set_pmi = iwl_trans_pcie_set_pmi, .set_pmi = iwl_trans_pcie_set_pmi,
}; };
struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
struct pci_dev *pdev,
const struct pci_device_id *ent, const struct pci_device_id *ent,
const struct iwl_cfg *cfg) const struct iwl_cfg *cfg)
{ {
...@@ -2102,7 +2100,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, ...@@ -2102,7 +2100,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
trans->ops = &trans_ops_pcie; trans->ops = &trans_ops_pcie;
trans->shrd = shrd;
trans->cfg = cfg; trans->cfg = cfg;
trans_pcie->trans = trans; trans_pcie->trans = trans;
spin_lock_init(&trans_pcie->irq_lock); spin_lock_init(&trans_pcie->irq_lock);
......
...@@ -326,6 +326,8 @@ struct iwl_trans_config { ...@@ -326,6 +326,8 @@ struct iwl_trans_config {
const char **command_names; const char **command_names;
}; };
struct iwl_trans;
/** /**
* struct iwl_trans_ops - transport specific operations * struct iwl_trans_ops - transport specific operations
* *
...@@ -428,7 +430,6 @@ enum iwl_trans_state { ...@@ -428,7 +430,6 @@ enum iwl_trans_state {
* *
* @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
* @shrd - pointer to iwl_shared which holds shared data from the upper layer
* @cfg - pointer to the configuration * @cfg - pointer to the configuration
* @reg_lock - protect hw register access * @reg_lock - protect hw register access
* @dev - pointer to struct device * that represents the device * @dev - pointer to struct device * that represents the device
...@@ -441,7 +442,6 @@ enum iwl_trans_state { ...@@ -441,7 +442,6 @@ enum iwl_trans_state {
struct iwl_trans { 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;
struct iwl_shared *shrd;
const struct iwl_cfg *cfg; const struct iwl_cfg *cfg;
enum iwl_trans_state state; enum iwl_trans_state state;
spinlock_t reg_lock; spinlock_t reg_lock;
...@@ -625,16 +625,14 @@ static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) ...@@ -625,16 +625,14 @@ static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
struct pci_dev; struct pci_dev;
struct pci_device_id; struct pci_device_id;
extern const struct iwl_trans_ops trans_ops_pcie; extern const struct iwl_trans_ops trans_ops_pcie;
struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
struct pci_dev *pdev,
const struct pci_device_id *ent, const struct pci_device_id *ent,
const struct iwl_cfg *cfg); const struct iwl_cfg *cfg);
int __must_check iwl_pci_register_driver(void); int __must_check iwl_pci_register_driver(void);
void iwl_pci_unregister_driver(void); void iwl_pci_unregister_driver(void);
extern const struct iwl_trans_ops trans_ops_idi; extern const struct iwl_trans_ops trans_ops_idi;
struct iwl_trans *iwl_trans_idi_alloc(struct iwl_shared *shrd, struct iwl_trans *iwl_trans_idi_alloc(void *pdev_void,
void *pdev_void,
const void *ent_void, const void *ent_void,
const struct iwl_cfg *cfg); const struct iwl_cfg *cfg);
#endif /* __iwl_trans_h__ */ #endif /* __iwl_trans_h__ */
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