diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-07-11 03:48:51 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-07-21 10:29:55 -0400 |
commit | d593411084a56124aa9d80aafa15db8463b2d8f7 (patch) | |
tree | cbe550ecb8e7c0a7700e0ed168f1553c25b3d183 /drivers/net/wireless/iwlwifi/iwl-agn.c | |
parent | 41c50542669cd7aec45ad708f5120ff8fdaa1194 (diff) |
iwlagn: simplify the bus architecture
Call iwl_probe with a ready iwl_bus struct. This means that the bus layer
assigns the irq, dev and iwl_bus_ops pointers to iwl_bus before giving it to
iwl_probe.
The device specific struct is allocated together with the common iwl_bus struct
by the bus specific layer. The pointer to the aggregate struct is passed to the
upper layer that holds a pointer to iwl_bus instead of an embedded iw_bus.
The private data given to the PCI subsystem is now iwl_bus and not iwl_priv.
Provide bus_* inliners on the way in order to simplify the syntax.
Rename iwl-pci.h -> iwl-bus.h since it is bus agnostic and represent the
external of the bus layer.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index d3163d8cf6d8..aee62d0726ab 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include "iwl-sta.h" | 55 | #include "iwl-sta.h" |
56 | #include "iwl-agn-calib.h" | 56 | #include "iwl-agn-calib.h" |
57 | #include "iwl-agn.h" | 57 | #include "iwl-agn.h" |
58 | #include "iwl-pci.h" | 58 | #include "iwl-bus.h" |
59 | #include "iwl-trans.h" | 59 | #include "iwl-trans.h" |
60 | 60 | ||
61 | /****************************************************************************** | 61 | /****************************************************************************** |
@@ -580,7 +580,7 @@ static struct attribute_group iwl_attribute_group = { | |||
580 | static void iwl_free_fw_desc(struct iwl_priv *priv, struct fw_desc *desc) | 580 | static void iwl_free_fw_desc(struct iwl_priv *priv, struct fw_desc *desc) |
581 | { | 581 | { |
582 | if (desc->v_addr) | 582 | if (desc->v_addr) |
583 | dma_free_coherent(priv->bus.dev, desc->len, | 583 | dma_free_coherent(priv->bus->dev, desc->len, |
584 | desc->v_addr, desc->p_addr); | 584 | desc->v_addr, desc->p_addr); |
585 | desc->v_addr = NULL; | 585 | desc->v_addr = NULL; |
586 | desc->len = 0; | 586 | desc->len = 0; |
@@ -606,7 +606,7 @@ static int iwl_alloc_fw_desc(struct iwl_priv *priv, struct fw_desc *desc, | |||
606 | return -EINVAL; | 606 | return -EINVAL; |
607 | } | 607 | } |
608 | 608 | ||
609 | desc->v_addr = dma_alloc_coherent(priv->bus.dev, len, | 609 | desc->v_addr = dma_alloc_coherent(priv->bus->dev, len, |
610 | &desc->p_addr, GFP_KERNEL); | 610 | &desc->p_addr, GFP_KERNEL); |
611 | if (!desc->v_addr) | 611 | if (!desc->v_addr) |
612 | return -ENOMEM; | 612 | return -ENOMEM; |
@@ -660,7 +660,7 @@ static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | |||
660 | priv->firmware_name); | 660 | priv->firmware_name); |
661 | 661 | ||
662 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, | 662 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, |
663 | priv->bus.dev, | 663 | priv->bus->dev, |
664 | GFP_KERNEL, priv, iwl_ucode_callback); | 664 | GFP_KERNEL, priv, iwl_ucode_callback); |
665 | } | 665 | } |
666 | 666 | ||
@@ -1163,7 +1163,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1163 | if (err) | 1163 | if (err) |
1164 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 1164 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
1165 | 1165 | ||
1166 | err = sysfs_create_group(&(priv->bus.dev->kobj), | 1166 | err = sysfs_create_group(&(priv->bus->dev->kobj), |
1167 | &iwl_attribute_group); | 1167 | &iwl_attribute_group); |
1168 | if (err) { | 1168 | if (err) { |
1169 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); | 1169 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); |
@@ -1187,7 +1187,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1187 | iwl_dealloc_ucode(priv); | 1187 | iwl_dealloc_ucode(priv); |
1188 | out_unbind: | 1188 | out_unbind: |
1189 | complete(&priv->_agn.firmware_loading_complete); | 1189 | complete(&priv->_agn.firmware_loading_complete); |
1190 | device_release_driver(priv->bus.dev); | 1190 | device_release_driver(priv->bus->dev); |
1191 | release_firmware(ucode_raw); | 1191 | release_firmware(ucode_raw); |
1192 | } | 1192 | } |
1193 | 1193 | ||
@@ -3102,8 +3102,7 @@ static void iwl_init_context(struct iwl_priv *priv) | |||
3102 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); | 3102 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); |
3103 | } | 3103 | } |
3104 | 3104 | ||
3105 | int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, | 3105 | int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg) |
3106 | struct iwl_cfg *cfg) | ||
3107 | { | 3106 | { |
3108 | int err = 0; | 3107 | int err = 0; |
3109 | struct iwl_priv *priv; | 3108 | struct iwl_priv *priv; |
@@ -3121,17 +3120,12 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, | |||
3121 | } | 3120 | } |
3122 | 3121 | ||
3123 | priv = hw->priv; | 3122 | priv = hw->priv; |
3124 | 3123 | priv->bus = bus; | |
3125 | priv->bus.priv = priv; | 3124 | bus_set_drv_data(priv->bus, priv); |
3126 | priv->bus.bus_specific = bus_specific; | ||
3127 | priv->bus.ops = bus_ops; | ||
3128 | priv->bus.irq = priv->bus.ops->get_irq(&priv->bus); | ||
3129 | priv->bus.ops->set_drv_data(&priv->bus, priv); | ||
3130 | priv->bus.dev = priv->bus.ops->get_dev(&priv->bus); | ||
3131 | 3125 | ||
3132 | /* At this point both hw and priv are allocated. */ | 3126 | /* At this point both hw and priv are allocated. */ |
3133 | 3127 | ||
3134 | SET_IEEE80211_DEV(hw, priv->bus.dev); | 3128 | SET_IEEE80211_DEV(hw, priv->bus->dev); |
3135 | 3129 | ||
3136 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); | 3130 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); |
3137 | priv->cfg = cfg; | 3131 | priv->cfg = cfg; |
@@ -3154,7 +3148,6 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, | |||
3154 | if (iwl_alloc_traffic_mem(priv)) | 3148 | if (iwl_alloc_traffic_mem(priv)) |
3155 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); | 3149 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); |
3156 | 3150 | ||
3157 | |||
3158 | /* these spin locks will be used in apm_ops.init and EEPROM access | 3151 | /* these spin locks will be used in apm_ops.init and EEPROM access |
3159 | * we should init now | 3152 | * we should init now |
3160 | */ | 3153 | */ |
@@ -3289,7 +3282,7 @@ void __devexit iwl_remove(struct iwl_priv * priv) | |||
3289 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3282 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
3290 | 3283 | ||
3291 | iwl_dbgfs_unregister(priv); | 3284 | iwl_dbgfs_unregister(priv); |
3292 | sysfs_remove_group(&priv->bus.dev->kobj, | 3285 | sysfs_remove_group(&priv->bus->dev->kobj, |
3293 | &iwl_attribute_group); | 3286 | &iwl_attribute_group); |
3294 | 3287 | ||
3295 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to | 3288 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to |
@@ -3339,7 +3332,7 @@ void __devexit iwl_remove(struct iwl_priv * priv) | |||
3339 | 3332 | ||
3340 | trans_free(&priv->trans); | 3333 | trans_free(&priv->trans); |
3341 | 3334 | ||
3342 | priv->bus.ops->set_drv_data(&priv->bus, NULL); | 3335 | bus_set_drv_data(priv->bus, NULL); |
3343 | 3336 | ||
3344 | iwl_uninit_drv(priv); | 3337 | iwl_uninit_drv(priv); |
3345 | 3338 | ||