Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1190614

[PATCH 4/4] ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name.

From Lv Zheng <lv.zheng@intel.com>
Newsgroups linux.kernel
Subject [PATCH 4/4] ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name.
Date 2015-07-23 07:10 +0200
Message-ID <pPgVB-5hq-21@gated-at.bofh.it> (permalink)
References <pPgLU-4QI-7@gated-at.bofh.it> <pPgVB-5hq-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Since _SB.PCI0 can be used as relative path from root and can be easily
converted into internal trace_method_name format, we allow users to specify
trace_method_name using relative paths from root.
Note this is useful for grub2 for which users failed to pass "\" from the
grub configuration file.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/sysfs.c |   28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 8979e4a..40a4265 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -164,14 +164,18 @@ static const struct kernel_param_ops param_ops_debug_level = {
 module_param_cb(debug_layer, &param_ops_debug_layer, &acpi_dbg_layer, 0644);
 module_param_cb(debug_level, &param_ops_debug_level, &acpi_dbg_level, 0644);
 
-static char* trace_method_name;
-static bool trace_method_kmalloced;
+static char trace_method_name[1024];
 
 int param_set_trace_method_name(const char *val, const struct kernel_param *kp)
 {
 	u32 saved_flags = 0;
+	bool is_abs_path = true;
 
-	if (strlen(val) > 1024) {
+	if (*val != '\\')
+		is_abs_path = false;
+
+	if ((is_abs_path && strlen(val) > 1023) ||
+	    (!is_abs_path && strlen(val) > 1022)) {
 		pr_err("%s: string parameter too long\n", kp->name);
 		return -ENOSPC;
 	}
@@ -187,19 +191,13 @@ int param_set_trace_method_name(const char *val, const struct kernel_param *kp)
 			       acpi_gbl_trace_dbg_layer,
 			       0);
 
-	if (trace_method_kmalloced)
-		kfree(trace_method_name);
-	trace_method_name = NULL;
-	trace_method_kmalloced = false;
-
 	/* This is a hack.  We can't kmalloc in early boot. */
-	if (slab_is_available()) {
-		trace_method_name = kstrdup(val, GFP_KERNEL);
-		if (!trace_method_name)
-			return -ENOMEM;
-		trace_method_kmalloced = true;
-	} else
-		trace_method_name = (char *)val;
+	if (is_abs_path)
+		strcpy(trace_method_name, val);
+	else {
+		trace_method_name[0] = '\\';
+		strcpy(trace_method_name+1, val);
+	}
 
 	/* Restore the original tracer state */
 	(void)acpi_debug_trace(trace_method_name,
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/22] ACPICA: 20150717 Release Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:00 +0200
  [PATCH 04/22] ACPICA: Dispatcher: Cleanup union acpi_operand_object's AML address assignments. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:00 +0200
  [PATCH 05/22] ACPICA: Executer: Add back pointing reference of method operand. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:00 +0200
  [PATCH 09/22] ACPICA: Executer: Add interpreter tracing mode for method tracing facility. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:00 +0200
  [PATCH 3/4] ACPI / Documentation: Update method tracing documentation. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:10 +0200
  [PATCH 2/4] ACPI / sysfs: Update method tracing facility. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:10 +0200
  [PATCH 1/4] ACPI / sysfs: Add ACPI_LV_REPAIR debug level. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:10 +0200
  [PATCH 4/4] ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:10 +0200
  [PATCH 0/4] ACPI: Update method tracing facility. Lv Zheng <lv.zheng@intel.com> - 2015-07-23 07:10 +0200
    RE: [PATCH 0/4] ACPI: Update method tracing facility. "Zheng, Lv" <lv.zheng@intel.com> - 2015-07-24 04:10 +0200
      RE: [PATCH 0/4] ACPI: Update method tracing facility. "Zheng, Lv" <lv.zheng@intel.com> - 2015-07-27 02:50 +0200
  Re: [PATCH 00/22] ACPICA: 20150717 Release "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-07-29 02:40 +0200
    RE: [PATCH 00/22] ACPICA: 20150717 Release "Zheng, Lv" <lv.zheng@intel.com> - 2015-07-29 03:50 +0200

csiph-web