aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-01-08 14:19:45 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-02 17:37:34 -0500
commit99673ee556fce2fb973eaa571adb12663330caa9 (patch)
tree89666dd629df5549b246b36e8631a24a69ef2083 /drivers/net/wireless
parent9ca859615212deb7dd0aee26972799d1910d050f (diff)
iwlwifi: kill bus_get_hw_id
Get this information from the transport 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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-bus.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c37
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-testmode.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h3
6 files changed, 10 insertions, 49 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-bus.h b/drivers/net/wireless/iwlwifi/iwl-bus.h
index 61130895428a..30965e0e8ab4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-bus.h
+++ b/drivers/net/wireless/iwlwifi/iwl-bus.h
@@ -119,14 +119,6 @@ struct iwl_shared;
119struct iwl_bus; 119struct iwl_bus;
120 120
121/** 121/**
122 * struct iwl_bus_ops - bus specific operations
123 * @get_hw_id: get hw_id in u32
124 */
125struct iwl_bus_ops {
126 u32 (*get_hw_id)(struct iwl_bus *bus);
127};
128
129/**
130 * struct iwl_bus - bus common data 122 * struct iwl_bus - bus common data
131 * 123 *
132 * This data is common to all bus layer implementations. 124 * This data is common to all bus layer implementations.
@@ -137,7 +129,6 @@ struct iwl_bus_ops {
137 * it allocates the shared data 129 * it allocates the shared data
138 */ 130 */
139struct iwl_bus { 131struct iwl_bus {
140 const struct iwl_bus_ops *ops;
141 struct iwl_shared *shrd; 132 struct iwl_shared *shrd;
142 133
143 /* pointer to bus specific struct */ 134 /* pointer to bus specific struct */
@@ -145,11 +136,6 @@ struct iwl_bus {
145 char bus_specific[0] __attribute__((__aligned__(sizeof(void *)))); 136 char bus_specific[0] __attribute__((__aligned__(sizeof(void *))));
146}; 137};
147 138
148static inline u32 bus_get_hw_id(struct iwl_bus *bus)
149{
150 return bus->ops->get_hw_id(bus);
151}
152
153/***************************************************** 139/*****************************************************
154* Bus layer registration functions 140* Bus layer registration functions
155******************************************************/ 141******************************************************/
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index b911837b04fa..78bc1e857b00 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -234,7 +234,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
234 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 234 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
235 &priv->bands[IEEE80211_BAND_5GHZ]; 235 &priv->bands[IEEE80211_BAND_5GHZ];
236 236
237 hw->wiphy->hw_version = bus_get_hw_id(bus(priv)); 237 hw->wiphy->hw_version = trans(priv)->hw_id;
238 238
239 iwl_leds_init(priv); 239 iwl_leds_init(priv);
240 240
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 15864760733a..3e2fce4ce00c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -71,33 +71,6 @@
71#include "iwl-csr.h" 71#include "iwl-csr.h"
72#include "iwl-cfg.h" 72#include "iwl-cfg.h"
73 73
74/* PCI registers */
75#define PCI_CFG_RETRY_TIMEOUT 0x041
76#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
77#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
78
79struct iwl_pci_bus {
80 /* basic pci-network driver stuff */
81 struct pci_dev *pci_dev;
82};
83
84#define IWL_BUS_GET_PCI_BUS(_iwl_bus) \
85 ((struct iwl_pci_bus *) ((_iwl_bus)->bus_specific))
86
87#define IWL_BUS_GET_PCI_DEV(_iwl_bus) \
88 ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev)
89
90static u32 iwl_pci_get_hw_id(struct iwl_bus *bus)
91{
92 struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
93
94 return (pci_dev->device << 16) + pci_dev->subsystem_device;
95}
96
97static const struct iwl_bus_ops bus_ops_pci = {
98 .get_hw_id = iwl_pci_get_hw_id,
99};
100
101#define IWL_PCI_DEVICE(dev, subdev, cfg) \ 74#define IWL_PCI_DEVICE(dev, subdev, cfg) \
102 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ 75 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
103 .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ 76 .subvendor = PCI_ANY_ID, .subdevice = (subdev), \
@@ -283,14 +256,16 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
283}; 256};
284MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); 257MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
285 258
259/* PCI registers */
260#define PCI_CFG_RETRY_TIMEOUT 0x041
261
286static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 262static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
287{ 263{
288 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); 264 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
289 struct iwl_bus *bus; 265 struct iwl_bus *bus;
290 struct iwl_pci_bus *pci_bus;
291 int err; 266 int err;
292 267
293 bus = kzalloc(sizeof(*bus) + sizeof(*pci_bus), GFP_KERNEL); 268 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
294 if (!bus) { 269 if (!bus) {
295 dev_printk(KERN_ERR, &pdev->dev, 270 dev_printk(KERN_ERR, &pdev->dev,
296 "Couldn't allocate iwl_pci_bus"); 271 "Couldn't allocate iwl_pci_bus");
@@ -306,13 +281,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
306 } 281 }
307 282
308 bus->shrd->bus = bus; 283 bus->shrd->bus = bus;
309 pci_bus = IWL_BUS_GET_PCI_BUS(bus);
310 pci_bus->pci_dev = pdev;
311 284
312 pci_set_drvdata(pdev, bus); 285 pci_set_drvdata(pdev, bus);
313 286
314 bus->ops = &bus_ops_pci;
315
316#ifdef CONFIG_IWLWIFI_IDI 287#ifdef CONFIG_IWLWIFI_IDI
317 trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent); 288 trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
318 if (trans(bus) == NULL) { 289 if (trans(bus) == NULL) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index 922d841faba2..7c17b9d52179 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -536,7 +536,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
536 break; 536 break;
537 537
538 case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: 538 case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
539 devid = bus_get_hw_id(bus(priv)); 539 devid = trans(priv)->hw_id;
540 IWL_INFO(priv, "hw version: 0x%x\n", devid); 540 IWL_INFO(priv, "hw version: 0x%x\n", devid);
541 541
542 skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); 542 skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 73ff68ac7c45..4b711b790a90 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -2317,6 +2317,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
2317 trans->dev = &pdev->dev; 2317 trans->dev = &pdev->dev;
2318 trans->irq = pdev->irq; 2318 trans->irq = pdev->irq;
2319 trans_pcie->pci_dev = pdev; 2319 trans_pcie->pci_dev = pdev;
2320 trans->hw_id = (pdev->device << 16) + pdev->subsystem_device;
2320 snprintf(trans->hw_id_str, sizeof(trans->hw_id_str), 2321 snprintf(trans->hw_id_str, sizeof(trans->hw_id_str),
2321 "PCI ID: 0x%04X:0x%04X", pdev->device, pdev->subsystem_device); 2322 "PCI ID: 0x%04X:0x%04X", pdev->device, pdev->subsystem_device);
2322 2323
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 593102d89c74..0359d71e554f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -234,6 +234,8 @@ struct iwl_calib_result {
234 * @reg_lock - protect hw register access 234 * @reg_lock - protect hw register access
235 * @dev - pointer to struct device * that represents the device 235 * @dev - pointer to struct device * that represents the device
236 * @irq - the irq number for the device 236 * @irq - the irq number for the device
237 * @hw_id: a u32 with the ID of the device / subdevice.
238 * Set during transport alloaction.
237 * @hw_id_str: a string with info about HW ID. Set during transport allocation. 239 * @hw_id_str: a string with info about HW ID. Set during transport allocation.
238 * @ucode_write_complete: indicates that the ucode has been copied. 240 * @ucode_write_complete: indicates that the ucode has been copied.
239 * @ucode_rt: run time ucode image 241 * @ucode_rt: run time ucode image
@@ -251,6 +253,7 @@ struct iwl_trans {
251 253
252 struct device *dev; 254 struct device *dev;
253 unsigned int irq; 255 unsigned int irq;
256 u32 hw_id;
254 char hw_id_str[52]; 257 char hw_id_str[52];
255 258
256 u8 ucode_write_complete; /* the image write is complete */ 259 u8 ucode_write_complete; /* the image write is complete */