iwlagn: move nvm_device_type from iwl_priv to iwl_trans
authorDon Fry <donald.h.fry@intel.com>
Thu, 10 Nov 2011 14:55:27 +0000 (06:55 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 11 Nov 2011 17:32:56 +0000 (12:32 -0500)
The nvm_device_type is eeprom related and does not need to be part
of the iwl_priv structure.  Move it and eliminate access to the iwl_priv
structure.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-eeprom.c
drivers/net/wireless/iwlwifi/iwl-trans.h

index 42871bafc8187ca9f998efc6d0e00a5956ef45f2..68b04f5b10ceb31ba0ac2480e87103b67f016a58 100644 (file)
@@ -430,7 +430,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
        eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
        pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
                        "version: 0x%x\n",
-                       (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
+                       (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
                         ? "OTP" : "EEPROM", eeprom_ver);
        for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
                pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
index 2c68b9ba491a3bccc8bbc90f2a4ccc30fc6fdb4d..556e4a2c19bceb0296cb90309f2d21bc534c82f8 100644 (file)
@@ -944,7 +944,6 @@ struct iwl_priv {
 
        /* eeprom -- this is in the card's little endian byte order */
        u8 *eeprom;
-       int    nvm_device_type;
        struct iwl_eeprom_calib_info *calib_info;
 
        enum nl80211_iftype iw_mode;
index 2fcde58382ff1464eb83125406e72c10bb94e41d..dcada0827ea43db482effeaa8966b62af51be67e 100644 (file)
@@ -182,32 +182,32 @@ static void iwl_eeprom_release_semaphore(struct iwl_bus *bus)
 
 }
 
-static int iwl_eeprom_verify_signature(struct iwl_priv *priv)
+static int iwl_eeprom_verify_signature(struct iwl_trans *trans)
 {
-       u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
+       u32 gp = iwl_read32(bus(trans), CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
        int ret = 0;
 
-       IWL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp);
+       IWL_DEBUG_EEPROM(trans, "EEPROM signature=0x%08x\n", gp);
        switch (gp) {
        case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP:
-               if (priv->nvm_device_type != NVM_DEVICE_TYPE_OTP) {
-                       IWL_ERR(priv, "EEPROM with bad signature: 0x%08x\n",
+               if (trans->nvm_device_type != NVM_DEVICE_TYPE_OTP) {
+                       IWL_ERR(trans, "EEPROM with bad signature: 0x%08x\n",
                                gp);
                        ret = -ENOENT;
                }
                break;
        case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K:
        case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K:
-               if (priv->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) {
-                       IWL_ERR(priv, "OTP with bad signature: 0x%08x\n", gp);
+               if (trans->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) {
+                       IWL_ERR(trans, "OTP with bad signature: 0x%08x\n", gp);
                        ret = -ENOENT;
                }
                break;
        case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP:
        default:
-               IWL_ERR(priv, "bad EEPROM/OTP signature, type=%s, "
+               IWL_ERR(trans, "bad EEPROM/OTP signature, type=%s, "
                        "EEPROM_GP=0x%08x\n",
-                       (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
+                       (trans->nvm_device_type == NVM_DEVICE_TYPE_OTP)
                        ? "OTP" : "EEPROM", gp);
                ret = -ENOENT;
                break;
@@ -660,8 +660,8 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
        u16 validblockaddr = 0;
        u16 cache_addr = 0;
 
-       priv->nvm_device_type = iwl_get_nvm_type(bus(priv), hw_rev);
-       if (priv->nvm_device_type == -ENOENT)
+       trans(priv)->nvm_device_type = iwl_get_nvm_type(bus(priv), hw_rev);
+       if (trans(priv)->nvm_device_type == -ENOENT)
                return -ENOENT;
        /* allocate eeprom */
        sz = priv->cfg->base_params->eeprom_size;
@@ -675,7 +675,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
 
        iwl_apm_init(priv);
 
-       ret = iwl_eeprom_verify_signature(priv);
+       ret = iwl_eeprom_verify_signature(trans(priv));
        if (ret < 0) {
                IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
                ret = -ENOENT;
@@ -690,7 +690,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
                goto err;
        }
 
-       if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) {
+       if (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) {
 
                ret = iwl_init_otp_access(bus(priv));
                if (ret) {
@@ -744,7 +744,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
        }
 
        IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n",
-                      (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
+                      (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
                       ? "OTP" : "EEPROM",
                       iwl_eeprom_query16(priv, EEPROM_VERSION));
 
index 7839362b9c0bd69562d3019b877d568f0b48deba..50227ebc0ee22243d9baffde3b8223663923c696 100644 (file)
@@ -247,6 +247,9 @@ struct iwl_trans {
        struct fw_img ucode_init;
        struct fw_img ucode_wowlan;
 
+       /* eeprom related variables */
+       int    nvm_device_type;
+
        /* pointer to trans specific struct */
        /*Ensure that this pointer will always be aligned to sizeof pointer */
        char trans_specific[0] __attribute__((__aligned__(sizeof(void *))));