diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-05-31 01:52:10 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-06-18 11:06:24 -0400 |
commit | 3599d39a8525b01540e2c7ec8c5d0df0dd11d6cf (patch) | |
tree | fb9c0b512ac042c1b483d6ff754cd1fd8af5e135 /drivers/net | |
parent | a48709c5d076aa3a3f9b6426f462abe6bf432b11 (diff) |
iwlagn: add get_dev to iwl_bus_ops
Bus specific layer must know how to return the struct device* of the device.
Implement that as a callback of iwl_bus_ops and use that callback instead of
using the priv->pdev pointer which is meant to disappear soon.
Since the struct device * is needed in hot path, iwl_bus holds a pointer to it
instead of calling get_dev all the time.
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')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-ict.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 53 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debug.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-led.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-pci.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sv-open.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-tx.c | 6 |
11 files changed, 60 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ict.c b/drivers/net/wireless/iwlwifi/iwl-agn-ict.c index 0d5fda44c3a3..f1b40ec1c873 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ict.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ict.c | |||
@@ -44,7 +44,7 @@ | |||
44 | void iwl_free_isr_ict(struct iwl_priv *priv) | 44 | void iwl_free_isr_ict(struct iwl_priv *priv) |
45 | { | 45 | { |
46 | if (priv->_agn.ict_tbl_vir) { | 46 | if (priv->_agn.ict_tbl_vir) { |
47 | dma_free_coherent(&priv->pci_dev->dev, | 47 | dma_free_coherent(priv->bus.dev, |
48 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, | 48 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, |
49 | priv->_agn.ict_tbl_vir, | 49 | priv->_agn.ict_tbl_vir, |
50 | priv->_agn.ict_tbl_dma); | 50 | priv->_agn.ict_tbl_dma); |
@@ -61,7 +61,7 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv) | |||
61 | 61 | ||
62 | /* allocate shrared data table */ | 62 | /* allocate shrared data table */ |
63 | priv->_agn.ict_tbl_vir = | 63 | priv->_agn.ict_tbl_vir = |
64 | dma_alloc_coherent(&priv->pci_dev->dev, | 64 | dma_alloc_coherent(priv->bus.dev, |
65 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, | 65 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, |
66 | &priv->_agn.ict_tbl_dma, GFP_KERNEL); | 66 | &priv->_agn.ict_tbl_dma, GFP_KERNEL); |
67 | if (!priv->_agn.ict_tbl_vir) | 67 | if (!priv->_agn.ict_tbl_vir) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 99d473f527d5..4c11edcb4e61 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -966,9 +966,10 @@ void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
966 | } | 966 | } |
967 | } | 967 | } |
968 | 968 | ||
969 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 969 | dma_free_coherent(priv->bus.dev, 4 * RX_QUEUE_SIZE, |
970 | rxq->bd_dma); | 970 | rxq->bd, rxq->bd_dma); |
971 | dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), | 971 | dma_free_coherent(priv->bus.dev, |
972 | sizeof(struct iwl_rb_status), | ||
972 | rxq->rb_stts, rxq->rb_stts_dma); | 973 | rxq->rb_stts, rxq->rb_stts_dma); |
973 | rxq->bd = NULL; | 974 | rxq->bd = NULL; |
974 | rxq->rb_stts = NULL; | 975 | rxq->rb_stts = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index 8bd48f61a9f5..f4e5edefd066 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -834,8 +834,8 @@ drop_unlock_priv: | |||
834 | static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv, | 834 | static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv, |
835 | struct iwl_dma_ptr *ptr, size_t size) | 835 | struct iwl_dma_ptr *ptr, size_t size) |
836 | { | 836 | { |
837 | ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, | 837 | ptr->addr = dma_alloc_coherent(priv->bus.dev, size, |
838 | GFP_KERNEL); | 838 | &ptr->dma, GFP_KERNEL); |
839 | if (!ptr->addr) | 839 | if (!ptr->addr) |
840 | return -ENOMEM; | 840 | return -ENOMEM; |
841 | ptr->size = size; | 841 | ptr->size = size; |
@@ -848,7 +848,8 @@ static inline void iwlagn_free_dma_ptr(struct iwl_priv *priv, | |||
848 | if (unlikely(!ptr->addr)) | 848 | if (unlikely(!ptr->addr)) |
849 | return; | 849 | return; |
850 | 850 | ||
851 | dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); | 851 | dma_free_coherent(priv->bus.dev, |
852 | ptr->size, ptr->addr, ptr->dma); | ||
852 | memset(ptr, 0, sizeof(*ptr)); | 853 | memset(ptr, 0, sizeof(*ptr)); |
853 | } | 854 | } |
854 | 855 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 1eeb4a75da03..0098245a62ed 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -937,22 +937,28 @@ static struct attribute_group iwl_attribute_group = { | |||
937 | * | 937 | * |
938 | ******************************************************************************/ | 938 | ******************************************************************************/ |
939 | 939 | ||
940 | static void iwl_free_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) | 940 | static void iwl_free_fw_desc(struct iwl_priv *priv, struct fw_desc *desc) |
941 | { | 941 | { |
942 | if (desc->v_addr) | 942 | if (desc->v_addr) |
943 | dma_free_coherent(&pci_dev->dev, desc->len, | 943 | dma_free_coherent(priv->bus.dev, desc->len, |
944 | desc->v_addr, desc->p_addr); | 944 | desc->v_addr, desc->p_addr); |
945 | desc->v_addr = NULL; | 945 | desc->v_addr = NULL; |
946 | desc->len = 0; | 946 | desc->len = 0; |
947 | } | 947 | } |
948 | 948 | ||
949 | static void iwl_free_fw_img(struct pci_dev *pci_dev, struct fw_img *img) | 949 | static void iwl_free_fw_img(struct iwl_priv *priv, struct fw_img *img) |
950 | { | 950 | { |
951 | iwl_free_fw_desc(pci_dev, &img->code); | 951 | iwl_free_fw_desc(priv, &img->code); |
952 | iwl_free_fw_desc(pci_dev, &img->data); | 952 | iwl_free_fw_desc(priv, &img->data); |
953 | } | 953 | } |
954 | 954 | ||
955 | static int iwl_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc, | 955 | static void iwl_dealloc_ucode(struct iwl_priv *priv) |
956 | { | ||
957 | iwl_free_fw_img(priv, &priv->ucode_rt); | ||
958 | iwl_free_fw_img(priv, &priv->ucode_init); | ||
959 | } | ||
960 | |||
961 | static int iwl_alloc_fw_desc(struct iwl_priv *priv, struct fw_desc *desc, | ||
956 | const void *data, size_t len) | 962 | const void *data, size_t len) |
957 | { | 963 | { |
958 | if (!len) { | 964 | if (!len) { |
@@ -960,21 +966,16 @@ static int iwl_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc, | |||
960 | return -EINVAL; | 966 | return -EINVAL; |
961 | } | 967 | } |
962 | 968 | ||
963 | desc->v_addr = dma_alloc_coherent(&pci_dev->dev, len, | 969 | desc->v_addr = dma_alloc_coherent(priv->bus.dev, len, |
964 | &desc->p_addr, GFP_KERNEL); | 970 | &desc->p_addr, GFP_KERNEL); |
965 | if (!desc->v_addr) | 971 | if (!desc->v_addr) |
966 | return -ENOMEM; | 972 | return -ENOMEM; |
973 | |||
967 | desc->len = len; | 974 | desc->len = len; |
968 | memcpy(desc->v_addr, data, len); | 975 | memcpy(desc->v_addr, data, len); |
969 | return 0; | 976 | return 0; |
970 | } | 977 | } |
971 | 978 | ||
972 | static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) | ||
973 | { | ||
974 | iwl_free_fw_img(priv->pci_dev, &priv->ucode_rt); | ||
975 | iwl_free_fw_img(priv->pci_dev, &priv->ucode_init); | ||
976 | } | ||
977 | |||
978 | struct iwlagn_ucode_capabilities { | 979 | struct iwlagn_ucode_capabilities { |
979 | u32 max_probe_length; | 980 | u32 max_probe_length; |
980 | u32 standard_phy_calibration_size; | 981 | u32 standard_phy_calibration_size; |
@@ -1019,8 +1020,8 @@ static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | |||
1019 | priv->firmware_name); | 1020 | priv->firmware_name); |
1020 | 1021 | ||
1021 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, | 1022 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, |
1022 | &priv->pci_dev->dev, GFP_KERNEL, priv, | 1023 | priv->bus.dev, |
1023 | iwl_ucode_callback); | 1024 | GFP_KERNEL, priv, iwl_ucode_callback); |
1024 | } | 1025 | } |
1025 | 1026 | ||
1026 | struct iwlagn_firmware_pieces { | 1027 | struct iwlagn_firmware_pieces { |
@@ -1441,19 +1442,19 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1441 | /* Runtime instructions and 2 copies of data: | 1442 | /* Runtime instructions and 2 copies of data: |
1442 | * 1) unmodified from disk | 1443 | * 1) unmodified from disk |
1443 | * 2) backup cache for save/restore during power-downs */ | 1444 | * 2) backup cache for save/restore during power-downs */ |
1444 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_rt.code, | 1445 | if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.code, |
1445 | pieces.inst, pieces.inst_size)) | 1446 | pieces.inst, pieces.inst_size)) |
1446 | goto err_pci_alloc; | 1447 | goto err_pci_alloc; |
1447 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_rt.data, | 1448 | if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.data, |
1448 | pieces.data, pieces.data_size)) | 1449 | pieces.data, pieces.data_size)) |
1449 | goto err_pci_alloc; | 1450 | goto err_pci_alloc; |
1450 | 1451 | ||
1451 | /* Initialization instructions and data */ | 1452 | /* Initialization instructions and data */ |
1452 | if (pieces.init_size && pieces.init_data_size) { | 1453 | if (pieces.init_size && pieces.init_data_size) { |
1453 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init.code, | 1454 | if (iwl_alloc_fw_desc(priv, &priv->ucode_init.code, |
1454 | pieces.init, pieces.init_size)) | 1455 | pieces.init, pieces.init_size)) |
1455 | goto err_pci_alloc; | 1456 | goto err_pci_alloc; |
1456 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init.data, | 1457 | if (iwl_alloc_fw_desc(priv, &priv->ucode_init.data, |
1457 | pieces.init_data, pieces.init_data_size)) | 1458 | pieces.init_data, pieces.init_data_size)) |
1458 | goto err_pci_alloc; | 1459 | goto err_pci_alloc; |
1459 | } | 1460 | } |
@@ -1522,7 +1523,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1522 | if (err) | 1523 | if (err) |
1523 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 1524 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
1524 | 1525 | ||
1525 | err = sysfs_create_group(&priv->pci_dev->dev.kobj, | 1526 | err = sysfs_create_group(&(priv->bus.dev->kobj), |
1526 | &iwl_attribute_group); | 1527 | &iwl_attribute_group); |
1527 | if (err) { | 1528 | if (err) { |
1528 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); | 1529 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); |
@@ -1543,10 +1544,10 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1543 | 1544 | ||
1544 | err_pci_alloc: | 1545 | err_pci_alloc: |
1545 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 1546 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
1546 | iwl_dealloc_ucode_pci(priv); | 1547 | iwl_dealloc_ucode(priv); |
1547 | out_unbind: | 1548 | out_unbind: |
1548 | complete(&priv->_agn.firmware_loading_complete); | 1549 | complete(&priv->_agn.firmware_loading_complete); |
1549 | device_release_driver(&priv->pci_dev->dev); | 1550 | device_release_driver(priv->bus.dev); |
1550 | release_firmware(ucode_raw); | 1551 | release_firmware(ucode_raw); |
1551 | } | 1552 | } |
1552 | 1553 | ||
@@ -3507,10 +3508,11 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, | |||
3507 | priv->bus.bus_specific = bus_specific; | 3508 | priv->bus.bus_specific = bus_specific; |
3508 | priv->bus.ops = bus_ops; | 3509 | priv->bus.ops = bus_ops; |
3509 | priv->bus.ops->set_drv_data(&priv->bus, priv); | 3510 | priv->bus.ops->set_drv_data(&priv->bus, priv); |
3511 | priv->bus.dev = priv->bus.ops->get_dev(&priv->bus); | ||
3510 | 3512 | ||
3511 | /* At this point both hw and priv are allocated. */ | 3513 | /* At this point both hw and priv are allocated. */ |
3512 | 3514 | ||
3513 | SET_IEEE80211_DEV(hw, &pdev->dev); | 3515 | SET_IEEE80211_DEV(hw, priv->bus.dev); |
3514 | 3516 | ||
3515 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); | 3517 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); |
3516 | priv->cfg = cfg; | 3518 | priv->cfg = cfg; |
@@ -3735,7 +3737,8 @@ void __devexit iwl_remove(struct iwl_priv * priv) | |||
3735 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3737 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
3736 | 3738 | ||
3737 | iwl_dbgfs_unregister(priv); | 3739 | iwl_dbgfs_unregister(priv); |
3738 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); | 3740 | sysfs_remove_group(&priv->bus.dev->kobj, |
3741 | &iwl_attribute_group); | ||
3739 | 3742 | ||
3740 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to | 3743 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to |
3741 | * to be called and iwl_down since we are removing the device | 3744 | * to be called and iwl_down since we are removing the device |
@@ -3765,7 +3768,7 @@ void __devexit iwl_remove(struct iwl_priv * priv) | |||
3765 | 3768 | ||
3766 | iwl_synchronize_irq(priv); | 3769 | iwl_synchronize_irq(priv); |
3767 | 3770 | ||
3768 | iwl_dealloc_ucode_pci(priv); | 3771 | iwl_dealloc_ucode(priv); |
3769 | 3772 | ||
3770 | if (priv->rxq.bd) | 3773 | if (priv->rxq.bd) |
3771 | iwlagn_rx_queue_free(priv, &priv->rxq); | 3774 | iwlagn_rx_queue_free(priv, &priv->rxq); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index c844b512e563..eb95d1a37487 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -32,10 +32,10 @@ | |||
32 | struct iwl_priv; | 32 | struct iwl_priv; |
33 | extern u32 iwl_debug_level; | 33 | extern u32 iwl_debug_level; |
34 | 34 | ||
35 | #define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) | 35 | #define IWL_ERR(p, f, a...) dev_err(p->bus.ops->get_dev(&p->bus), f, ## a) |
36 | #define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) | 36 | #define IWL_WARN(p, f, a...) dev_warn(p->bus.ops->get_dev(&p->bus), f, ## a) |
37 | #define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) | 37 | #define IWL_INFO(p, f, a...) dev_info(p->bus.ops->get_dev(&p->bus), f, ## a) |
38 | #define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) | 38 | #define IWL_CRIT(p, f, a...) dev_crit(p->bus.ops->get_dev(&p->bus), f, ## a) |
39 | 39 | ||
40 | #define iwl_print_hex_error(priv, p, len) \ | 40 | #define iwl_print_hex_error(priv, p, len) \ |
41 | do { \ | 41 | do { \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 8865514226b9..49e6c68f9b75 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1194,9 +1194,11 @@ struct iwl_bus; | |||
1194 | /** | 1194 | /** |
1195 | * struct iwl_bus_ops - bus specific operations | 1195 | * struct iwl_bus_ops - bus specific operations |
1196 | * @set_drv_data: set the priv pointer to the bus layer | 1196 | * @set_drv_data: set the priv pointer to the bus layer |
1197 | * @get_dev: returns the device struct | ||
1197 | */ | 1198 | */ |
1198 | struct iwl_bus_ops { | 1199 | struct iwl_bus_ops { |
1199 | void (*set_drv_data)(struct iwl_bus *bus, void *priv); | 1200 | void (*set_drv_data)(struct iwl_bus *bus, void *priv); |
1201 | struct device *(*get_dev)(const struct iwl_bus *bus); | ||
1200 | }; | 1202 | }; |
1201 | 1203 | ||
1202 | struct iwl_bus { | 1204 | struct iwl_bus { |
@@ -1205,6 +1207,7 @@ struct iwl_bus { | |||
1205 | 1207 | ||
1206 | /* Common data to all buses */ | 1208 | /* Common data to all buses */ |
1207 | struct iwl_priv *priv; /* driver's context */ | 1209 | struct iwl_priv *priv; /* driver's context */ |
1210 | struct device *dev; | ||
1208 | struct iwl_bus_ops *ops; | 1211 | struct iwl_bus_ops *ops; |
1209 | }; | 1212 | }; |
1210 | 1213 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index 7ef2b23565d2..ff08da099754 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
@@ -202,7 +202,8 @@ void iwl_leds_init(struct iwl_priv *priv) | |||
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | 204 | ||
205 | ret = led_classdev_register(&priv->pci_dev->dev, &priv->led); | 205 | ret = led_classdev_register(priv->bus.dev, |
206 | &priv->led); | ||
206 | if (ret) { | 207 | if (ret) { |
207 | kfree(priv->led.name); | 208 | kfree(priv->led.name); |
208 | return; | 209 | return; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index ef9cb0813c69..00458fc2c402 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -86,8 +86,14 @@ static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_priv) | |||
86 | pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_priv); | 86 | pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_priv); |
87 | } | 87 | } |
88 | 88 | ||
89 | static struct device *iwl_pci_get_dev(const struct iwl_bus *bus) | ||
90 | { | ||
91 | return &(IWL_BUS_GET_PCI_DEV(bus)->dev); | ||
92 | } | ||
93 | |||
89 | static struct iwl_bus_ops pci_ops = { | 94 | static struct iwl_bus_ops pci_ops = { |
90 | .set_drv_data = iwl_pci_set_drv_data, | 95 | .set_drv_data = iwl_pci_set_drv_data, |
96 | .get_dev = iwl_pci_get_dev, | ||
91 | }; | 97 | }; |
92 | 98 | ||
93 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ | 99 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index b774517aa9fa..3efa7066e987 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -182,7 +182,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q | |||
182 | int iwl_rx_queue_alloc(struct iwl_priv *priv) | 182 | int iwl_rx_queue_alloc(struct iwl_priv *priv) |
183 | { | 183 | { |
184 | struct iwl_rx_queue *rxq = &priv->rxq; | 184 | struct iwl_rx_queue *rxq = &priv->rxq; |
185 | struct device *dev = &priv->pci_dev->dev; | 185 | struct device *dev = priv->bus.dev; |
186 | int i; | 186 | int i; |
187 | 187 | ||
188 | spin_lock_init(&rxq->lock); | 188 | spin_lock_init(&rxq->lock); |
@@ -213,7 +213,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) | |||
213 | return 0; | 213 | return 0; |
214 | 214 | ||
215 | err_rb: | 215 | err_rb: |
216 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 216 | dma_free_coherent(dev, 4 * RX_QUEUE_SIZE, rxq->bd, |
217 | rxq->bd_dma); | 217 | rxq->bd_dma); |
218 | err_bd: | 218 | err_bd: |
219 | return -ENOMEM; | 219 | return -ENOMEM; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c index 6f626425144e..c00aa5a1b8b8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c +++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c | |||
@@ -180,7 +180,7 @@ void iwl_testmode_init(struct iwl_priv *priv) | |||
180 | 180 | ||
181 | static void iwl_trace_cleanup(struct iwl_priv *priv) | 181 | static void iwl_trace_cleanup(struct iwl_priv *priv) |
182 | { | 182 | { |
183 | struct device *dev = &priv->pci_dev->dev; | 183 | struct device *dev = priv->bus.dev; |
184 | 184 | ||
185 | if (priv->testmode_trace.trace_enabled) { | 185 | if (priv->testmode_trace.trace_enabled) { |
186 | if (priv->testmode_trace.cpu_addr && | 186 | if (priv->testmode_trace.cpu_addr && |
@@ -484,7 +484,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) | |||
484 | struct iwl_priv *priv = hw->priv; | 484 | struct iwl_priv *priv = hw->priv; |
485 | struct sk_buff *skb; | 485 | struct sk_buff *skb; |
486 | int status = 0; | 486 | int status = 0; |
487 | struct device *dev = &priv->pci_dev->dev; | 487 | struct device *dev = priv->bus.dev; |
488 | 488 | ||
489 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { | 489 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { |
490 | case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: | 490 | case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 1084fe0e8a86..f982ac9b8ba2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -266,7 +266,7 @@ void iwl_tx_queue_unmap(struct iwl_priv *priv, int txq_id) | |||
266 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) | 266 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) |
267 | { | 267 | { |
268 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; | 268 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; |
269 | struct device *dev = &priv->pci_dev->dev; | 269 | struct device *dev = priv->bus.dev; |
270 | int i; | 270 | int i; |
271 | 271 | ||
272 | iwl_tx_queue_unmap(priv, txq_id); | 272 | iwl_tx_queue_unmap(priv, txq_id); |
@@ -332,7 +332,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv) | |||
332 | void iwl_cmd_queue_free(struct iwl_priv *priv) | 332 | void iwl_cmd_queue_free(struct iwl_priv *priv) |
333 | { | 333 | { |
334 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; | 334 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; |
335 | struct device *dev = &priv->pci_dev->dev; | 335 | struct device *dev = priv->bus.dev; |
336 | int i; | 336 | int i; |
337 | 337 | ||
338 | iwl_cmd_queue_unmap(priv); | 338 | iwl_cmd_queue_unmap(priv); |
@@ -434,7 +434,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, | |||
434 | static int iwl_tx_queue_alloc(struct iwl_priv *priv, | 434 | static int iwl_tx_queue_alloc(struct iwl_priv *priv, |
435 | struct iwl_tx_queue *txq, u32 id) | 435 | struct iwl_tx_queue *txq, u32 id) |
436 | { | 436 | { |
437 | struct device *dev = &priv->pci_dev->dev; | 437 | struct device *dev = priv->bus.dev; |
438 | size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; | 438 | size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; |
439 | 439 | ||
440 | /* Driver private data, only for Tx (not command) queues, | 440 | /* Driver private data, only for Tx (not command) queues, |