mwifiex: add debugfs file to read chip information
This patch add 'verext' debugfs item, which can be used to get detailed chip specific information from our firmware. Examples: echo "1" > /sys/kernel/debug/mwifiex/mlan0/verext cat /sys/kernel/debug/mwifiex/mlan0/verext Signed-off-by: Shengzhen Li <szli@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
@@ -95,8 +95,7 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
|
||||
|
||||
mwifiex_drv_get_driver_version(priv->adapter, fmt, sizeof(fmt) - 1);
|
||||
|
||||
if (!priv->version_str[0])
|
||||
mwifiex_get_ver_ext(priv);
|
||||
mwifiex_get_ver_ext(priv, 0);
|
||||
|
||||
p += sprintf(p, "driver_name = " "\"mwifiex\"\n");
|
||||
p += sprintf(p, "driver_version = %s", fmt);
|
||||
@@ -583,6 +582,52 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* debugfs verext file write handler.
|
||||
* This function is called when the 'verext' file is opened for write
|
||||
*/
|
||||
static ssize_t
|
||||
mwifiex_verext_write(struct file *file, const char __user *ubuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
int ret;
|
||||
u32 versionstrsel;
|
||||
struct mwifiex_private *priv = (void *)file->private_data;
|
||||
char buf[16];
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
|
||||
return -EFAULT;
|
||||
|
||||
ret = kstrtou32(buf, 10, &versionstrsel);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
priv->versionstrsel = versionstrsel;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Proc verext file read handler.
|
||||
* This function is called when the 'verext' file is opened for reading
|
||||
* This function can be used read driver exteneed verion string.
|
||||
*/
|
||||
static ssize_t
|
||||
mwifiex_verext_read(struct file *file, char __user *ubuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct mwifiex_private *priv =
|
||||
(struct mwifiex_private *)file->private_data;
|
||||
char buf[256];
|
||||
int ret;
|
||||
|
||||
mwifiex_get_ver_ext(priv, priv->versionstrsel);
|
||||
ret = snprintf(buf, sizeof(buf), "version string: %s\n",
|
||||
priv->version_str);
|
||||
|
||||
return simple_read_from_buffer(ubuf, count, ppos, buf, ret);
|
||||
}
|
||||
|
||||
/* Proc memrw file write handler.
|
||||
* This function is called when the 'memrw' file is opened for writing
|
||||
* This function can be used to write to a memory location.
|
||||
@@ -940,6 +985,7 @@ MWIFIEX_DFS_FILE_OPS(histogram);
|
||||
MWIFIEX_DFS_FILE_OPS(debug_mask);
|
||||
MWIFIEX_DFS_FILE_OPS(timeshare_coex);
|
||||
MWIFIEX_DFS_FILE_WRITE_OPS(reset);
|
||||
MWIFIEX_DFS_FILE_OPS(verext);
|
||||
|
||||
/*
|
||||
* This function creates the debug FS directory structure and the files.
|
||||
@@ -968,6 +1014,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
|
||||
MWIFIEX_DFS_ADD_FILE(debug_mask);
|
||||
MWIFIEX_DFS_ADD_FILE(timeshare_coex);
|
||||
MWIFIEX_DFS_ADD_FILE(reset);
|
||||
MWIFIEX_DFS_ADD_FILE(verext);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user