qcacld-3.0: Integrate DSC (debugfs)
As part of DSC integration, replace remaining cds_ssr_protect/unprotect with appropriate osif_sync op start/stop calls in debugfs callback handlers. Change-Id: I416743c713997fa8ba98c69e2876efcefe8af9cb CRs-Fixed: 2409166
This commit is contained in:
parent
e3eca74d76
commit
094ce6b202
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#ifdef WLAN_OPEN_SOURCE
|
||||
#include "osif_sync.h"
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include <wlan_hdd_debugfs.h>
|
||||
#include <wlan_osif_request_manager.h>
|
||||
@ -84,18 +85,18 @@ bool hdd_wait_for_debugfs_threads_completion(void)
|
||||
|
||||
/**
|
||||
* __wcnss_wowpattern_write() - wow_pattern debugfs handler
|
||||
* @file: debugfs file handle
|
||||
* @net_dev: net_device context used to register the debugfs file
|
||||
* @buf: text being written to the debugfs
|
||||
* @count: size of @buf
|
||||
* @ppos: (unused) offset into the virtual file system
|
||||
*
|
||||
* Return: number of bytes processed
|
||||
*/
|
||||
static ssize_t __wcnss_wowpattern_write(struct file *file,
|
||||
const char __user *buf, size_t count,
|
||||
loff_t *ppos)
|
||||
static ssize_t __wcnss_wowpattern_write(struct net_device *net_dev,
|
||||
const char __user *buf, size_t count,
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct hdd_adapter *adapter = (struct hdd_adapter *) file->private_data;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
char cmd[MAX_USER_COMMAND_SIZE_WOWL_PATTERN + 1];
|
||||
char *sptr, *token;
|
||||
@ -107,7 +108,7 @@ static ssize_t __wcnss_wowpattern_write(struct file *file,
|
||||
|
||||
hdd_enter();
|
||||
|
||||
if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -192,29 +193,35 @@ static ssize_t wcnss_wowpattern_write(struct file *file,
|
||||
const char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
ssize_t ret;
|
||||
struct net_device *net_dev = file_inode(file)->i_private;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t err_size;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wcnss_wowpattern_write(file, buf, count, ppos);
|
||||
cds_ssr_unprotect(__func__);
|
||||
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
return ret;
|
||||
err_size = __wcnss_wowpattern_write(net_dev, buf, count, ppos);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* wcnss_patterngen_write() - pattern_gen debugfs handler
|
||||
* @file: debugfs file handle
|
||||
* @net_dev: net_device context used to register the debugfs file
|
||||
* @buf: text being written to the debugfs
|
||||
* @count: size of @buf
|
||||
* @ppos: (unused) offset into the virtual file system
|
||||
*
|
||||
* Return: number of bytes processed
|
||||
*/
|
||||
static ssize_t __wcnss_patterngen_write(struct file *file,
|
||||
const char __user *buf, size_t count,
|
||||
loff_t *ppos)
|
||||
static ssize_t __wcnss_patterngen_write(struct net_device *net_dev,
|
||||
const char __user *buf, size_t count,
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct hdd_adapter *adapter;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
tSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams;
|
||||
tSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams;
|
||||
@ -230,8 +237,7 @@ static ssize_t __wcnss_patterngen_write(struct file *file,
|
||||
|
||||
hdd_enter();
|
||||
|
||||
adapter = (struct hdd_adapter *)file->private_data;
|
||||
if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -410,45 +416,46 @@ static ssize_t wcnss_patterngen_write(struct file *file,
|
||||
const char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
ssize_t ret;
|
||||
struct net_device *net_dev = file_inode(file)->i_private;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t err_size;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wcnss_patterngen_write(file, buf, count, ppos);
|
||||
cds_ssr_unprotect(__func__);
|
||||
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
return ret;
|
||||
err_size = __wcnss_patterngen_write(net_dev, buf, count, ppos);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* __wcnss_debugfs_open() - Generic debugfs open() handler
|
||||
* @inode: inode of the debugfs file
|
||||
* @file: file handle of the debugfs file
|
||||
* @net_dev: net_device context used to register the debugfs file
|
||||
*
|
||||
* Return: 0
|
||||
* Return: Errno
|
||||
*/
|
||||
static int __wcnss_debugfs_open(struct inode *inode, struct file *file)
|
||||
static int __wcnss_debugfs_open(struct net_device *net_dev)
|
||||
{
|
||||
struct hdd_adapter *adapter;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
int ret;
|
||||
int errno;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
if (inode->i_private)
|
||||
file->private_data = inode->i_private;
|
||||
|
||||
adapter = (struct hdd_adapter *)file->private_data;
|
||||
if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (0 != ret)
|
||||
return ret;
|
||||
errno = wlan_hdd_validate_context(hdd_ctx);
|
||||
|
||||
hdd_exit();
|
||||
return 0;
|
||||
|
||||
return errno;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -460,13 +467,19 @@ static int __wcnss_debugfs_open(struct inode *inode, struct file *file)
|
||||
*/
|
||||
static int wcnss_debugfs_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
struct net_device *net_dev = inode->i_private;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
int errno;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wcnss_debugfs_open(inode, file);
|
||||
cds_ssr_unprotect(__func__);
|
||||
errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
return ret;
|
||||
errno = __wcnss_debugfs_open(net_dev);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_wowpattern = {
|
||||
@ -497,24 +510,24 @@ static const struct file_operations fops_patterngen = {
|
||||
*/
|
||||
QDF_STATUS hdd_debugfs_init(struct hdd_adapter *adapter)
|
||||
{
|
||||
struct net_device *dev = adapter->dev;
|
||||
struct net_device *net_dev = adapter->dev;
|
||||
|
||||
adapter->debugfs_phy = debugfs_create_dir(dev->name, 0);
|
||||
adapter->debugfs_phy = debugfs_create_dir(net_dev->name, 0);
|
||||
|
||||
if (NULL == adapter->debugfs_phy)
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
if (NULL == debugfs_create_file("wow_pattern", 00400 | 00200,
|
||||
adapter->debugfs_phy, adapter,
|
||||
adapter->debugfs_phy, net_dev,
|
||||
&fops_wowpattern))
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
if (NULL == debugfs_create_file("pattern_gen", 00400 | 00200,
|
||||
adapter->debugfs_phy, adapter,
|
||||
adapter->debugfs_phy, net_dev,
|
||||
&fops_patterngen))
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
if (0 != wlan_hdd_create_ll_stats_file(adapter))
|
||||
if (wlan_hdd_create_ll_stats_file(adapter))
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
|
@ -23,6 +23,7 @@
|
||||
* debugfs with roaming related information
|
||||
*/
|
||||
|
||||
#include "osif_sync.h"
|
||||
#include <wlan_hdd_debugfs_csr.h>
|
||||
#include <wlan_hdd_main.h>
|
||||
#include <cds_sched.h>
|
||||
@ -95,7 +96,7 @@ wlan_hdd_debugfs_update_csr(struct hdd_context *hdd_ctx,
|
||||
|
||||
/**
|
||||
* __wlan_hdd_read_debugfs_csr() - Function to read debug stats
|
||||
* @file: file pointer
|
||||
* @info: buffer info allocated when the debugfs file was opened
|
||||
* @buf: buffer
|
||||
* @count: count
|
||||
* @pos: position pointer
|
||||
@ -103,25 +104,17 @@ wlan_hdd_debugfs_update_csr(struct hdd_context *hdd_ctx,
|
||||
* Return: Number of bytes read on success, zero otherwise
|
||||
*/
|
||||
static ssize_t
|
||||
__wlan_hdd_read_debugfs_csr(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *pos)
|
||||
__wlan_hdd_read_debugfs_csr(struct wlan_hdd_debugfs_buffer_info *info,
|
||||
char __user *buf, size_t count, loff_t *pos)
|
||||
{
|
||||
struct wlan_hdd_debugfs_buffer_info *info;
|
||||
struct hdd_adapter *adapter;
|
||||
struct hdd_adapter *adapter = info->adapter;
|
||||
struct hdd_context *hdd_ctx;
|
||||
int ret;
|
||||
ssize_t length;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
info = file->private_data;
|
||||
if (!info || !info->data) {
|
||||
hdd_err("No valid private data");
|
||||
return 0;
|
||||
}
|
||||
|
||||
adapter = info->adapter;
|
||||
if ((!adapter) || (adapter->magic != WLAN_HDD_ADAPTER_MAGIC)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return 0;
|
||||
}
|
||||
@ -165,42 +158,40 @@ static ssize_t
|
||||
wlan_hdd_read_debugfs_csr(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
int ret;
|
||||
struct wlan_hdd_debugfs_buffer_info *info = file->private_data;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t err_size;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_read_debugfs_csr(file, buf, count, pos);
|
||||
cds_ssr_unprotect(__func__);
|
||||
err_size = osif_vdev_sync_op_start(info->adapter->dev, &vdev_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
return ret;
|
||||
err_size = __wlan_hdd_read_debugfs_csr(info, buf, count, pos);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_open_debugfs_csr() - Allocates memory for private data
|
||||
* @inode: Pointer to inode structure
|
||||
* @adapter: the HDD adapter to operate against
|
||||
* @csr: file info used to register the debugfs file
|
||||
* @file: file pointer
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int __wlan_hdd_open_debugfs_csr(struct inode *inode,
|
||||
static int __wlan_hdd_open_debugfs_csr(struct hdd_adapter *adapter,
|
||||
struct hdd_debugfs_file_info *csr,
|
||||
struct file *file)
|
||||
{
|
||||
struct wlan_hdd_debugfs_buffer_info *info;
|
||||
struct hdd_debugfs_file_info *csr;
|
||||
struct hdd_adapter *adapter = NULL;
|
||||
struct hdd_context *hdd_ctx;
|
||||
int ret;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
csr = inode->i_private;
|
||||
if (!csr) {
|
||||
hdd_err("No private data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
adapter = qdf_container_of(csr, struct hdd_adapter,
|
||||
csr_file[csr->id]);
|
||||
if (!adapter || (adapter->magic != WLAN_HDD_ADAPTER_MAGIC)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -240,47 +231,48 @@ static int __wlan_hdd_open_debugfs_csr(struct inode *inode,
|
||||
|
||||
/**
|
||||
* wlan_hdd_open_debugfs_csr() - SSR wrapper function to allocate memory for
|
||||
* private data on file open
|
||||
* private data on file open
|
||||
* @inode: Pointer to inode structure
|
||||
* @file: file pointer
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int wlan_hdd_open_debugfs_csr(struct inode *inode,
|
||||
struct file *file)
|
||||
static int wlan_hdd_open_debugfs_csr(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
struct hdd_debugfs_file_info *csr = inode->i_private;
|
||||
struct hdd_adapter *adapter = qdf_container_of(csr, struct hdd_adapter,
|
||||
csr_file[csr->id]);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
int errno;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
hdd_debugfs_thread_increment();
|
||||
ret = __wlan_hdd_open_debugfs_csr(inode, file);
|
||||
if (ret)
|
||||
errno = __wlan_hdd_open_debugfs_csr(adapter, csr, file);
|
||||
if (errno)
|
||||
hdd_debugfs_thread_decrement();
|
||||
|
||||
cds_ssr_unprotect(__func__);
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return ret;
|
||||
return errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_release_debugfs_csr() - Function to free private memory on
|
||||
* release
|
||||
* @inode: Pointer to inode structure
|
||||
* release
|
||||
* @file: file pointer
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int __wlan_hdd_release_debugfs_csr(struct inode *inode,
|
||||
struct file *file)
|
||||
static int
|
||||
__wlan_hdd_release_debugfs_csr(struct file *file)
|
||||
{
|
||||
struct wlan_hdd_debugfs_buffer_info *info = file->private_data;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
if (!info)
|
||||
return 0;
|
||||
|
||||
file->private_data = NULL;
|
||||
qdf_mem_free(info->data);
|
||||
qdf_mem_free(info);
|
||||
@ -296,18 +288,24 @@ static int __wlan_hdd_release_debugfs_csr(struct inode *inode,
|
||||
* @inode: Pointer to inode structure
|
||||
* @file: file pointer
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int wlan_hdd_release_debugfs_csr(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
struct wlan_hdd_debugfs_buffer_info *info = file->private_data;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
int errno;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_release_debugfs_csr(inode, file);
|
||||
errno = osif_vdev_sync_op_start(info->adapter->dev, &vdev_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
errno = __wlan_hdd_release_debugfs_csr(file);
|
||||
hdd_debugfs_thread_decrement();
|
||||
cds_ssr_unprotect(__func__);
|
||||
|
||||
return ret;
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_csr_debugfs = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@ -23,8 +23,9 @@
|
||||
* debugfs with Link Layer statistics
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_debugfs_llstat.h>
|
||||
#include <cds_sched.h>
|
||||
#include "osif_sync.h"
|
||||
#include <wlan_hdd_debugfs_llstat.h>
|
||||
#include <wlan_hdd_stats.h>
|
||||
#include <wma_api.h>
|
||||
|
||||
@ -357,31 +358,31 @@ static ssize_t hdd_debugfs_stats_update(char __user *buf, size_t count,
|
||||
|
||||
/**
|
||||
* __wlan_hdd_read_ll_stats_debugfs() - API to collect LL stats from FW
|
||||
* @file: file pointer
|
||||
* @net_dev: net_device context used to register the debugfs file
|
||||
* @buf: buffer
|
||||
* @count: count
|
||||
* @pos: position pointer
|
||||
*
|
||||
* Return: Number of bytes read on success, error number otherwise
|
||||
*/
|
||||
static ssize_t __wlan_hdd_read_ll_stats_debugfs(struct file *file,
|
||||
char __user *buf, size_t count, loff_t *pos)
|
||||
static ssize_t __wlan_hdd_read_ll_stats_debugfs(struct net_device *net_dev,
|
||||
char __user *buf, size_t count,
|
||||
loff_t *pos)
|
||||
{
|
||||
struct hdd_adapter *adapter;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
ssize_t ret = 0;
|
||||
ssize_t ret;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
adapter = (struct hdd_adapter *)file->private_data;
|
||||
if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (0 != ret)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* All the events are received and buffer is populated */
|
||||
@ -389,8 +390,8 @@ static ssize_t __wlan_hdd_read_ll_stats_debugfs(struct file *file,
|
||||
hdd_info("%zu characters written into debugfs", ret);
|
||||
|
||||
hdd_exit();
|
||||
return ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -403,38 +404,38 @@ static ssize_t __wlan_hdd_read_ll_stats_debugfs(struct file *file,
|
||||
* Return: Number of bytes read on success, error number otherwise
|
||||
*/
|
||||
static ssize_t wlan_hdd_read_ll_stats_debugfs(struct file *file,
|
||||
char __user *buf,
|
||||
size_t count, loff_t *pos)
|
||||
char __user *buf, size_t count,
|
||||
loff_t *pos)
|
||||
{
|
||||
int ret;
|
||||
struct net_device *net_dev = file_inode(file)->i_private;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t err_size;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_read_ll_stats_debugfs(file, buf, count, pos);
|
||||
cds_ssr_unprotect(__func__);
|
||||
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
return ret;
|
||||
err_size = __wlan_hdd_read_ll_stats_debugfs(net_dev, buf, count, pos);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_open_ll_stats_debugfs() - Function to save private on open
|
||||
* @inode: Pointer to inode structure
|
||||
* @file: file pointer
|
||||
* @net_dev: net_device context used to register the debugfs file
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int __wlan_hdd_open_ll_stats_debugfs(struct inode *inode,
|
||||
struct file *file)
|
||||
static int __wlan_hdd_open_ll_stats_debugfs(struct net_device *net_dev)
|
||||
{
|
||||
struct hdd_adapter *adapter;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
int errno;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
if (inode->i_private)
|
||||
file->private_data = inode->i_private;
|
||||
|
||||
adapter = (struct hdd_adapter *)file->private_data;
|
||||
errno = hdd_validate_adapter(adapter);
|
||||
if (errno)
|
||||
return errno;
|
||||
@ -467,57 +468,58 @@ free_buf:
|
||||
|
||||
/**
|
||||
* wlan_hdd_open_ll_stats_debugfs() - SSR wrapper function to save private
|
||||
* on open
|
||||
* on open
|
||||
* @inode: Pointer to inode structure
|
||||
* @file: file pointer
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int wlan_hdd_open_ll_stats_debugfs(struct inode *inode,
|
||||
struct file *file)
|
||||
{
|
||||
int ret;
|
||||
struct net_device *net_dev = inode->i_private;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
int errno;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_open_ll_stats_debugfs(inode, file);
|
||||
cds_ssr_unprotect(__func__);
|
||||
errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
return ret;
|
||||
errno = __wlan_hdd_open_ll_stats_debugfs(net_dev);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_release_ll_stats_debugfs() - Function to save private on release
|
||||
* @inode: Pointer to inode structure
|
||||
* @file: file pointer
|
||||
* @net_dev: net_device context used to register the debugfs file
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int __wlan_hdd_release_ll_stats_debugfs(struct inode *inode,
|
||||
struct file *file)
|
||||
static int __wlan_hdd_release_ll_stats_debugfs(struct net_device *net_dev)
|
||||
{
|
||||
struct hdd_adapter *adapter;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
int ret;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
if (inode->i_private)
|
||||
file->private_data = inode->i_private;
|
||||
|
||||
adapter = (struct hdd_adapter *)file->private_data;
|
||||
if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) {
|
||||
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
|
||||
hdd_err("Invalid adapter or adapter has invalid magic");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (0 != ret)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
wlan_hdd_llstats_free_buf();
|
||||
|
||||
hdd_exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -527,18 +529,24 @@ static int __wlan_hdd_release_ll_stats_debugfs(struct inode *inode,
|
||||
* @inode: Pointer to inode structure
|
||||
* @file: file pointer
|
||||
*
|
||||
* Return: zero
|
||||
* Return: Errno
|
||||
*/
|
||||
static int wlan_hdd_release_ll_stats_debugfs(struct inode *inode,
|
||||
struct file *file)
|
||||
struct file *file)
|
||||
{
|
||||
int ret;
|
||||
struct net_device *net_dev = file_inode(file)->i_private;
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
int errno;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_release_ll_stats_debugfs(inode, file);
|
||||
cds_ssr_unprotect(__func__);
|
||||
errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
return ret;
|
||||
errno = __wlan_hdd_release_ll_stats_debugfs(net_dev);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return errno;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_ll_stats_debugfs = {
|
||||
@ -552,7 +560,7 @@ static const struct file_operations fops_ll_stats_debugfs = {
|
||||
int wlan_hdd_create_ll_stats_file(struct hdd_adapter *adapter)
|
||||
{
|
||||
if (!debugfs_create_file("ll_stats", 0444, adapter->debugfs_phy,
|
||||
adapter, &fops_ll_stats_debugfs))
|
||||
adapter->dev, &fops_ll_stats_debugfs))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user