linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/5] ACPI: hotplug messages improvement
@ 2012-08-28 19:02 Toshi Kani
  2012-08-28 19:02 ` [PATCH v5 1/5] ACPI: Add acpi_pr_<level>() interfaces Toshi Kani
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Toshi Kani @ 2012-08-28 19:02 UTC (permalink / raw)
  To: lenb, linux-acpi
  Cc: linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li, Toshi Kani

This patchset improves logging messages for ACPI CPU, Memory, 
Container and Dock hotplug notify handlers.  The patchset 
introduces a set of new macro interfaces, acpi_pr_<level>(),
and uses them to update the notify handlers.  acpi_pr_<level>()
appends "ACPI" prefix and ACPI object path to the messages,
which has similar usage model as dev_<level>().  This improves
diagnosis of hotplug operations since an error message in 
a log file now identifies an object that caused an issue.

v5:
 - Added update for ACPI Dock hotplug error messages.
 - Added error status / ID info to the messages where needed.
 - Rebased on 3.6-rc3.

v4:
 - Changed to use dev_<level>() where it is appropriate.

v3:
 - Changed acpi_pr_debug() to NOP when !DEBUG and !DYNAMIC_DEBUG.
   DYNAMIC_DEBUG will be supported later when necessary.
 - Added const to a path variable in acpi_printk().
 - Added more descriptions to the change log of patch 1/4.

v2:
 - Set buffer.pointer to NULL in acpi_printk().
 - Added acpi_pr_debug().

---
This patchset applies on top of the patch below.

[PATCH v2] ACPI: Add ACPI CPU hot-remove support
https://lkml.org/lkml/2012/8/24/419

---
Toshi Kani (5):
 ACPI: Add acpi_pr_<level>() interfaces
 ACPI: Update CPU hotplug error messages
 ACPI: Update Memory hotplug error messages
 ACPI: Update Container hotplug error messages
 ACPI: Update Dock hotplug error messages

---
 drivers/acpi/acpi_memhotplug.c  |   25 +++++++++++++------------
 drivers/acpi/container.c        |   10 ++--------
 drivers/acpi/dock.c             |   29 +++++++++++++----------------
 drivers/acpi/processor_driver.c |   38 +++++++++++++++++++++++---------------
 drivers/acpi/utils.c            |   34 ++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h         |   31 +++++++++++++++++++++++++++++++
 6 files changed, 116 insertions(+), 51 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v5 1/5] ACPI: Add acpi_pr_<level>() interfaces
  2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
@ 2012-08-28 19:02 ` Toshi Kani
  2012-08-28 19:02 ` [PATCH v5 2/5] ACPI: Update CPU hotplug error messages Toshi Kani
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Toshi Kani @ 2012-08-28 19:02 UTC (permalink / raw)
  To: lenb, linux-acpi
  Cc: linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li, Toshi Kani

This patch introduces acpi_pr_<level>(), where <level> is a kernel
message level such as err/warn/info, to support improved logging
messages for ACPI, esp. for hotplug operations.  acpi_pr_<level>()
appends "ACPI" prefix and ACPI object path to the messages.  This
improves diagnosis of hotplug operations since an error message in
a log file now identifies an object that caused an issue.

acpi_pr_<level>() takes acpi_handle as an argument, which is passed
to ACPI hotplug notify handlers from the ACPICA.  Therefore, it is
always available unlike other kernel objects, such as device.

For example:
  acpi_pr_err(handle, "Device don't exist, dropping EJECT\n");
logs an error message like this at KERN_ERR.
  ACPI: \_SB_.SCK4.CPU4: Device don't exist, dropping EJECT

ACPI drivers can use acpi_pr_<level>() when they need to identify
a target ACPI object path in their messages, such as error cases.
The usage model is similar to dev_<level>().  acpi_pr_<level>() can
be used when device is not created/valid, which may be the case in
ACPI hotplug handlers.  ACPI object path is also consistent on the
platform, unlike device name that changes over hotplug operations.

ACPI drivers should use dev_<level>() when device is valid and
acpi_pr_<level>() is already used by the caller in its error path.
Device name provides more user friendly information.

ACPI drivers also continue to use pr_<level>() when messages do not
need to specify device information, such as boot-up messages.

Note: ACPI_[WARNING|INFO|ERROR]() are intended for the ACPICA and
are not associated with the kernel message level.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Tested-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
---
 drivers/acpi/utils.c    |   34 ++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |   31 +++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 3e87c9c..ec0c6f9 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -454,3 +454,37 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
 #endif
 }
 EXPORT_SYMBOL(acpi_evaluate_hotplug_ost);
+
+/**
+ * acpi_printk: Print messages with ACPI prefix and object path
+ *
+ * This function is intended to be called through acpi_pr_<level> macros.
+ */
+void
+acpi_printk(const char *level, acpi_handle handle, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+	struct acpi_buffer buffer = {
+		.length = ACPI_ALLOCATE_BUFFER,
+		.pointer = NULL
+	};
+	const char *path;
+	acpi_status ret;
+
+	va_start(args, fmt);
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	ret = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
+	if (ret == AE_OK)
+		path = buffer.pointer;
+	else
+		path = "<n/a>";
+
+	printk("%sACPI: %s: %pV", level, path, &vaf);
+
+	va_end(args);
+	kfree(buffer.pointer);
+}
+EXPORT_SYMBOL(acpi_printk);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index bde976e..a3f9a6b 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -85,6 +85,37 @@ struct acpi_pld {
 
 acpi_status
 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld);
+
+void acpi_printk(const char *level, acpi_handle handle, const char *fmt, ...);
+
+#define acpi_pr_emerg(handle, fmt, ...)				\
+	acpi_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
+#define acpi_pr_alert(handle, fmt, ...)				\
+	acpi_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
+#define acpi_pr_crit(handle, fmt, ...)				\
+	acpi_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
+#define acpi_pr_err(handle, fmt, ...)				\
+	acpi_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
+#define acpi_pr_warn(handle, fmt, ...)				\
+	acpi_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
+#define acpi_pr_notice(handle, fmt, ...)			\
+	acpi_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
+#define acpi_pr_info(handle, fmt, ...)				\
+	acpi_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
+
+/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */
+#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
+#define acpi_pr_debug(handle, fmt, ...)					\
+	acpi_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
+#else
+#define acpi_pr_debug(handle, fmt, ...)					\
+({									\
+	if (0)								\
+		acpi_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__);	\
+	0;								\
+})
+#endif
+
 #ifdef CONFIG_ACPI
 
 #include <linux/proc_fs.h>
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 2/5] ACPI: Update CPU hotplug error messages
  2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
  2012-08-28 19:02 ` [PATCH v5 1/5] ACPI: Add acpi_pr_<level>() interfaces Toshi Kani
@ 2012-08-28 19:02 ` Toshi Kani
  2012-08-28 19:02 ` [PATCH v5 3/5] ACPI: Update Memory " Toshi Kani
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Toshi Kani @ 2012-08-28 19:02 UTC (permalink / raw)
  To: lenb, linux-acpi
  Cc: linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li, Toshi Kani

Updated CPU hotplug error messages with acpi_pr_<level>(),
dev_<level>() and pr_<level>().  Modified some messages for
clarity.  Added error status / id info to the messages where
needed.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Tested-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
---
 drivers/acpi/processor_driver.c |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index d12e9c3..7b59c6e 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -282,7 +282,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
 		/* Declared with "Processor" statement; match ProcessorID */
 		status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
 		if (ACPI_FAILURE(status)) {
-			printk(KERN_ERR PREFIX "Evaluating processor object\n");
+			dev_err(&device->dev,
+				"Failed to evaluate processor object (0x%x)\n",
+				status);
 			return -ENODEV;
 		}
 
@@ -301,8 +303,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
 		status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
 						NULL, &value);
 		if (ACPI_FAILURE(status)) {
-			printk(KERN_ERR PREFIX
-			    "Evaluating processor _UID [%#x]\n", status);
+			dev_err(&device->dev,
+				"Failed to evaluate processor _UID (0x%x)\n",
+				status);
 			return -ENODEV;
 		}
 		device_declaration = 1;
@@ -345,7 +348,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
 	if (!object.processor.pblk_address)
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
 	else if (object.processor.pblk_length != 6)
-		printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n",
+		dev_err(&device->dev, "Invalid PBLK length [%d]\n",
 			    object.processor.pblk_length);
 	else {
 		pr->throttling.address = object.processor.pblk_address;
@@ -429,8 +432,8 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
 		 * Initialize missing things
 		 */
 		if (pr->flags.need_hotplug_init) {
-			printk(KERN_INFO "Will online and init hotplugged "
-			       "CPU: %d\n", pr->id);
+			pr_info("Will online and init hotplugged CPU: %d\n",
+				pr->id);
 			WARN(acpi_processor_start(pr), "Failed to start CPU:"
 				" %d\n", pr->id);
 			pr->flags.need_hotplug_init = 0;
@@ -491,14 +494,16 @@ static __ref int acpi_processor_start(struct acpi_processor *pr)
 				   &pr->cdev->device.kobj,
 				   "thermal_cooling");
 	if (result) {
-		printk(KERN_ERR PREFIX "Create sysfs link\n");
+		dev_err(&device->dev,
+			"Failed to create sysfs link 'thermal_cooling'\n");
 		goto err_thermal_unregister;
 	}
 	result = sysfs_create_link(&pr->cdev->device.kobj,
 				   &device->dev.kobj,
 				   "device");
 	if (result) {
-		printk(KERN_ERR PREFIX "Create sysfs link\n");
+		dev_err(&pr->cdev->device,
+			"Failed to create sysfs link 'device'\n");
 		goto err_remove_sysfs_thermal;
 	}
 
@@ -560,8 +565,9 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
 	 */
 	if (per_cpu(processor_device_array, pr->id) != NULL &&
 	    per_cpu(processor_device_array, pr->id) != device) {
-		printk(KERN_WARNING "BIOS reported wrong ACPI id "
-			"for the processor\n");
+		dev_warn(&device->dev,
+			"BIOS reported wrong ACPI id %d for the processor\n",
+			pr->id);
 		result = -ENODEV;
 		goto err_free_cpumask;
 	}
@@ -715,7 +721,7 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
 
 		result = acpi_processor_device_add(handle, &device);
 		if (result) {
-			printk(KERN_ERR PREFIX "Unable to add the device\n");
+			acpi_pr_err(handle, "Unable to add the device\n");
 			break;
 		}
 
@@ -727,17 +733,19 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
 				  "received ACPI_NOTIFY_EJECT_REQUEST\n"));
 
 		if (acpi_bus_get_device(handle, &device)) {
-			pr_err(PREFIX "Device don't exist, dropping EJECT\n");
+			acpi_pr_err(handle,
+				"Device don't exist, dropping EJECT\n");
 			break;
 		}
 		if (!acpi_driver_data(device)) {
-			pr_err(PREFIX "Driver data is NULL, dropping EJECT\n");
+			acpi_pr_err(handle,
+				"Driver data is NULL, dropping EJECT\n");
 			break;
 		}
 
 		ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
 		if (!ej_event) {
-			pr_err(PREFIX "No memory, dropping EJECT\n");
+			acpi_pr_err(handle, "No memory, dropping EJECT\n");
 			break;
 		}
 
@@ -847,7 +855,7 @@ static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
 	 * and do it when the CPU gets online the first time
 	 * TBD: Cleanup above functions and try to do this more elegant.
 	 */
-	printk(KERN_INFO "CPU %d got hotplugged\n", pr->id);
+	pr_info("CPU %d got hotplugged\n", pr->id);
 	pr->flags.need_hotplug_init = 1;
 
 	return AE_OK;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 3/5] ACPI: Update Memory hotplug error messages
  2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
  2012-08-28 19:02 ` [PATCH v5 1/5] ACPI: Add acpi_pr_<level>() interfaces Toshi Kani
  2012-08-28 19:02 ` [PATCH v5 2/5] ACPI: Update CPU hotplug error messages Toshi Kani
@ 2012-08-28 19:02 ` Toshi Kani
  2012-08-28 19:03 ` [PATCH v5 4/5] ACPI: Update Container " Toshi Kani
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Toshi Kani @ 2012-08-28 19:02 UTC (permalink / raw)
  To: lenb, linux-acpi
  Cc: linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li, Toshi Kani

Updated Memory hotplug error messages with acpi_pr_<level>(),
dev_<level>() and pr_<level>().

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
 drivers/acpi/acpi_memhotplug.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 24c807f..183fa3d 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -170,7 +170,7 @@ acpi_memory_get_device(acpi_handle handle,
 	/* Get the parent device */
 	result = acpi_bus_get_device(phandle, &pdevice);
 	if (result) {
-		printk(KERN_WARNING PREFIX "Cannot get acpi bus device");
+		acpi_pr_warn(phandle, "Cannot get acpi bus device\n");
 		return -EINVAL;
 	}
 
@@ -180,14 +180,14 @@ acpi_memory_get_device(acpi_handle handle,
 	 */
 	result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
 	if (result) {
-		printk(KERN_WARNING PREFIX "Cannot add acpi bus");
+		acpi_pr_warn(handle, "Cannot add acpi bus\n");
 		return -EINVAL;
 	}
 
       end:
 	*mem_device = acpi_driver_data(device);
 	if (!(*mem_device)) {
-		printk(KERN_ERR "\n driver data not found");
+		dev_err(&device->dev, "driver data not found\n");
 		return -ENODEV;
 	}
 
@@ -224,7 +224,8 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 	/* Get the range from the _CRS */
 	result = acpi_memory_get_device_resources(mem_device);
 	if (result) {
-		printk(KERN_ERR PREFIX "get_device_resources failed\n");
+		dev_err(&mem_device->device->dev,
+			"get_device_resources failed\n");
 		mem_device->state = MEMORY_INVALID_STATE;
 		return result;
 	}
@@ -257,7 +258,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 		num_enabled++;
 	}
 	if (!num_enabled) {
-		printk(KERN_ERR PREFIX "add_memory failed\n");
+		dev_err(&mem_device->device->dev, "add_memory failed\n");
 		mem_device->state = MEMORY_INVALID_STATE;
 		return -EINVAL;
 	}
@@ -353,7 +354,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 					  "\nReceived DEVICE CHECK notification for device\n"));
 		if (acpi_memory_get_device(handle, &mem_device)) {
-			printk(KERN_ERR PREFIX "Cannot find driver data\n");
+			acpi_pr_err(handle, "Cannot find driver data\n");
 			break;
 		}
 
@@ -361,7 +362,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 			break;
 
 		if (acpi_memory_enable_device(mem_device)) {
-			printk(KERN_ERR PREFIX "Cannot enable memory device\n");
+			acpi_pr_err(handle, "Cannot enable memory device\n");
 			break;
 		}
 
@@ -373,12 +374,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 				  "\nReceived EJECT REQUEST notification for device\n"));
 
 		if (acpi_bus_get_device(handle, &device)) {
-			printk(KERN_ERR PREFIX "Device doesn't exist\n");
+			acpi_pr_err(handle, "Device doesn't exist\n");
 			break;
 		}
 		mem_device = acpi_driver_data(device);
 		if (!mem_device) {
-			printk(KERN_ERR PREFIX "Driver Data is NULL\n");
+			acpi_pr_err(handle, "Driver Data is NULL\n");
 			break;
 		}
 
@@ -389,7 +390,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 		 *      with generic sysfs driver
 		 */
 		if (acpi_memory_disable_device(mem_device)) {
-			printk(KERN_ERR PREFIX "Disable memory device\n");
+			acpi_pr_err(handle, "Failed to remove memory device\n");
 			/*
 			 * If _EJ0 was called but failed, _OST is not
 			 * necessary.
@@ -449,7 +450,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
 	/* Set the device state */
 	mem_device->state = MEMORY_POWER_ON_STATE;
 
-	printk(KERN_DEBUG "%s \n", acpi_device_name(device));
+	pr_debug("%s\n", acpi_device_name(device));
 
 	/*
 	 * Early boot code has recognized memory area by EFI/E820.
@@ -464,7 +465,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
 		/* call add_memory func */
 		result = acpi_memory_enable_device(mem_device);
 		if (result)
-			printk(KERN_ERR PREFIX
+			dev_err(&device->dev,
 				"Error in acpi_memory_enable_device\n");
 	}
 	return result;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 4/5] ACPI: Update Container hotplug error messages
  2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
                   ` (2 preceding siblings ...)
  2012-08-28 19:02 ` [PATCH v5 3/5] ACPI: Update Memory " Toshi Kani
@ 2012-08-28 19:03 ` Toshi Kani
  2012-08-28 19:03 ` [PATCH v5 5/5] ACPI: Update Dock " Toshi Kani
  2012-10-09 13:42 ` [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
  5 siblings, 0 replies; 8+ messages in thread
From: Toshi Kani @ 2012-08-28 19:03 UTC (permalink / raw)
  To: lenb, linux-acpi
  Cc: linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li, Toshi Kani

Updated Container hotplug error messages with acpi_pr_<level>()
and pr_<level>().  Removed an unnecessary check to device pointer
in acpi_container_add().

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
 drivers/acpi/container.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 1f9f7d7..519c1d6 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -97,12 +97,6 @@ static int acpi_container_add(struct acpi_device *device)
 {
 	struct acpi_container *container;
 
-
-	if (!device) {
-		printk(KERN_ERR PREFIX "device is NULL\n");
-		return -EINVAL;
-	}
-
 	container = kzalloc(sizeof(struct acpi_container), GFP_KERNEL);
 	if (!container)
 		return -ENOMEM;
@@ -164,7 +158,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
 	case ACPI_NOTIFY_BUS_CHECK:
 		/* Fall through */
 	case ACPI_NOTIFY_DEVICE_CHECK:
-		printk(KERN_WARNING "Container driver received %s event\n",
+		pr_debug("Container driver received %s event\n",
 		       (type == ACPI_NOTIFY_BUS_CHECK) ?
 		       "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
 
@@ -185,7 +179,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
 
 		result = container_device_add(&device, handle);
 		if (result) {
-			printk(KERN_WARNING "Failed to add container\n");
+			acpi_pr_warn(handle, "Failed to add container\n");
 			break;
 		}
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 5/5] ACPI: Update Dock hotplug error messages
  2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
                   ` (3 preceding siblings ...)
  2012-08-28 19:03 ` [PATCH v5 4/5] ACPI: Update Container " Toshi Kani
@ 2012-08-28 19:03 ` Toshi Kani
  2012-10-09 13:42 ` [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
  5 siblings, 0 replies; 8+ messages in thread
From: Toshi Kani @ 2012-08-28 19:03 UTC (permalink / raw)
  To: lenb, linux-acpi
  Cc: linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li, Toshi Kani

Updated Dock hotplug error messages with acpi_pr_<level>()
and pr_<level>().  Replaced acpi_get_name() & kfree() with
apci_pr_<level>().  Added error status to the messages where
needed.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
 drivers/acpi/dock.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 88eb143..7b8eef6 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -460,12 +460,8 @@ static void handle_dock(struct dock_station *ds, int dock)
 	struct acpi_object_list arg_list;
 	union acpi_object arg;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-	struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
-	acpi_get_name(ds->handle, ACPI_FULL_PATHNAME, &name_buffer);
-
-	printk(KERN_INFO PREFIX "%s - %s\n",
-		(char *)name_buffer.pointer, dock ? "docking" : "undocking");
+	acpi_pr_info(ds->handle, "%s\n", dock ? "docking" : "undocking");
 
 	/* _DCK method has one argument */
 	arg_list.count = 1;
@@ -474,11 +470,10 @@ static void handle_dock(struct dock_station *ds, int dock)
 	arg.integer.value = dock;
 	status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer);
 	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
-		ACPI_EXCEPTION((AE_INFO, status, "%s - failed to execute"
-			" _DCK\n", (char *)name_buffer.pointer));
+		acpi_pr_err(ds->handle, "Failed to execute _DCK (0x%x)\n",
+				status);
 
 	kfree(buffer.pointer);
-	kfree(name_buffer.pointer);
 }
 
 static inline void dock(struct dock_station *ds)
@@ -525,9 +520,11 @@ static void dock_lock(struct dock_station *ds, int lock)
 	status = acpi_evaluate_object(ds->handle, "_LCK", &arg_list, NULL);
 	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
 		if (lock)
-			printk(KERN_WARNING PREFIX "Locking device failed\n");
+			acpi_pr_warn(ds->handle,
+				"Locking device failed (0x%x)\n", status);
 		else
-			printk(KERN_WARNING PREFIX "Unlocking device failed\n");
+			acpi_pr_warn(ds->handle,
+				"Unlocking device failed (0x%x)\n", status);
 	}
 }
 
@@ -667,7 +664,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event)
 	dock_lock(ds, 0);
 	eject_dock(ds);
 	if (dock_present(ds)) {
-		printk(KERN_ERR PREFIX "Unable to undock!\n");
+		acpi_pr_err(ds->handle, "Unable to undock!\n");
 		return -EBUSY;
 	}
 	complete_undock(ds);
@@ -715,7 +712,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data)
 			begin_dock(ds);
 			dock(ds);
 			if (!dock_present(ds)) {
-				printk(KERN_ERR PREFIX "Unable to dock!\n");
+				acpi_pr_err(handle, "Unable to dock!\n");
 				complete_dock(ds);
 				break;
 			}
@@ -743,7 +740,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data)
 			dock_event(ds, event, UNDOCK_EVENT);
 		break;
 	default:
-		printk(KERN_ERR PREFIX "Unknown dock event %d\n", event);
+		acpi_pr_err(handle, "Unknown dock event %d\n", event);
 	}
 }
 
@@ -987,7 +984,7 @@ err_rmgroup:
 	sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group);
 err_unregister:
 	platform_device_unregister(dd);
-	printk(KERN_ERR "%s encountered error %d\n", __func__, ret);
+	acpi_pr_err(handle, "%s encountered error %d\n", __func__, ret);
 	return ret;
 }
 
@@ -1055,12 +1052,12 @@ static int __init dock_init(void)
 	acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
 			ACPI_UINT32_MAX, find_bay, NULL, NULL, NULL);
 	if (!dock_station_count) {
-		printk(KERN_INFO PREFIX "No dock devices found.\n");
+		pr_info(PREFIX "No dock devices found.\n");
 		return 0;
 	}
 
 	register_acpi_bus_notifier(&dock_acpi_notifier);
-	printk(KERN_INFO PREFIX "%s: %d docks/bays found\n",
+	pr_info(PREFIX "%s: %d docks/bays found\n",
 		ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count);
 	return 0;
 }
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 0/5] ACPI: hotplug messages improvement
  2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
                   ` (4 preceding siblings ...)
  2012-08-28 19:03 ` [PATCH v5 5/5] ACPI: Update Dock " Toshi Kani
@ 2012-10-09 13:42 ` Toshi Kani
  2012-10-11 15:22   ` Toshi Kani
  5 siblings, 1 reply; 8+ messages in thread
From: Toshi Kani @ 2012-10-09 13:42 UTC (permalink / raw)
  To: lenb
  Cc: linux-acpi, linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li

Hi Len,

Can you please review this patch?  Please let me know if there is
anything I need to do for 3.7.

Thanks,
-Toshi


On Tue, 2012-08-28 at 13:02 -0600, Toshi Kani wrote:
> This patchset improves logging messages for ACPI CPU, Memory, 
> Container and Dock hotplug notify handlers.  The patchset 
> introduces a set of new macro interfaces, acpi_pr_<level>(),
> and uses them to update the notify handlers.  acpi_pr_<level>()
> appends "ACPI" prefix and ACPI object path to the messages,
> which has similar usage model as dev_<level>().  This improves
> diagnosis of hotplug operations since an error message in 
> a log file now identifies an object that caused an issue.
> 
> v5:
>  - Added update for ACPI Dock hotplug error messages.
>  - Added error status / ID info to the messages where needed.
>  - Rebased on 3.6-rc3.
> 
> v4:
>  - Changed to use dev_<level>() where it is appropriate.
> 
> v3:
>  - Changed acpi_pr_debug() to NOP when !DEBUG and !DYNAMIC_DEBUG.
>    DYNAMIC_DEBUG will be supported later when necessary.
>  - Added const to a path variable in acpi_printk().
>  - Added more descriptions to the change log of patch 1/4.
> 
> v2:
>  - Set buffer.pointer to NULL in acpi_printk().
>  - Added acpi_pr_debug().
> 
> ---
> This patchset applies on top of the patch below.
> 
> [PATCH v2] ACPI: Add ACPI CPU hot-remove support
> https://lkml.org/lkml/2012/8/24/419
> 
> ---
> Toshi Kani (5):
>  ACPI: Add acpi_pr_<level>() interfaces
>  ACPI: Update CPU hotplug error messages
>  ACPI: Update Memory hotplug error messages
>  ACPI: Update Container hotplug error messages
>  ACPI: Update Dock hotplug error messages
> 
> ---
>  drivers/acpi/acpi_memhotplug.c  |   25 +++++++++++++------------
>  drivers/acpi/container.c        |   10 ++--------
>  drivers/acpi/dock.c             |   29 +++++++++++++----------------
>  drivers/acpi/processor_driver.c |   38 +++++++++++++++++++++++---------------
>  drivers/acpi/utils.c            |   34 ++++++++++++++++++++++++++++++++++
>  include/acpi/acpi_bus.h         |   31 +++++++++++++++++++++++++++++++
>  6 files changed, 116 insertions(+), 51 deletions(-)
> --
> 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/
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 0/5] ACPI: hotplug messages improvement
  2012-10-09 13:42 ` [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
@ 2012-10-11 15:22   ` Toshi Kani
  0 siblings, 0 replies; 8+ messages in thread
From: Toshi Kani @ 2012-10-11 15:22 UTC (permalink / raw)
  To: lenb
  Cc: linux-acpi, linux-kernel, joe, bhelgaas, isimatu.yasuaki,
	vijaymohan.pandarathil, shaohua.li

Hi Len,

Can you please review this patchset?

Thanks,
-Toshi

On Tue, 2012-10-09 at 07:42 -0600, Toshi Kani wrote:
> Hi Len,
> 
> Can you please review this patch?  Please let me know if there is
> anything I need to do for 3.7.
> 
> Thanks,
> -Toshi
> 
> 
> On Tue, 2012-08-28 at 13:02 -0600, Toshi Kani wrote:
> > This patchset improves logging messages for ACPI CPU, Memory, 
> > Container and Dock hotplug notify handlers.  The patchset 
> > introduces a set of new macro interfaces, acpi_pr_<level>(),
> > and uses them to update the notify handlers.  acpi_pr_<level>()
> > appends "ACPI" prefix and ACPI object path to the messages,
> > which has similar usage model as dev_<level>().  This improves
> > diagnosis of hotplug operations since an error message in 
> > a log file now identifies an object that caused an issue.
> > 
> > v5:
> >  - Added update for ACPI Dock hotplug error messages.
> >  - Added error status / ID info to the messages where needed.
> >  - Rebased on 3.6-rc3.
> > 
> > v4:
> >  - Changed to use dev_<level>() where it is appropriate.
> > 
> > v3:
> >  - Changed acpi_pr_debug() to NOP when !DEBUG and !DYNAMIC_DEBUG.
> >    DYNAMIC_DEBUG will be supported later when necessary.
> >  - Added const to a path variable in acpi_printk().
> >  - Added more descriptions to the change log of patch 1/4.
> > 
> > v2:
> >  - Set buffer.pointer to NULL in acpi_printk().
> >  - Added acpi_pr_debug().
> > 
> > ---
> > This patchset applies on top of the patch below.
> > 
> > [PATCH v2] ACPI: Add ACPI CPU hot-remove support
> > https://lkml.org/lkml/2012/8/24/419
> > 
> > ---
> > Toshi Kani (5):
> >  ACPI: Add acpi_pr_<level>() interfaces
> >  ACPI: Update CPU hotplug error messages
> >  ACPI: Update Memory hotplug error messages
> >  ACPI: Update Container hotplug error messages
> >  ACPI: Update Dock hotplug error messages
> > 
> > ---
> >  drivers/acpi/acpi_memhotplug.c  |   25 +++++++++++++------------
> >  drivers/acpi/container.c        |   10 ++--------
> >  drivers/acpi/dock.c             |   29 +++++++++++++----------------
> >  drivers/acpi/processor_driver.c |   38 +++++++++++++++++++++++---------------
> >  drivers/acpi/utils.c            |   34 ++++++++++++++++++++++++++++++++++
> >  include/acpi/acpi_bus.h         |   31 +++++++++++++++++++++++++++++++
> >  6 files changed, 116 insertions(+), 51 deletions(-)
> > --
> > 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/
> > 
> > 
> 
> 
> --
> 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/



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-11 15:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 19:02 [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
2012-08-28 19:02 ` [PATCH v5 1/5] ACPI: Add acpi_pr_<level>() interfaces Toshi Kani
2012-08-28 19:02 ` [PATCH v5 2/5] ACPI: Update CPU hotplug error messages Toshi Kani
2012-08-28 19:02 ` [PATCH v5 3/5] ACPI: Update Memory " Toshi Kani
2012-08-28 19:03 ` [PATCH v5 4/5] ACPI: Update Container " Toshi Kani
2012-08-28 19:03 ` [PATCH v5 5/5] ACPI: Update Dock " Toshi Kani
2012-10-09 13:42 ` [PATCH v5 0/5] ACPI: hotplug messages improvement Toshi Kani
2012-10-11 15:22   ` Toshi Kani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).