瀏覽代碼

iwlagn: add a method to get the HW ID description as a string to iwl_bus_ops

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Emmanuel Grumbach 14 年之前
父節點
當前提交
19707bac16

+ 3 - 3
drivers/net/wireless/iwlwifi/iwl-core.c

@@ -209,10 +209,10 @@ int iwlcore_init_geos(struct iwl_priv *priv)
 
 
 	if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
 	if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
 	     priv->cfg->sku & EEPROM_SKU_CAP_BAND_52GHZ) {
 	     priv->cfg->sku & EEPROM_SKU_CAP_BAND_52GHZ) {
+		char buf[32];
+		priv->bus.ops->get_hw_id(&priv->bus, buf, sizeof(buf));
 		IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
 		IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
-			"Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
-			   priv->pci_dev->device,
-			   priv->pci_dev->subsystem_device);
+			"Please send your %s to maintainer.\n", buf);
 		priv->cfg->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
 		priv->cfg->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
 	}
 	}
 
 

+ 2 - 0
drivers/net/wireless/iwlwifi/iwl-dev.h

@@ -1198,6 +1198,7 @@ struct iwl_bus;
  * @apm_config: will be called during the config of the APM configuration
  * @apm_config: will be called during the config of the APM configuration
  * @set_drv_data: set the priv pointer to the bus layer
  * @set_drv_data: set the priv pointer to the bus layer
  * @get_dev: returns the device struct
  * @get_dev: returns the device struct
+ * @get_hw_id: prints the hw_id in the provided buffer
  * @write8: write a byte to register at offset ofs
  * @write8: write a byte to register at offset ofs
  * @write32: write a dword to register at offset ofs
  * @write32: write a dword to register at offset ofs
  * @wread32: read a dword at register at offset ofs
  * @wread32: read a dword at register at offset ofs
@@ -1207,6 +1208,7 @@ struct iwl_bus_ops {
 	void (*apm_config)(struct iwl_bus *bus);
 	void (*apm_config)(struct iwl_bus *bus);
 	void (*set_drv_data)(struct iwl_bus *bus, void *priv);
 	void (*set_drv_data)(struct iwl_bus *bus, void *priv);
 	struct device *(*get_dev)(const struct iwl_bus *bus);
 	struct device *(*get_dev)(const struct iwl_bus *bus);
+	void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
 	void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
 	void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
 	void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
 	void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
 	u32 (*read32)(struct iwl_bus *bus, u32 ofs);
 	u32 (*read32)(struct iwl_bus *bus, u32 ofs);

+ 10 - 0
drivers/net/wireless/iwlwifi/iwl-pci.c

@@ -141,6 +141,15 @@ static struct device *iwl_pci_get_dev(const struct iwl_bus *bus)
 	return &(IWL_BUS_GET_PCI_DEV(bus)->dev);
 	return &(IWL_BUS_GET_PCI_DEV(bus)->dev);
 }
 }
 
 
+static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
+			      int buf_len)
+{
+	struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
+
+	snprintf(buf, buf_len, "PCI ID: 0x%04X:0x%04X", pci_dev->device,
+		 pci_dev->subsystem_device);
+}
+
 static void iwl_pci_write8(struct iwl_bus *bus, u32 ofs, u8 val)
 static void iwl_pci_write8(struct iwl_bus *bus, u32 ofs, u8 val)
 {
 {
 	iowrite8(val, IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs);
 	iowrite8(val, IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs);
@@ -162,6 +171,7 @@ static struct iwl_bus_ops pci_ops = {
 	.apm_config = iwl_pci_apm_config,
 	.apm_config = iwl_pci_apm_config,
 	.set_drv_data = iwl_pci_set_drv_data,
 	.set_drv_data = iwl_pci_set_drv_data,
 	.get_dev = iwl_pci_get_dev,
 	.get_dev = iwl_pci_get_dev,
+	.get_hw_id = iwl_pci_get_hw_id,
 	.write8 = iwl_pci_write8,
 	.write8 = iwl_pci_write8,
 	.write32 = iwl_pci_write32,
 	.write32 = iwl_pci_write32,
 	.read32 = iwl_pci_read32,
 	.read32 = iwl_pci_read32,