|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
|
|
|
+ * Copyright (c) 2016-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,14 +23,14 @@
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
-#include <sme_api.h>
|
|
|
-#include <wlan_hdd_includes.h>
|
|
|
#include <linux/module.h>
|
|
|
#include <linux/kernel.h>
|
|
|
#include <linux/version.h>
|
|
|
#include <linux/proc_fs.h> /* Necessary because we use the proc fs */
|
|
|
#include <linux/uaccess.h> /* for copy_to_user */
|
|
|
-
|
|
|
+#include "osif_sync.h"
|
|
|
+#include <sme_api.h>
|
|
|
+#include <wlan_hdd_includes.h>
|
|
|
|
|
|
#ifdef MULTI_IF_NAME
|
|
|
#define PROCFS_DRIVER_DUMP_DIR "debugdriver" MULTI_IF_NAME
|
|
@@ -118,20 +118,21 @@ static ssize_t __hdd_driver_memdump_read(struct file *file, char __user *buf,
|
|
|
hdd_err("Invalid start offset for memdump read");
|
|
|
mutex_unlock(&hdd_ctx->memdump_lock);
|
|
|
return -EINVAL;
|
|
|
- } else if (!count || (hdd_ctx->driver_dump_size &&
|
|
|
- (*pos >= hdd_ctx->driver_dump_size))) {
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!count ||
|
|
|
+ (hdd_ctx->driver_dump_size && *pos >= hdd_ctx->driver_dump_size)) {
|
|
|
mutex_unlock(&hdd_ctx->memdump_lock);
|
|
|
hdd_debug("No more data to copy");
|
|
|
return 0;
|
|
|
- } else if ((*pos == 0) || (hdd_ctx->driver_dump_mem == NULL)) {
|
|
|
- /*
|
|
|
- * Allocate memory for Driver memory dump.
|
|
|
- */
|
|
|
+ }
|
|
|
+
|
|
|
+ if (*pos == 0 || !hdd_ctx->driver_dump_mem) {
|
|
|
+ /* Allocate memory for Driver memory dump */
|
|
|
if (!hdd_ctx->driver_dump_mem) {
|
|
|
hdd_ctx->driver_dump_mem =
|
|
|
qdf_mem_malloc(DRIVER_MEM_DUMP_SIZE);
|
|
|
if (!hdd_ctx->driver_dump_mem) {
|
|
|
- hdd_err("qdf_mem_malloc failed");
|
|
|
mutex_unlock(&hdd_ctx->memdump_lock);
|
|
|
return -ENOMEM;
|
|
|
}
|
|
@@ -149,8 +150,7 @@ static ssize_t __hdd_driver_memdump_read(struct file *file, char __user *buf,
|
|
|
if (qdf_status != QDF_STATUS_SUCCESS)
|
|
|
hdd_err("Error in dump driver information, status %d",
|
|
|
qdf_status);
|
|
|
- hdd_debug("driver_dump_size: %d",
|
|
|
- hdd_ctx->driver_dump_size);
|
|
|
+ hdd_debug("driver_dump_size: %d", hdd_ctx->driver_dump_size);
|
|
|
}
|
|
|
|
|
|
if (count > hdd_ctx->driver_dump_size - *pos)
|
|
@@ -194,13 +194,18 @@ static ssize_t __hdd_driver_memdump_read(struct file *file, char __user *buf,
|
|
|
static ssize_t hdd_driver_memdump_read(struct file *file, char __user *buf,
|
|
|
size_t count, loff_t *pos)
|
|
|
{
|
|
|
- ssize_t len;
|
|
|
+ struct osif_driver_sync *driver_sync;
|
|
|
+ ssize_t err_size;
|
|
|
+
|
|
|
+ err_size = osif_driver_sync_op_start(&driver_sync);
|
|
|
+ if (err_size)
|
|
|
+ return err_size;
|
|
|
+
|
|
|
+ err_size = __hdd_driver_memdump_read(file, buf, count, pos);
|
|
|
|
|
|
- cds_ssr_protect(__func__);
|
|
|
- len = __hdd_driver_memdump_read(file, buf, count, pos);
|
|
|
- cds_ssr_unprotect(__func__);
|
|
|
+ osif_driver_sync_op_stop(driver_sync);
|
|
|
|
|
|
- return len;
|
|
|
+ return err_size;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -211,7 +216,7 @@ static ssize_t hdd_driver_memdump_read(struct file *file, char __user *buf,
|
|
|
* dump feature
|
|
|
*/
|
|
|
static const struct file_operations driver_dump_fops = {
|
|
|
-read: hdd_driver_memdump_read
|
|
|
+ .read = hdd_driver_memdump_read,
|
|
|
};
|
|
|
|
|
|
/**
|