iwlwifi: kill bus_get_hw_id
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 8 Jan 2012 19:19:45 +0000 (21:19 +0200)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Thu, 2 Feb 2012 22:37:34 +0000 (14:37 -0800)
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>
drivers/net/wireless/iwlwifi/iwl-bus.h
drivers/net/wireless/iwlwifi/iwl-mac80211.c
drivers/net/wireless/iwlwifi/iwl-pci.c
drivers/net/wireless/iwlwifi/iwl-testmode.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
drivers/net/wireless/iwlwifi/iwl-trans.h

index 61130895428ac31574b41ebbd601dca374f0b289..30965e0e8ab403a2ed60f83122c62c5144d07b81 100644 (file)
 struct iwl_shared;
 struct iwl_bus;
 
-/**
- * struct iwl_bus_ops - bus specific operations
- * @get_hw_id: get hw_id in u32
- */
-struct iwl_bus_ops {
-       u32 (*get_hw_id)(struct iwl_bus *bus);
-};
-
 /**
  * struct iwl_bus - bus common data
  *
@@ -137,7 +129,6 @@ struct iwl_bus_ops {
  *     it allocates the shared data
  */
 struct iwl_bus {
-       const struct iwl_bus_ops *ops;
        struct iwl_shared *shrd;
 
        /* pointer to bus specific struct */
@@ -145,11 +136,6 @@ struct iwl_bus {
        char bus_specific[0] __attribute__((__aligned__(sizeof(void *))));
 };
 
-static inline u32 bus_get_hw_id(struct iwl_bus *bus)
-{
-       return bus->ops->get_hw_id(bus);
-}
-
 /*****************************************************
 * Bus layer registration functions
 ******************************************************/
index b911837b04fa58dd3e34d6ab695d3596c9e59484..78bc1e857b00089435198ac01d44045899473397 100644 (file)
@@ -234,7 +234,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
                priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
                        &priv->bands[IEEE80211_BAND_5GHZ];
 
-       hw->wiphy->hw_version = bus_get_hw_id(bus(priv));
+       hw->wiphy->hw_version = trans(priv)->hw_id;
 
        iwl_leds_init(priv);
 
index 15864760733a9a0d4121c205038ca0ef113d6cc8..3e2fce4ce00c6c0768380313f5958a0ae6f01dce 100644 (file)
 #include "iwl-csr.h"
 #include "iwl-cfg.h"
 
-/* PCI registers */
-#define PCI_CFG_RETRY_TIMEOUT  0x041
-#define PCI_CFG_LINK_CTRL_VAL_L0S_EN   0x01
-#define PCI_CFG_LINK_CTRL_VAL_L1_EN    0x02
-
-struct iwl_pci_bus {
-       /* basic pci-network driver stuff */
-       struct pci_dev *pci_dev;
-};
-
-#define IWL_BUS_GET_PCI_BUS(_iwl_bus) \
-                       ((struct iwl_pci_bus *) ((_iwl_bus)->bus_specific))
-
-#define IWL_BUS_GET_PCI_DEV(_iwl_bus) \
-                       ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev)
-
-static u32 iwl_pci_get_hw_id(struct iwl_bus *bus)
-{
-       struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
-
-       return (pci_dev->device << 16) + pci_dev->subsystem_device;
-}
-
-static const struct iwl_bus_ops bus_ops_pci = {
-       .get_hw_id = iwl_pci_get_hw_id,
-};
-
 #define IWL_PCI_DEVICE(dev, subdev, cfg) \
        .vendor = PCI_VENDOR_ID_INTEL,  .device = (dev), \
        .subvendor = PCI_ANY_ID, .subdevice = (subdev), \
@@ -283,14 +256,16 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
 };
 MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
 
+/* PCI registers */
+#define PCI_CFG_RETRY_TIMEOUT  0x041
+
 static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
        struct iwl_bus *bus;
-       struct iwl_pci_bus *pci_bus;
        int err;
 
-       bus = kzalloc(sizeof(*bus) + sizeof(*pci_bus), GFP_KERNEL);
+       bus = kzalloc(sizeof(*bus), GFP_KERNEL);
        if (!bus) {
                dev_printk(KERN_ERR, &pdev->dev,
                           "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)
        }
 
        bus->shrd->bus = bus;
-       pci_bus = IWL_BUS_GET_PCI_BUS(bus);
-       pci_bus->pci_dev = pdev;
 
        pci_set_drvdata(pdev, bus);
 
-       bus->ops = &bus_ops_pci;
-
 #ifdef CONFIG_IWLWIFI_IDI
        trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
        if (trans(bus) == NULL) {
index 922d841faba2a6322714444d8165e0eeb6c265a5..7c17b9d5217960f24d0fe2087da025c6ab5d7fd0 100644 (file)
@@ -536,7 +536,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
                break;
 
        case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
-               devid = bus_get_hw_id(bus(priv));
+               devid = trans(priv)->hw_id;
                IWL_INFO(priv, "hw version: 0x%x\n", devid);
 
                skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
index 73ff68ac7c452ddb0c86108cca6188ae03e43050..4b711b790a9030892a0c5a8d94caf44910d44f47 100644 (file)
@@ -2317,6 +2317,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
        trans->dev = &pdev->dev;
        trans->irq = pdev->irq;
        trans_pcie->pci_dev = pdev;
+       trans->hw_id = (pdev->device << 16) + pdev->subsystem_device;
        snprintf(trans->hw_id_str, sizeof(trans->hw_id_str),
                 "PCI ID: 0x%04X:0x%04X", pdev->device, pdev->subsystem_device);
 
index 593102d89c745e7f721b955e6bd93b442b221edd..0359d71e554f9ad011c6aa8e6830c0809fed2b8a 100644 (file)
@@ -234,6 +234,8 @@ struct iwl_calib_result {
  * @reg_lock - protect hw register access
  * @dev - pointer to struct device * that represents the device
  * @irq - the irq number for the device
+ * @hw_id: a u32 with the ID of the device / subdevice.
+  *    Set during transport alloaction.
  * @hw_id_str: a string with info about HW ID. Set during transport allocation.
  * @ucode_write_complete: indicates that the ucode has been copied.
  * @ucode_rt: run time ucode image
@@ -251,6 +253,7 @@ struct iwl_trans {
 
        struct device *dev;
        unsigned int irq;
+       u32 hw_id;
        char hw_id_str[52];
 
        u8 ucode_write_complete;        /* the image write is complete */