Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45f65569 authored by Luca Coelho's avatar Luca Coelho
Browse files

iwlwifi: acpi: move function to get mcc into acpi code



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: default avatarLuca Coelho <luciano.coelho@intel.com>
parent d953cdb8
Loading
Loading
Loading
Loading
+34 −0
Original line number Original line Diff line number Diff line
@@ -147,3 +147,37 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
	return wifi_pkg;
	return wifi_pkg;
}
}
IWL_EXPORT_SYMBOL(iwl_acpi_get_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);
+15 −0
Original line number Original line Diff line number Diff line
@@ -98,6 +98,16 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
					 union acpi_object *data,
					 union acpi_object *data,
					 int data_size);
					 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 */
#else /* CONFIG_ACPI */


static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
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);
	return ERR_PTR(-ENOENT);
}
}


static inline int iwl_acpi_get_mcc(struct device *dev, char *mcc)
{
	return -ENOENT;
}

#endif /* CONFIG_ACPI */
#endif /* CONFIG_ACPI */
#endif /* __iwl_fw_acpi__ */
#endif /* __iwl_fw_acpi__ */
+0 −34
Original line number Original line Diff line number Diff line
@@ -944,37 +944,3 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
	return regd;
	return regd;
}
}
IWL_EXPORT_SYMBOL(iwl_parse_nvm_mcc_info);
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);
+0 −10
Original line number Original line Diff line number Diff line
@@ -109,14 +109,4 @@ struct ieee80211_regdomain *
iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
		       int num_of_ch, __le32 *channels, u16 fw_mcc);
		       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__ */
#endif /* __iwl_nvm_parse_h__ */
+0 −1
Original line number Original line Diff line number Diff line
@@ -74,7 +74,6 @@
#include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
#include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
#include "iwl-io.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-prph.h"
#include "iwl-eeprom-parse.h"
#include "fw/acpi.h"
#include "fw/acpi.h"


#include "mvm.h"
#include "mvm.h"
Loading