OSDN Git Service

iwlwifi: acpi: move function to get mcc into acpi code
authorLuca Coelho <luciano.coelho@intel.com>
Tue, 26 Sep 2017 13:31:10 +0000 (16:31 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 6 Oct 2017 12:22:32 +0000 (15:22 +0300)
The iwl_get_bios_mcc() function was in the iwl-nvm-parse.c file, but
it has nothing to do with the NVM.  Move it to fw/acpi.c and rename it
to iwl_acpi_get_mcc().

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
drivers/net/wireless/intel/iwlwifi/fw/acpi.h
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c

index 5a3b75e..adce361 100644 (file)
@@ -147,3 +147,37 @@ found:
        return wifi_pkg;
 }
 IWL_EXPORT_SYMBOL(iwl_acpi_get_wifi_pkg);
+
+int iwl_acpi_get_mcc(struct device *dev, char *mcc)
+{
+       union acpi_object *wifi_pkg, *data;
+       u32 mcc_val;
+       int ret;
+
+       data = iwl_acpi_get_object(dev, ACPI_WRDD_METHOD);
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
+       wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE);
+       if (IS_ERR(wifi_pkg)) {
+               ret = PTR_ERR(wifi_pkg);
+               goto out_free;
+       }
+
+       if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
+               ret = -EINVAL;
+               goto out_free;
+       }
+
+       mcc_val = wifi_pkg->package.elements[1].integer.value;
+
+       mcc[0] = (mcc_val >> 8) & 0xff;
+       mcc[1] = mcc_val & 0xff;
+       mcc[2] = '\0';
+
+       ret = 0;
+out_free:
+       kfree(data);
+       return ret;
+}
+IWL_EXPORT_SYMBOL(iwl_acpi_get_mcc);
index a7deb62..fe9c106 100644 (file)
@@ -98,6 +98,16 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
                                         union acpi_object *data,
                                         int data_size);
 
+/**
+ * iwl_acpi_get_mcc - read MCC from ACPI, if available
+ *
+ * @dev: the struct device
+ * @mcc: output buffer (3 bytes) that will get the MCC
+ *
+ * This function tries to read the current MCC from ACPI if available.
+ */
+int iwl_acpi_get_mcc(struct device *dev, char *mcc);
+
 #else /* CONFIG_ACPI */
 
 static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
@@ -112,5 +122,10 @@ static inline union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
        return ERR_PTR(-ENOENT);
 }
 
+static inline int iwl_acpi_get_mcc(struct device *dev, char *mcc)
+{
+       return -ENOENT;
+}
+
 #endif /* CONFIG_ACPI */
 #endif /* __iwl_fw_acpi__ */
index d98318f..d9a2ea9 100644 (file)
@@ -944,37 +944,3 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
        return regd;
 }
 IWL_EXPORT_SYMBOL(iwl_parse_nvm_mcc_info);
-
-int iwl_get_bios_mcc(struct device *dev, char *mcc)
-{
-       union acpi_object *wifi_pkg, *data;
-       u32 mcc_val;
-       int ret;
-
-       data = iwl_acpi_get_object(dev, ACPI_WRDD_METHOD);
-       if (IS_ERR(data))
-               return PTR_ERR(data);
-
-       wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE);
-       if (IS_ERR(wifi_pkg)) {
-               ret = PTR_ERR(wifi_pkg);
-               goto out_free;
-       }
-
-       if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
-               ret = -EINVAL;
-               goto out_free;
-       }
-
-       mcc_val = wifi_pkg->package.elements[1].integer.value;
-
-       mcc[0] = (mcc_val >> 8) & 0xff;
-       mcc[1] = mcc_val & 0xff;
-       mcc[2] = '\0';
-
-       ret = 0;
-out_free:
-       kfree(data);
-       return ret;
-}
-IWL_EXPORT_SYMBOL(iwl_get_bios_mcc);
index a39bd5c..306736c 100644 (file)
@@ -109,14 +109,4 @@ struct ieee80211_regdomain *
 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
                       int num_of_ch, __le32 *channels, u16 fw_mcc);
 
-/**
- * iwl_get_bios_mcc - read MCC from BIOS, if available
- *
- * @dev: the struct device
- * @mcc: output buffer (3 bytes) that will get the MCC
- *
- * This function tries to read the current MCC from ACPI if available.
- */
-int iwl_get_bios_mcc(struct device *dev, char *mcc);
-
 #endif /* __iwl_nvm_parse_h__ */
index 7a7b72b..f476882 100644 (file)
@@ -74,7 +74,6 @@
 #include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
 #include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */
 #include "iwl-prph.h"
-#include "iwl-eeprom-parse.h"
 #include "fw/acpi.h"
 
 #include "mvm.h"
index 422aa6b..f4a5fcf 100644 (file)
@@ -73,6 +73,7 @@
 #include "iwl-eeprom-read.h"
 #include "iwl-nvm-parse.h"
 #include "iwl-prph.h"
+#include "fw/acpi.h"
 
 /* Default NVM size to read */
 #define IWL_NVM_DEFAULT_CHUNK_SIZE (2*1024)
@@ -775,7 +776,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
                return -EIO;
 
        if (iwl_mvm_is_wifi_mcc_supported(mvm) &&
-           !iwl_get_bios_mcc(mvm->dev, mcc)) {
+           !iwl_acpi_get_mcc(mvm->dev, mcc)) {
                kfree(regd);
                regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, mcc,
                                             MCC_SOURCE_BIOS, NULL);