public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] acpi_bus_register_driver conflict fix in acpi drivers
@ 2004-11-12  6:29 Wang, Zhenyu Z
  2004-11-12  6:37 ` Dave Jones
  2004-11-12  6:39 ` Len Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Wang, Zhenyu Z @ 2004-11-12  6:29 UTC (permalink / raw)
  To: Li, Shaohua, linux-acpi, Brown, Len
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Fu, Michael,
	Liu, Bing Wei

[-- Attachment #1: Type: text/plain, Size: 4967 bytes --]

a01-acpi_devices_fix.patch

This patch is accord with acpi_bus_register_driver return value fix.
acpi driver won't cause any side effect if no device found to that
driver. 
After this patch, output on my dell looks like:
ACPI: AC [not found]
ACPI: Asus_acpi [not found]
ACPI: Battery [not found]
ACPI: Power Button (FF) [PWRF]
ACPI: Fan [not found]
ACPI: Processor [CPU0] (supports C1)
ACPI: Thermal [not found]

which tell "not found" devices that acpi can't handle on that box.

Signed-off-by: Wang, Zhenyu <zhenyu.z.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---

 a/drivers/acpi/ac.c             |    5 ++++-
 a/drivers/acpi/asus_acpi.c      |    4 +++-
 a/drivers/acpi/battery.c        |    5 ++++-
 a/drivers/acpi/button.c         |    5 ++++-
 a/drivers/acpi/fan.c            |    5 ++++-
 a/drivers/acpi/processor.c      |    5 ++++-
 acpi-2.6/drivers/acpi/thermal.c |    7 +++++--
 7 files changed, 28 insertions(+), 8 deletions(-)

--- a/drivers/acpi/ac.c~fix	2004-11-12 10:02:28.000000000 +0800
+++ a/drivers/acpi/ac.c	2004-11-12 13:05:44.000000000 +0800
@@ -328,8 +328,11 @@ acpi_ac_init (void)
 	acpi_ac_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_ac_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_ac_driver);
 		remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "AC [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/battery.c~fix	2004-11-12 11:09:37.000000000
+0800
+++ a/drivers/acpi/battery.c	2004-11-12 13:05:25.000000000 +0800
@@ -827,8 +827,11 @@ acpi_battery_init (void)
 	acpi_battery_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_battery_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_battery_driver);
 		remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Battery [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/asus_acpi.c~fix	2004-11-12 11:37:38.000000000
+0800
+++ a/drivers/acpi/asus_acpi.c	2004-11-12 13:05:34.000000000 +0800
@@ -1213,8 +1213,10 @@ static int __init asus_acpi_init(void)
 
 	result = acpi_bus_register_driver(&asus_hotk_driver);
 	if (result < 1) {
-		acpi_bus_unregister_driver(&asus_hotk_driver);
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&asus_hotk_driver);
 		remove_proc_entry(PROC_ASUS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Asus_acpi [not found]\n");
 		return -ENODEV;
 	}
 
--- a/drivers/acpi/button.c~fix	2004-11-08 13:45:07.000000000 +0800
+++ a/drivers/acpi/button.c	2004-11-12 12:42:30.000000000 +0800
@@ -532,8 +532,11 @@ acpi_button_init (void)
 	acpi_button_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_button_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_button_driver);
 		remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Button [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/fan.c~fix	2004-11-12 09:46:30.000000000 +0800
+++ a/drivers/acpi/fan.c	2004-11-12 12:43:04.000000000 +0800
@@ -280,8 +280,11 @@ acpi_fan_init (void)
 	acpi_fan_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_fan_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_fan_driver);
 		remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Fan [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/processor.c~fix	2004-11-12 11:40:00.000000000
+0800
+++ a/drivers/acpi/processor.c	2004-11-12 12:43:25.000000000 +0800
@@ -2465,8 +2465,11 @@ acpi_processor_init (void)
 	acpi_processor_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_processor_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_processor_driver);
 		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "processor [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- acpi-2.6/drivers/acpi/thermal.c	2004-11-12 13:41:51.539769280
+0800
+++ acpi-2.6/drivers/acpi/thermal.c.fix	2004-11-12 13:14:40.263760928
+0800
@@ -1305,7 +1305,7 @@ acpi_thermal_add (
 
 	result = acpi_thermal_add_fs(device);
 	if (result)
-		return_VALUE(result);
+		goto end;
 
 	init_timer(&tz->timer);
 
@@ -1389,8 +1389,11 @@ acpi_thermal_init (void)
 	acpi_thermal_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_thermal_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_thermal_driver);
 		remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Thermal [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 

[-- Attachment #2: a01-acpi_device_fix.patch --]
[-- Type: application/octet-stream, Size: 3874 bytes --]

--- a/drivers/acpi/ac.c~fix	2004-11-12 10:02:28.000000000 +0800
+++ a/drivers/acpi/ac.c	2004-11-12 13:05:44.000000000 +0800
@@ -328,8 +328,11 @@ acpi_ac_init (void)
 	acpi_ac_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_ac_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_ac_driver);
 		remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "AC [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/battery.c~fix	2004-11-12 11:09:37.000000000 +0800
+++ a/drivers/acpi/battery.c	2004-11-12 13:05:25.000000000 +0800
@@ -827,8 +827,11 @@ acpi_battery_init (void)
 	acpi_battery_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_battery_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_battery_driver);
 		remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Battery [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/asus_acpi.c~fix	2004-11-12 11:37:38.000000000 +0800
+++ a/drivers/acpi/asus_acpi.c	2004-11-12 13:05:34.000000000 +0800
@@ -1213,8 +1213,10 @@ static int __init asus_acpi_init(void)
 
 	result = acpi_bus_register_driver(&asus_hotk_driver);
 	if (result < 1) {
-		acpi_bus_unregister_driver(&asus_hotk_driver);
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&asus_hotk_driver);
 		remove_proc_entry(PROC_ASUS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Asus_acpi [not found]\n");
 		return -ENODEV;
 	}
 
--- a/drivers/acpi/button.c~fix	2004-11-08 13:45:07.000000000 +0800
+++ a/drivers/acpi/button.c	2004-11-12 12:42:30.000000000 +0800
@@ -532,8 +532,11 @@ acpi_button_init (void)
 	acpi_button_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_button_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_button_driver);
 		remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Button [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/fan.c~fix	2004-11-12 09:46:30.000000000 +0800
+++ a/drivers/acpi/fan.c	2004-11-12 12:43:04.000000000 +0800
@@ -280,8 +280,11 @@ acpi_fan_init (void)
 	acpi_fan_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_fan_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_fan_driver);
 		remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Fan [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- a/drivers/acpi/processor.c~fix	2004-11-12 11:40:00.000000000 +0800
+++ a/drivers/acpi/processor.c	2004-11-12 12:43:25.000000000 +0800
@@ -2465,8 +2465,11 @@ acpi_processor_init (void)
 	acpi_processor_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_processor_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_processor_driver);
 		remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "processor [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 
--- acpi-2.6/drivers/acpi/thermal.c	2004-11-12 13:41:51.539769280 +0800
+++ acpi-2.6/drivers/acpi/thermal.c.fix	2004-11-12 13:14:40.263760928 +0800
@@ -1305,7 +1305,7 @@ acpi_thermal_add (
 
 	result = acpi_thermal_add_fs(device);
 	if (result)
-		return_VALUE(result);
+		goto end;
 
 	init_timer(&tz->timer);
 
@@ -1389,8 +1389,11 @@ acpi_thermal_init (void)
 	acpi_thermal_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&acpi_thermal_driver);
-	if (result < 0) {
+	if (result < 1) {
+		if (result != -ENOENT)
+			acpi_bus_driver_del(&acpi_thermal_driver);
 		remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
+		printk (KERN_INFO PREFIX "Thermal [not found]\n");
 		return_VALUE(-ENODEV);
 	}
 

^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] acpi_bus_register_driver conflict fix in acpi drivers
@ 2004-11-12  6:45 Wang, Zhenyu Z
  0 siblings, 0 replies; 4+ messages in thread
From: Wang, Zhenyu Z @ 2004-11-12  6:45 UTC (permalink / raw)
  To: Dave Jones
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-acpi,
	Brown, Len

Dave Jones wrote:
> On Fri, Nov 12, 2004 at 02:29:41PM +0800, Wang, Zhenyu Z wrote:
> 
>  > This patch is accord with acpi_bus_register_driver return value
>  fix. > acpi driver won't cause any side effect if no device found to
>  that > driver.
>  > After this patch, output on my dell looks like:
>  > ACPI: AC [not found]
>  > ACPI: Asus_acpi [not found]
>  > ACPI: Battery [not found]
>  > ACPI: Power Button (FF) [PWRF]
>  > ACPI: Fan [not found]
>  > ACPI: Processor [CPU0] (supports C1)
>  > ACPI: Thermal [not found]
>  >
>  > which tell "not found" devices that acpi can't handle on that box.
> 
> Why on earth would we want to clutter the boot logs like this ?
> ACPI is by far one of the most verbose subsystems already,
> without making the problem worse.
> 
> 		Dave

Ok, blame me. it's for my own test now, removing them is ok.

thanks,
-zhen


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click

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

end of thread, other threads:[~2004-11-12  6:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-12  6:29 [PATCH 2/2] acpi_bus_register_driver conflict fix in acpi drivers Wang, Zhenyu Z
2004-11-12  6:37 ` Dave Jones
2004-11-12  6:39 ` Len Brown
  -- strict thread matches above, loose matches on Subject: below --
2004-11-12  6:45 Wang, Zhenyu Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox