|
@@ -37,6 +37,7 @@
|
|
#include <sir_api.h>
|
|
#include <sir_api.h>
|
|
#endif
|
|
#endif
|
|
#include "osif_sync.h"
|
|
#include "osif_sync.h"
|
|
|
|
+#include <wlan_hdd_sysfs_set_fw_mode_cfg.h>
|
|
|
|
|
|
#define MAX_PSOC_ID_SIZE 10
|
|
#define MAX_PSOC_ID_SIZE 10
|
|
|
|
|
|
@@ -51,6 +52,28 @@ static struct kobject *driver_kobject;
|
|
static struct kobject *fw_kobject;
|
|
static struct kobject *fw_kobject;
|
|
static struct kobject *psoc_kobject;
|
|
static struct kobject *psoc_kobject;
|
|
|
|
|
|
|
|
+int
|
|
|
|
+hdd_sysfs_validate_and_copy_buf(char *dest_buf, size_t dest_buf_size,
|
|
|
|
+ char const *source_buf, size_t source_buf_size)
|
|
|
|
+{
|
|
|
|
+ if (source_buf_size > (dest_buf_size - 1)) {
|
|
|
|
+ hdd_err_rl("Command length is larger than %zu bytes",
|
|
|
|
+ dest_buf_size);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* sysfs already provides kernel space buffer so copy from user
|
|
|
|
+ * is not needed. Doing this extra copy operation just to ensure
|
|
|
|
+ * the local buf is properly null-terminated.
|
|
|
|
+ */
|
|
|
|
+ strlcpy(dest_buf, source_buf, dest_buf_size);
|
|
|
|
+ /* default 'echo' cmd takes new line character to here */
|
|
|
|
+ if (dest_buf[source_buf_size - 1] == '\n')
|
|
|
|
+ dest_buf[source_buf_size - 1] = '\0';
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
static ssize_t __show_driver_version(char *buf)
|
|
static ssize_t __show_driver_version(char *buf)
|
|
{
|
|
{
|
|
return scnprintf(buf, PAGE_SIZE, QWLAN_VERSIONSTR);
|
|
return scnprintf(buf, PAGE_SIZE, QWLAN_VERSIONSTR);
|
|
@@ -440,7 +463,7 @@ static struct kobj_attribute power_stats_attribute =
|
|
__ATTR(power_stats, 0444, show_device_power_stats, NULL);
|
|
__ATTR(power_stats, 0444, show_device_power_stats, NULL);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-void hdd_sysfs_create_version_interface(struct wlan_objmgr_psoc *psoc)
|
|
|
|
|
|
+static void hdd_sysfs_create_version_interface(struct wlan_objmgr_psoc *psoc)
|
|
{
|
|
{
|
|
int error = 0;
|
|
int error = 0;
|
|
uint32_t psoc_id;
|
|
uint32_t psoc_id;
|
|
@@ -489,7 +512,7 @@ free_fw_kobj:
|
|
fw_kobject = NULL;
|
|
fw_kobject = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
-void hdd_sysfs_destroy_version_interface(void)
|
|
|
|
|
|
+static void hdd_sysfs_destroy_version_interface(void)
|
|
{
|
|
{
|
|
if (psoc_kobject) {
|
|
if (psoc_kobject) {
|
|
kobject_put(psoc_kobject);
|
|
kobject_put(psoc_kobject);
|
|
@@ -500,7 +523,7 @@ void hdd_sysfs_destroy_version_interface(void)
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef WLAN_POWER_DEBUG
|
|
#ifdef WLAN_POWER_DEBUG
|
|
-void hdd_sysfs_create_powerstats_interface(void)
|
|
|
|
|
|
+static void hdd_sysfs_create_powerstats_interface(void)
|
|
{
|
|
{
|
|
int error;
|
|
int error;
|
|
|
|
|
|
@@ -514,7 +537,7 @@ void hdd_sysfs_create_powerstats_interface(void)
|
|
hdd_err("could not create power_stats sysfs file");
|
|
hdd_err("could not create power_stats sysfs file");
|
|
}
|
|
}
|
|
|
|
|
|
-void hdd_sysfs_destroy_powerstats_interface(void)
|
|
|
|
|
|
+static void hdd_sysfs_destroy_powerstats_interface(void)
|
|
{
|
|
{
|
|
if (!driver_kobject) {
|
|
if (!driver_kobject) {
|
|
hdd_err("could not get driver kobject!");
|
|
hdd_err("could not get driver kobject!");
|
|
@@ -522,9 +545,17 @@ void hdd_sysfs_destroy_powerstats_interface(void)
|
|
}
|
|
}
|
|
sysfs_remove_file(driver_kobject, &power_stats_attribute.attr);
|
|
sysfs_remove_file(driver_kobject, &power_stats_attribute.attr);
|
|
}
|
|
}
|
|
|
|
+#else
|
|
|
|
+static void hdd_sysfs_create_powerstats_interface(void)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void hdd_sysfs_destroy_powerstats_interface(void)
|
|
|
|
+{
|
|
|
|
+}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-void hdd_sysfs_create_driver_root_obj(void)
|
|
|
|
|
|
+static void hdd_sysfs_create_driver_root_obj(void)
|
|
{
|
|
{
|
|
driver_kobject = kobject_create_and_add(DRIVER_NAME, kernel_kobj);
|
|
driver_kobject = kobject_create_and_add(DRIVER_NAME, kernel_kobj);
|
|
if (!driver_kobject) {
|
|
if (!driver_kobject) {
|
|
@@ -540,7 +571,7 @@ void hdd_sysfs_create_driver_root_obj(void)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void hdd_sysfs_destroy_driver_root_obj(void)
|
|
|
|
|
|
+static void hdd_sysfs_destroy_driver_root_obj(void)
|
|
{
|
|
{
|
|
if (wlan_kobject) {
|
|
if (wlan_kobject) {
|
|
kobject_put(wlan_kobject);
|
|
kobject_put(wlan_kobject);
|
|
@@ -582,3 +613,20 @@ void hdd_sysfs_destroy_adapter_root_obj(struct hdd_adapter *adapter)
|
|
hdd_sysfs_destroy_bcn_reception_interface(adapter);
|
|
hdd_sysfs_destroy_bcn_reception_interface(adapter);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
+
|
|
|
|
+void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
|
|
|
|
+{
|
|
|
|
+ hdd_sysfs_create_driver_root_obj();
|
|
|
|
+ hdd_sysfs_create_version_interface(hdd_ctx->psoc);
|
|
|
|
+ hdd_sysfs_create_powerstats_interface();
|
|
|
|
+ hdd_sysfs_set_fw_mode_cfg_create(driver_kobject);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void hdd_destroy_sysfs_files(void)
|
|
|
|
+{
|
|
|
|
+ hdd_sysfs_set_fw_mode_cfg_destroy(driver_kobject);
|
|
|
|
+ hdd_sysfs_destroy_powerstats_interface();
|
|
|
|
+ hdd_sysfs_destroy_version_interface();
|
|
|
|
+ hdd_sysfs_destroy_driver_root_obj();
|
|
|
|
+}
|
|
|
|
+
|