Merge "wcnss: update MAC address generate logic from the serial number"
This commit is contained in:
commit
d3b34dae57
1 changed files with 8 additions and 48 deletions
|
@ -37,6 +37,7 @@
|
|||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <soc/qcom/socinfo.h>
|
||||
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
#include <soc/qcom/subsystem_notif.h>
|
||||
|
@ -187,11 +188,9 @@ static DEFINE_SPINLOCK(reg_spinlock);
|
|||
#define WCNSS_MAX_BUILD_VER_LEN 256
|
||||
#define WCNSS_MAX_CMD_LEN (128)
|
||||
#define WCNSS_MIN_CMD_LEN (3)
|
||||
#define WCNSS_MIN_SERIAL_LEN (6)
|
||||
|
||||
/* control messages from userspace */
|
||||
#define WCNSS_USR_CTRL_MSG_START 0x00000000
|
||||
#define WCNSS_USR_SERIAL_NUM (WCNSS_USR_CTRL_MSG_START + 1)
|
||||
#define WCNSS_USR_HAS_CAL_DATA (WCNSS_USR_CTRL_MSG_START + 2)
|
||||
#define WCNSS_USR_WLAN_MAC_ADDR (WCNSS_USR_CTRL_MSG_START + 3)
|
||||
|
||||
|
@ -482,34 +481,6 @@ static ssize_t wcnss_wlan_macaddr_show(struct device *dev,
|
|||
static DEVICE_ATTR(wcnss_mac_addr, S_IRUSR | S_IWUSR,
|
||||
wcnss_wlan_macaddr_show, wcnss_wlan_macaddr_store);
|
||||
|
||||
static ssize_t wcnss_serial_number_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
if (!penv)
|
||||
return -ENODEV;
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%08X\n", penv->serial_number);
|
||||
}
|
||||
|
||||
static ssize_t wcnss_serial_number_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
if (!penv)
|
||||
return -ENODEV;
|
||||
|
||||
if (sscanf(buf, "%08X", &value) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
penv->serial_number = value;
|
||||
return count;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(serial_number, S_IRUSR | S_IWUSR,
|
||||
wcnss_serial_number_show, wcnss_serial_number_store);
|
||||
|
||||
|
||||
static ssize_t wcnss_thermal_mitigation_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
@ -1178,13 +1149,9 @@ static int wcnss_create_sysfs(struct device *dev)
|
|||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
ret = device_create_file(dev, &dev_attr_serial_number);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = device_create_file(dev, &dev_attr_thermal_mitigation);
|
||||
if (ret)
|
||||
goto remove_serial;
|
||||
return ret;
|
||||
|
||||
ret = device_create_file(dev, &dev_attr_wcnss_version);
|
||||
if (ret)
|
||||
|
@ -1200,8 +1167,6 @@ remove_version:
|
|||
device_remove_file(dev, &dev_attr_wcnss_version);
|
||||
remove_thermal:
|
||||
device_remove_file(dev, &dev_attr_thermal_mitigation);
|
||||
remove_serial:
|
||||
device_remove_file(dev, &dev_attr_serial_number);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1209,7 +1174,6 @@ remove_serial:
|
|||
static void wcnss_remove_sysfs(struct device *dev)
|
||||
{
|
||||
if (dev) {
|
||||
device_remove_file(dev, &dev_attr_serial_number);
|
||||
device_remove_file(dev, &dev_attr_thermal_mitigation);
|
||||
device_remove_file(dev, &dev_attr_wcnss_version);
|
||||
device_remove_file(dev, &dev_attr_wcnss_mac_addr);
|
||||
|
@ -1657,8 +1621,13 @@ EXPORT_SYMBOL(wcnss_unregister_thermal_mitigation);
|
|||
|
||||
unsigned int wcnss_get_serial_number(void)
|
||||
{
|
||||
if (penv)
|
||||
if (penv) {
|
||||
penv->serial_number = socinfo_get_serial_number();
|
||||
pr_info("%s: Device serial number: %u\n",
|
||||
__func__, penv->serial_number);
|
||||
return penv->serial_number;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(wcnss_get_serial_number);
|
||||
|
@ -2648,15 +2617,6 @@ void process_usr_ctrl_cmd(u8 *buf, size_t len)
|
|||
|
||||
switch (cmd) {
|
||||
|
||||
case WCNSS_USR_SERIAL_NUM:
|
||||
if (WCNSS_MIN_SERIAL_LEN > len) {
|
||||
pr_err("%s: Invalid serial number\n", __func__);
|
||||
return;
|
||||
}
|
||||
penv->serial_number = buf[2] << 24 | buf[3] << 16
|
||||
| buf[4] << 8 | buf[5];
|
||||
break;
|
||||
|
||||
case WCNSS_USR_HAS_CAL_DATA:
|
||||
if (1 < buf[2])
|
||||
pr_err("%s: Invalid data for cal %d\n", __func__,
|
||||
|
|
Loading…
Add table
Reference in a new issue