public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.9 battery status  regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries]
@ 2004-11-16  9:20 Yu, Luming
  2004-11-17 10:06 ` Fred Labrosse
  0 siblings, 1 reply; 5+ messages in thread
From: Yu, Luming @ 2004-11-16  9:20 UTC (permalink / raw)
  To: Karol Kozimor, hgfelger-9nAOAgdJVo4b1SvskN2V4Q
  Cc: Fred Labrosse, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

I just find out the changes that could affect this area. And has attached 
at bug 3678. I hope you guys can verify if it is a regression. 

Not sure reboot or Lid issue. 

Thanks
Luming 

>-----Original Message-----
>From: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org 
>[mailto:acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of 
>Karol Kozimor
>Sent: 2004年11月7日 8:13
>To: hgfelger-9nAOAgdJVo4b1SvskN2V4Q@public.gmane.org
>Cc: Fred Labrosse; acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>Subject: Re: [ACPI] Battery status wrong from 2.6.7 when 
>running on batteries
>
>Thus wrote hgfelger-9nAOAgdJVo4b1SvskN2V4Q@public.gmane.org:
>> There is a bad workaround for our laptops: If you close the 
>lid, it will 
>> not restart. That is a protective rule in the BIOS that 
>should prevent the 
>> laptop to start while in it's covered in its bag (I suppose).
>
>That, or there's some sort of PM (APM stand-by?) going on when 
>the lid is
>closed _and_ ACPI is off. Try booting with acpi=off and close 
>the lid --
>see particularly if the NIC responds or if the timer interrupts go off.
>Best regards,
>
>-- 
>Karol 'sziwan' Kozimor
>sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org
>
>
>-------------------------------------------------------
>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_id=5588&alloc_id=12065&op=click
>_______________________________________________
>Acpi-devel mailing list
>Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>https://lists.sourceforge.net/lists/listinfo/acpi-devel
>


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8

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

* 2.6.9 battery status  regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries]
  2004-11-16  9:20 2.6.9 battery status regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries] Yu, Luming
@ 2004-11-17 10:06 ` Fred Labrosse
  0 siblings, 0 replies; 5+ messages in thread
From: Fred Labrosse @ 2004-11-17 10:06 UTC (permalink / raw)
  To: Yu, Luming
  Cc: Karol Kozimor, hgfelger-9nAOAgdJVo4b1SvskN2V4Q,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Yu, Luming wrote:
 > I just find out the changes that could affect this area. And has
 > attached
 > at bug 3678. I hope you guys can verify if it is a regression.

I can't find it.

However, I think there's been some misunderstanding somewhere.  What is a
regression in 2.6.9 is the shutdown problem, reported in bug 3669 (and it
seems it's been solved).

Bug 3678 is about wrong battery and temperature (and maybe others) status
reported soon after running on batteries, but never when running on AC.
The problem remains after plugging back the AC.  THIS IS A REGRESSION OF
2.6.7.

Hope this helps.

Fred



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8

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

* RE: 2.6.9 battery status  regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries]
@ 2004-11-17 11:30 Yu, Luming
  0 siblings, 0 replies; 5+ messages in thread
From: Yu, Luming @ 2004-11-17 11:30 UTC (permalink / raw)
  To: Fred Labrosse
  Cc: Karol Kozimor, hgfelger-9nAOAgdJVo4b1SvskN2V4Q,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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


>
>Yu, Luming wrote:
> > I just find out the changes that could affect this area. And has
> > attached
> > at bug 3678. I hope you guys can verify if it is a regression.
>
>I can't find it.
>
>However, I think there's been some misunderstanding somewhere. 
> What is a
>regression in 2.6.9 is the shutdown problem, reported in bug 
>3669 (and it
>seems it's been solved).
>
>Bug 3678 is about wrong battery and temperature (and maybe 
>others) status
>reported soon after running on batteries, but never when running on AC.
>The problem remains after plugging back the AC.  THIS IS A 
>REGRESSION OF
>2.6.7.
>
>Hope this helps.
>
>Fred

If so, could you revert the enclosed patch I just extracted from
patch-2.6.7 
from kernel.org to see it is a regression. 

Please Note,  It haven't been verified. If there are any unexpected
problem,
please find out the missed patch-snippet in patch-2.6.7 on kernel.org

I'm sorry for confusion. 

Thanks,
Luming

[-- Attachment #2: 2-67.patch --]
[-- Type: application/octet-stream, Size: 22383 bytes --]

diff -Nru a/drivers/acpi/ac.c b/drivers/acpi/ac.c
--- a/drivers/acpi/ac.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/ac.c	Tue Jun 15 22:20:39 2004
@@ -185,6 +185,9 @@
 	ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_AC_FILE_STATE,
+				  acpi_device_dir(device));
+
 		remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/acpi_ksyms.c b/drivers/acpi/acpi_ksyms.c
--- a/drivers/acpi/acpi_ksyms.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/acpi_ksyms.c	Tue Jun 15 22:20:39 2004
@@ -106,7 +106,7 @@
 EXPORT_SYMBOL(acpi_os_create_semaphore);
 EXPORT_SYMBOL(acpi_os_delete_semaphore);
 EXPORT_SYMBOL(acpi_os_wait_semaphore);
-
+EXPORT_SYMBOL(acpi_os_wait_events_complete);
 EXPORT_SYMBOL(acpi_os_read_pci_configuration);
 
 /* ACPI Utilities (acpi_utils.c) */
diff -Nru a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
--- a/drivers/acpi/asus_acpi.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/acpi/asus_acpi.c	Tue Jun 15 22:20:38 2004
@@ -40,6 +40,7 @@
 #include <linux/proc_fs.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_bus.h>
+#include <asm/uaccess.h>
 
 #define ASUS_ACPI_VERSION "0.28"
 
@@ -480,16 +481,31 @@
 	return (hotk->status & ledmask) ? 1 : 0;
 }
 
+static int parse_arg(const char __user *buf, unsigned long count, int *val)
+{
+	char s[32];
+	if (!count)
+		return 0;
+	if (count > 31)
+		return -EINVAL;
+	if (copy_from_user(s, buf, count))
+		return -EFAULT;
+	s[count] = 0;
+	if (sscanf(s, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
 
 /* FIXME: kill extraneous args so it can be called independently */
 static int
-write_led(const char *buffer, unsigned long count, struct asus_hotk *hotk, 
+write_led(const char __user *buffer, unsigned long count, struct asus_hotk *hotk, 
           char *ledname, int ledmask, int invert)
 {
 	int value;
 	int led_out = 0;
 
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		led_out = value ? 1 : 0;
 
 	hotk->status =
@@ -518,7 +534,7 @@
 
 
 static int
-proc_write_mled(struct file *file, const char *buffer,
+proc_write_mled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -537,7 +553,7 @@
 }
 
 static int
-proc_write_wled(struct file *file, const char *buffer,
+proc_write_wled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -556,7 +572,7 @@
 }
 
 static int
-proc_write_tled(struct file *file, const char *buffer,
+proc_write_tled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -640,13 +656,14 @@
 
 
 static int
-proc_write_lcd(struct file *file, const char *buffer,
+proc_write_lcd(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 	
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_lcd_state(hotk, value);
 	return count;
 }
@@ -707,17 +724,18 @@
 }
 
 static int
-proc_write_brn(struct file *file, const char *buffer,
+proc_write_brn(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1) {
+	count = parse_arg(buffer, count, &value);
+	if (count > 0) {
 		value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
 			/* 0 <= value <= 15 */
 		set_brightness(value, hotk);
-	} else {
+	} else if (count < 0) {
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
 	}
 
@@ -756,17 +774,17 @@
  * simultaneously, so be warned. See the acpi4asus README for more info.
  */
 static int
-proc_write_disp(struct file *file, const char *buffer,
+proc_write_disp(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_display(value, hotk);
-	else {
+	else if (count < 0)
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
-	}
 
 	return count;
 }
@@ -774,7 +792,7 @@
 
 typedef int (proc_readfunc)(char *page, char **start, off_t off, int count,
 	                     int *eof, void *data);
-typedef int (proc_writefunc)(struct file *file, const char *buffer,
+typedef int (proc_writefunc)(struct file *file, const char __user *buffer,
 	                      unsigned long count, void *data);
 
 static int
@@ -863,6 +881,29 @@
 	return 0;
 }
 
+static int asus_hotk_remove_fs(struct acpi_device* device)
+{
+	struct asus_hotk* hotk = acpi_driver_data(device);
+
+
+	if(acpi_device_dir(device)){
+		remove_proc_entry(PROC_INFO,acpi_device_dir(device));
+		if (hotk->methods->mt_wled)
+			remove_proc_entry(PROC_WLED,acpi_device_dir(device));
+		if (hotk->methods->mt_mled)
+			remove_proc_entry(PROC_MLED,acpi_device_dir(device));
+		if (hotk->methods->mt_tled)
+			remove_proc_entry(PROC_TLED,acpi_device_dir(device));
+		if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) 
+			remove_proc_entry(PROC_LCD, acpi_device_dir(device));
+		if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || (hotk->methods->brightness_get && hotk->methods->brightness_get)) 
+			remove_proc_entry(PROC_BRN, acpi_device_dir(device));
+		if (hotk->methods->display_set) 
+			remove_proc_entry(PROC_DISP, acpi_device_dir(device));
+	}
+	return 0;
+}
+
 
 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
 {
@@ -1111,7 +1152,6 @@
 	return(result);
 }
 
-
 static int asus_hotk_remove(struct acpi_device *device, int type)
 {
 	acpi_status status = 0;
@@ -1126,6 +1166,8 @@
 					    asus_hotk_notify);
 	if (ACPI_FAILURE(status))
 		printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
+
+	asus_hotk_remove_fs(device);
 
 	kfree(hotk);
 
diff -Nru a/drivers/acpi/battery.c b/drivers/acpi/battery.c
--- a/drivers/acpi/battery.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/acpi/battery.c	Tue Jun 15 22:20:43 2004
@@ -582,7 +582,7 @@
 static int
 acpi_battery_write_alarm (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	unsigned long		count,
 	void			*data)
 {
@@ -679,6 +679,13 @@
 	ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_BATTERY_FILE_ALARM,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_BATTERY_FILE_STATUS,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_BATTERY_FILE_INFO,
+				  acpi_device_dir(device));
+
 		remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/bus.c	Tue Jun 15 22:20:41 2004
@@ -112,6 +112,14 @@
 	else
 		STRUCT_TO_INT(device->status) = 0x0F;
 
+	if (device->status.functional && !device->status.present) {
+		printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
+			"functional but not present; setting present\n",
+			device->pnp.bus_id,
+			(u32) STRUCT_TO_INT(device->status));
+		device->status.present = 1;
+	}
+
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 
 		device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
 
diff -Nru a/drivers/acpi/button.c b/drivers/acpi/button.c
--- a/drivers/acpi/button.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/button.c	Tue Jun 15 22:20:36 2004
@@ -108,9 +108,6 @@
    -------------------------------------------------------------------------- */
 
 static struct proc_dir_entry	*acpi_button_dir;
-extern struct acpi_device 	*acpi_fixed_pwr_button;
-extern struct acpi_device	*acpi_fixed_sleep_button;
-
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
@@ -241,6 +238,16 @@
 
 	button = acpi_driver_data(device);
 	if (acpi_device_dir(device)) {
+		if (button->type == ACPI_BUTTON_TYPE_LID)
+			remove_proc_entry(ACPI_BUTTON_FILE_STATE,
+					     acpi_device_dir(device));
+		remove_proc_entry(ACPI_BUTTON_FILE_INFO,
+				     acpi_device_dir(device));
+
+		remove_proc_entry(acpi_device_bid(device),
+				     acpi_device_dir(device)->parent);
+
+
 		switch (button->type) {
 			case ACPI_BUTTON_TYPE_POWER:
 			case ACPI_BUTTON_TYPE_POWERF:
@@ -529,12 +536,6 @@
 acpi_button_exit (void)
 {
 	ACPI_FUNCTION_TRACE("acpi_button_exit");
-
-	if(acpi_fixed_pwr_button) 
-		acpi_button_remove(acpi_fixed_pwr_button, ACPI_BUS_TYPE_POWER_BUTTON);
-
-	if(acpi_fixed_sleep_button)
-		acpi_button_remove(acpi_fixed_sleep_button, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	acpi_bus_unregister_driver(&acpi_button_driver);
 
diff -Nru a/drivers/acpi/debug.c b/drivers/acpi/debug.c
--- a/drivers/acpi/debug.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/acpi/debug.c	Tue Jun 15 22:20:42 2004
@@ -55,7 +55,7 @@
 static int
 acpi_system_write_debug (
 	struct file             *file,
-        const char              *buffer,
+        const char              __user *buffer,
 	unsigned long           count,
         void                    *data)
 {
diff -Nru a/drivers/acpi/ec.c b/drivers/acpi/ec.c
--- a/drivers/acpi/ec.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/ec.c	Tue Jun 15 22:20:41 2004
@@ -548,6 +548,12 @@
 {
 	ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
 
+	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
+		remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
+		acpi_device_dir(device) = NULL;
+	}
+
 	return_VALUE(0);
 }
 
diff -Nru a/drivers/acpi/event.c b/drivers/acpi/event.c
--- a/drivers/acpi/event.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/event.c	Tue Jun 15 22:20:36 2004
@@ -42,7 +42,7 @@
 static ssize_t
 acpi_system_read_event (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
diff -Nru a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
--- a/drivers/acpi/events/evxface.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/events/evxface.c	Tue Jun 15 22:20:41 2004
@@ -406,6 +406,15 @@
 			goto unlock_and_exit;
 		}
 
+		/* Make sure all deferred tasks are completed */
+
+		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_os_wait_events_complete(NULL);
+		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE (status)) {
+			return_ACPI_STATUS (status);
+ 		}
+
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
 			acpi_gbl_system_notify.node  = NULL;
 			acpi_gbl_system_notify.handler = NULL;
@@ -452,6 +461,15 @@
 			goto unlock_and_exit;
 		}
 
+		/* Make sure all deferred tasks are completed */
+
+		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_os_wait_events_complete(NULL);
+		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE (status)) {
+			return_ACPI_STATUS (status);
+ 		}
+
 		/* Remove the handler */
 
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
@@ -613,6 +631,15 @@
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
+
+	/* Make sure all deferred tasks are completed */
+
+	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+	acpi_os_wait_events_complete(NULL);
+	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE (status)) {
+		return_ACPI_STATUS (status);
+ 	}
 
 	/* Remove the handler */
 
diff -Nru a/drivers/acpi/fan.c b/drivers/acpi/fan.c
--- a/drivers/acpi/fan.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/fan.c	Tue Jun 15 22:20:36 2004
@@ -114,7 +114,7 @@
 static int
 acpi_fan_write_state (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	unsigned long		count,
 	void			*data)
 {
@@ -185,6 +185,8 @@
 	ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_FAN_FILE_STATE,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c
--- a/drivers/acpi/osl.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/acpi/osl.c	Tue Jun 15 22:20:43 2004
@@ -66,6 +66,7 @@
 static unsigned int acpi_irq_irq;
 static OSD_HANDLER acpi_irq_handler;
 static void *acpi_irq_context;
+static struct workqueue_struct *kacpid_wq;
 
 acpi_status
 acpi_os_initialize(void)
@@ -80,6 +81,8 @@
 		return AE_NULL_ENTRY;
 	}
 #endif
+	kacpid_wq = create_singlethread_workqueue("kacpid");
+	BUG_ON(!kacpid_wq);
 
 	return AE_OK;
 }
@@ -92,6 +95,8 @@
 						 acpi_irq_handler);
 	}
 
+	destroy_workqueue(kacpid_wq);
+
 	return AE_OK;
 }
 
@@ -654,13 +659,20 @@
 	task = (void *)(dpc+1);
 	INIT_WORK(task, acpi_os_execute_deferred, (void*)dpc);
 
-	if (!schedule_work(task)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to schedule_work() failed.\n"));
+	if (!queue_work(kacpid_wq, task)) {
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n"));
 		kfree(dpc);
 		status = AE_ERROR;
 	}
 
 	return_ACPI_STATUS (status);
+}
+
+void
+acpi_os_wait_events_complete(
+	void *context)
+{
+	flush_workqueue(kacpid_wq);
 }
 
 /*
diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/pci_link.c	Tue Jun 15 22:20:36 2004
@@ -479,7 +479,7 @@
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ9  PCI, often acpi */
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ10 PCI */
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ11 PCI */
-	PIRQ_PENALTY_ISA_TYPICAL,	/* IRQ12 mouse */
+	PIRQ_PENALTY_ISA_USED,	/* IRQ12 mouse */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ13 fpe, sometimes */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ14 ide0 */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ15 ide1 */
@@ -546,17 +546,23 @@
 		if (link->irq.active == link->irq.possible[i])
 			break;
 	}
+	/*
+	 * forget active IRQ that is not in possible list
+	 */
+	if (i == link->irq.possible_count) {
+		if (acpi_strict)
+			printk(KERN_WARNING PREFIX "_CRS %d not found"
+				" in _PRS\n", link->irq.active);
+		link->irq.active = 0;
+	}
 
 	/*
 	 * if active found, use it; else pick entry from end of possible list.
 	 */
-	if (i != link->irq.possible_count) {
+	if (link->irq.active) {
 		irq = link->irq.active;
 	} else {
 		irq = link->irq.possible[link->irq.possible_count - 1];
-		if (acpi_strict)
-			printk(KERN_WARNING PREFIX "_CRS %d not found"
-				" in _PRS\n", link->irq.active);
 	}
 
 	if (acpi_irq_balance || !link->irq.active) {
diff -Nru a/drivers/acpi/power.c b/drivers/acpi/power.c
--- a/drivers/acpi/power.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/power.c	Tue Jun 15 22:20:41 2004
@@ -482,6 +482,8 @@
 	ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_POWER_FILE_STATUS,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c
--- a/drivers/acpi/processor.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/acpi/processor.c	Tue Jun 15 22:20:42 2004
@@ -1948,7 +1948,7 @@
 static ssize_t
 acpi_processor_write_throttling (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         size_t			count,
         loff_t			*data)
 {
@@ -2009,7 +2009,7 @@
 static ssize_t
 acpi_processor_write_limit (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*data)
 {
diff -Nru a/drivers/acpi/scan.c b/drivers/acpi/scan.c
--- a/drivers/acpi/scan.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/scan.c	Tue Jun 15 22:20:39 2004
@@ -4,7 +4,6 @@
 
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
 
 #include <acpi/acpi_drivers.h>
 #include <acpi/acinterp.h>	/* for acpi_ex_eisa_id_to_string() */
@@ -16,12 +15,6 @@
 #define STRUCT_TO_INT(s)	(*((int*)&s))
 
 extern struct acpi_device		*acpi_root;
-struct acpi_device 		*acpi_fixed_pwr_button;
-struct acpi_device 		*acpi_fixed_sleep_button;
-
-EXPORT_SYMBOL(acpi_fixed_pwr_button);
-EXPORT_SYMBOL(acpi_fixed_sleep_button);
-
 
 
 #define ACPI_BUS_CLASS			"system_bus"
@@ -318,8 +311,10 @@
 		struct acpi_device * dev = container_of(node,struct acpi_device,g_list);
 
 		if (dev->driver == drv) {
+			spin_unlock(&acpi_device_lock);
 			if (drv->ops.remove)
 				drv->ops.remove(dev,ACPI_BUS_REMOVAL_NORMAL);
+			spin_lock(&acpi_device_lock);
 			dev->driver = NULL;
 			dev->driver_data = NULL;
 			atomic_dec(&drv->references);
@@ -907,13 +902,10 @@
 	struct acpi_device	*root)
 {
 	int			result = 0;
+	struct acpi_device	*device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
 
-	acpi_fixed_pwr_button = NULL;
-	acpi_fixed_sleep_button = NULL;
-
-
 	if (!root)
 		return_VALUE(-ENODEV);
 
@@ -921,11 +913,11 @@
 	 * Enumerate all fixed-feature devices.
 	 */
 	if (acpi_fadt.pwr_button == 0)
-		result = acpi_bus_add(&acpi_fixed_pwr_button, acpi_root, 
+		result = acpi_bus_add(&device, acpi_root, 
 			NULL, ACPI_BUS_TYPE_POWER_BUTTON);
 
 	if (acpi_fadt.sleep_button == 0)
-		result = acpi_bus_add(&acpi_fixed_sleep_button, acpi_root, 
+		result = acpi_bus_add(&device, acpi_root, 
 			NULL, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	return_VALUE(result);
diff -Nru a/drivers/acpi/system.c b/drivers/acpi/system.c
--- a/drivers/acpi/system.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/system.c	Tue Jun 15 22:20:41 2004
@@ -77,7 +77,7 @@
 	return_VALUE(size);
 }
 
-static ssize_t acpi_system_read_dsdt (struct file*, char*, size_t, loff_t*);
+static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*);
 
 static struct file_operations acpi_system_dsdt_ops = {
 	.read =			acpi_system_read_dsdt,
@@ -86,7 +86,7 @@
 static ssize_t
 acpi_system_read_dsdt (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -120,7 +120,7 @@
 }
 
 
-static ssize_t acpi_system_read_fadt (struct file*, char*, size_t, loff_t*);
+static ssize_t acpi_system_read_fadt (struct file*, char __user *, size_t, loff_t*);
 
 static struct file_operations acpi_system_fadt_ops = {
 	.read =			acpi_system_read_fadt,
@@ -129,7 +129,7 @@
 static ssize_t
 acpi_system_read_fadt (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
diff -Nru a/drivers/acpi/tables.c b/drivers/acpi/tables.c
--- a/drivers/acpi/tables.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/tables.c	Tue Jun 15 22:20:39 2004
@@ -343,10 +343,11 @@
 	entry = (acpi_table_entry_header *)
 		((unsigned long) madt + madt_size);
 
-	while (((unsigned long) entry) < madt_end) {
+	while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) {
 		if (entry->type == entry_id &&
 		    (!max_entries || count++ < max_entries))
-			handler(entry);
+			if (handler(entry, madt_end))
+				return -EINVAL;
 
 		entry = (acpi_table_entry_header *)
 			((unsigned long) entry + entry->length);
diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
--- a/drivers/acpi/thermal.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/acpi/thermal.c	Tue Jun 15 22:20:44 2004
@@ -84,11 +84,11 @@
 static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_trip_points (struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_trip_points (struct file*,const char __user *,size_t,loff_t *);
 static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char __user *,size_t,loff_t *);
 static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_polling(struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_polling(struct file*,const char __user *,size_t,loff_t *);
 
 static struct acpi_driver acpi_thermal_driver = {
 	.name =		ACPI_THERMAL_DRIVER_NAME,
@@ -885,7 +885,7 @@
 static ssize_t
 acpi_thermal_write_trip_points (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         size_t			count,
         loff_t			*ppos)
 {
@@ -954,7 +954,7 @@
 static ssize_t
 acpi_thermal_write_cooling_mode (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -1015,7 +1015,7 @@
 static ssize_t
 acpi_thermal_write_polling (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -1139,6 +1139,16 @@
 	ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_STATE,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
--- a/drivers/acpi/toshiba_acpi.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/toshiba_acpi.c	Tue Jun 15 22:20:36 2004
@@ -252,7 +252,7 @@
 }
 
 static int
-dispatch_write(struct file* file, __user const char* buffer,
+dispatch_write(struct file* file, const char __user * buffer,
 	unsigned long count, ProcItem* item)
 {
 	int result;
diff -Nru a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
--- a/include/acpi/acpiosxf.h	Tue Jun 15 22:20:36 2004
+++ b/include/acpi/acpiosxf.h	Tue Jun 15 22:20:36 2004
@@ -213,6 +213,10 @@
 	void                            *context);
 
 void
+acpi_os_wait_events_complete(
+	void * context);
+
+void
 acpi_os_sleep (
 	u32                             seconds,
 	u32                             milliseconds); 	

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

* RE: 2.6.9 battery status  regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries]
@ 2004-11-29  7:09 Yu, Luming
  0 siblings, 0 replies; 5+ messages in thread
From: Yu, Luming @ 2004-11-29  7:09 UTC (permalink / raw)
  To: Fred Labrosse
  Cc: Karol Kozimor, hgfelger-9nAOAgdJVo4b1SvskN2V4Q,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Brown, Len,
	Fu, Michael

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

>Bug 3678 is about wrong battery and temperature (and maybe 
>others) status
>reported soon after running on batteries, but never when running on AC.
>The problem remains after plugging back the AC.  THIS IS A 
>REGRESSION OF
>2.6.7.

Hi Fred,

  Since the execution for battery and temperature are scheduled through
workqueue of kacpid. I guess, this issue is just due to some defered
task
haven't been executed , when you are observing them.

Anyway, please try to revert the enclosed patch to verfy it is a
regression of 2.6.7.

Please note, I extracted it from patch-2.6.7 from www.kernel.org. If it
doesn't
compile, please look for the missed snippets there.


Thanks,
Luming



[-- Attachment #2: 1.patch --]
[-- Type: application/octet-stream, Size: 21968 bytes --]

diff -Nru a/drivers/acpi/ac.c b/drivers/acpi/ac.c
--- a/drivers/acpi/ac.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/ac.c	Tue Jun 15 22:20:39 2004
@@ -185,6 +185,9 @@
 	ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_AC_FILE_STATE,
+				  acpi_device_dir(device));
+
 		remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/acpi_ksyms.c b/drivers/acpi/acpi_ksyms.c
--- a/drivers/acpi/acpi_ksyms.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/acpi_ksyms.c	Tue Jun 15 22:20:39 2004
@@ -106,7 +106,7 @@
 EXPORT_SYMBOL(acpi_os_create_semaphore);
 EXPORT_SYMBOL(acpi_os_delete_semaphore);
 EXPORT_SYMBOL(acpi_os_wait_semaphore);
-
+EXPORT_SYMBOL(acpi_os_wait_events_complete);
 EXPORT_SYMBOL(acpi_os_read_pci_configuration);
 
 /* ACPI Utilities (acpi_utils.c) */
diff -Nru a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
--- a/drivers/acpi/asus_acpi.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/acpi/asus_acpi.c	Tue Jun 15 22:20:38 2004
@@ -40,6 +40,7 @@
 #include <linux/proc_fs.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_bus.h>
+#include <asm/uaccess.h>
 
 #define ASUS_ACPI_VERSION "0.28"
 
@@ -480,16 +481,31 @@
 	return (hotk->status & ledmask) ? 1 : 0;
 }
 
+static int parse_arg(const char __user *buf, unsigned long count, int *val)
+{
+	char s[32];
+	if (!count)
+		return 0;
+	if (count > 31)
+		return -EINVAL;
+	if (copy_from_user(s, buf, count))
+		return -EFAULT;
+	s[count] = 0;
+	if (sscanf(s, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
 
 /* FIXME: kill extraneous args so it can be called independently */
 static int
-write_led(const char *buffer, unsigned long count, struct asus_hotk *hotk, 
+write_led(const char __user *buffer, unsigned long count, struct asus_hotk *hotk, 
           char *ledname, int ledmask, int invert)
 {
 	int value;
 	int led_out = 0;
 
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		led_out = value ? 1 : 0;
 
 	hotk->status =
@@ -518,7 +534,7 @@
 
 
 static int
-proc_write_mled(struct file *file, const char *buffer,
+proc_write_mled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -537,7 +553,7 @@
 }
 
 static int
-proc_write_wled(struct file *file, const char *buffer,
+proc_write_wled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -556,7 +572,7 @@
 }
 
 static int
-proc_write_tled(struct file *file, const char *buffer,
+proc_write_tled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -640,13 +656,14 @@
 
 
 static int
-proc_write_lcd(struct file *file, const char *buffer,
+proc_write_lcd(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 	
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_lcd_state(hotk, value);
 	return count;
 }
@@ -707,17 +724,18 @@
 }
 
 static int
-proc_write_brn(struct file *file, const char *buffer,
+proc_write_brn(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1) {
+	count = parse_arg(buffer, count, &value);
+	if (count > 0) {
 		value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
 			/* 0 <= value <= 15 */
 		set_brightness(value, hotk);
-	} else {
+	} else if (count < 0) {
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
 	}
 
@@ -756,17 +774,17 @@
  * simultaneously, so be warned. See the acpi4asus README for more info.
  */
 static int
-proc_write_disp(struct file *file, const char *buffer,
+proc_write_disp(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_display(value, hotk);
-	else {
+	else if (count < 0)
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
-	}
 
 	return count;
 }
@@ -774,7 +792,7 @@
 
 typedef int (proc_readfunc)(char *page, char **start, off_t off, int count,
 	                     int *eof, void *data);
-typedef int (proc_writefunc)(struct file *file, const char *buffer,
+typedef int (proc_writefunc)(struct file *file, const char __user *buffer,
 	                      unsigned long count, void *data);
 
 static int
@@ -863,6 +881,29 @@
 	return 0;
 }
 
+static int asus_hotk_remove_fs(struct acpi_device* device)
+{
+	struct asus_hotk* hotk = acpi_driver_data(device);
+
+
+	if(acpi_device_dir(device)){
+		remove_proc_entry(PROC_INFO,acpi_device_dir(device));
+		if (hotk->methods->mt_wled)
+			remove_proc_entry(PROC_WLED,acpi_device_dir(device));
+		if (hotk->methods->mt_mled)
+			remove_proc_entry(PROC_MLED,acpi_device_dir(device));
+		if (hotk->methods->mt_tled)
+			remove_proc_entry(PROC_TLED,acpi_device_dir(device));
+		if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) 
+			remove_proc_entry(PROC_LCD, acpi_device_dir(device));
+		if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || (hotk->methods->brightness_get && hotk->methods->brightness_get)) 
+			remove_proc_entry(PROC_BRN, acpi_device_dir(device));
+		if (hotk->methods->display_set) 
+			remove_proc_entry(PROC_DISP, acpi_device_dir(device));
+	}
+	return 0;
+}
+
 
 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
 {
@@ -1111,7 +1152,6 @@
 	return(result);
 }
 
-
 static int asus_hotk_remove(struct acpi_device *device, int type)
 {
 	acpi_status status = 0;
@@ -1126,6 +1166,8 @@
 					    asus_hotk_notify);
 	if (ACPI_FAILURE(status))
 		printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
+
+	asus_hotk_remove_fs(device);
 
 	kfree(hotk);
 
diff -Nru a/drivers/acpi/battery.c b/drivers/acpi/battery.c
--- a/drivers/acpi/battery.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/acpi/battery.c	Tue Jun 15 22:20:43 2004
@@ -582,7 +582,7 @@
 static int
 acpi_battery_write_alarm (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	unsigned long		count,
 	void			*data)
 {
@@ -679,6 +679,13 @@
 	ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_BATTERY_FILE_ALARM,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_BATTERY_FILE_STATUS,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_BATTERY_FILE_INFO,
+				  acpi_device_dir(device));
+
 		remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/bus.c	Tue Jun 15 22:20:41 2004
@@ -112,6 +112,14 @@
 	else
 		STRUCT_TO_INT(device->status) = 0x0F;
 
+	if (device->status.functional && !device->status.present) {
+		printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
+			"functional but not present; setting present\n",
+			device->pnp.bus_id,
+			(u32) STRUCT_TO_INT(device->status));
+		device->status.present = 1;
+	}
+
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 
 		device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
 
diff -Nru a/drivers/acpi/button.c b/drivers/acpi/button.c
--- a/drivers/acpi/button.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/button.c	Tue Jun 15 22:20:36 2004
@@ -108,9 +108,6 @@
    -------------------------------------------------------------------------- */
 
 static struct proc_dir_entry	*acpi_button_dir;
-extern struct acpi_device 	*acpi_fixed_pwr_button;
-extern struct acpi_device	*acpi_fixed_sleep_button;
-
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
@@ -241,6 +238,16 @@
 
 	button = acpi_driver_data(device);
 	if (acpi_device_dir(device)) {
+		if (button->type == ACPI_BUTTON_TYPE_LID)
+			remove_proc_entry(ACPI_BUTTON_FILE_STATE,
+					     acpi_device_dir(device));
+		remove_proc_entry(ACPI_BUTTON_FILE_INFO,
+				     acpi_device_dir(device));
+
+		remove_proc_entry(acpi_device_bid(device),
+				     acpi_device_dir(device)->parent);
+
+
 		switch (button->type) {
 			case ACPI_BUTTON_TYPE_POWER:
 			case ACPI_BUTTON_TYPE_POWERF:
@@ -529,12 +536,6 @@
 acpi_button_exit (void)
 {
 	ACPI_FUNCTION_TRACE("acpi_button_exit");
-
-	if(acpi_fixed_pwr_button) 
-		acpi_button_remove(acpi_fixed_pwr_button, ACPI_BUS_TYPE_POWER_BUTTON);
-
-	if(acpi_fixed_sleep_button)
-		acpi_button_remove(acpi_fixed_sleep_button, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	acpi_bus_unregister_driver(&acpi_button_driver);
 
diff -Nru a/drivers/acpi/debug.c b/drivers/acpi/debug.c
--- a/drivers/acpi/debug.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/acpi/debug.c	Tue Jun 15 22:20:42 2004
@@ -55,7 +55,7 @@
 static int
 acpi_system_write_debug (
 	struct file             *file,
-        const char              *buffer,
+        const char              __user *buffer,
 	unsigned long           count,
         void                    *data)
 {
diff -Nru a/drivers/acpi/ec.c b/drivers/acpi/ec.c
--- a/drivers/acpi/ec.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/ec.c	Tue Jun 15 22:20:41 2004
@@ -548,6 +548,12 @@
 {
 	ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
 
+	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
+		remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
+		acpi_device_dir(device) = NULL;
+	}
+
 	return_VALUE(0);
 }
 
diff -Nru a/drivers/acpi/event.c b/drivers/acpi/event.c
--- a/drivers/acpi/event.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/event.c	Tue Jun 15 22:20:36 2004
@@ -42,7 +42,7 @@
 static ssize_t
 acpi_system_read_event (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
diff -Nru a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
--- a/drivers/acpi/events/evxface.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/events/evxface.c	Tue Jun 15 22:20:41 2004
@@ -406,6 +406,15 @@
 			goto unlock_and_exit;
 		}
 
+		/* Make sure all deferred tasks are completed */
+
+		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_os_wait_events_complete(NULL);
+		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE (status)) {
+			return_ACPI_STATUS (status);
+ 		}
+
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
 			acpi_gbl_system_notify.node  = NULL;
 			acpi_gbl_system_notify.handler = NULL;
@@ -452,6 +461,15 @@
 			goto unlock_and_exit;
 		}
 
+		/* Make sure all deferred tasks are completed */
+
+		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_os_wait_events_complete(NULL);
+		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE (status)) {
+			return_ACPI_STATUS (status);
+ 		}
+
 		/* Remove the handler */
 
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
@@ -613,6 +631,15 @@
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
+
+	/* Make sure all deferred tasks are completed */
+
+	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+	acpi_os_wait_events_complete(NULL);
+	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE (status)) {
+		return_ACPI_STATUS (status);
+ 	}
 
 	/* Remove the handler */
 
diff -Nru a/drivers/acpi/fan.c b/drivers/acpi/fan.c
--- a/drivers/acpi/fan.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/fan.c	Tue Jun 15 22:20:36 2004
@@ -114,7 +114,7 @@
 static int
 acpi_fan_write_state (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	unsigned long		count,
 	void			*data)
 {
@@ -185,6 +185,8 @@
 	ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_FAN_FILE_STATE,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c
--- a/drivers/acpi/osl.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/acpi/osl.c	Tue Jun 15 22:20:43 2004
@@ -66,6 +66,7 @@
 static unsigned int acpi_irq_irq;
 static OSD_HANDLER acpi_irq_handler;
 static void *acpi_irq_context;
+static struct workqueue_struct *kacpid_wq;
 
 acpi_status
 acpi_os_initialize(void)
@@ -80,6 +81,8 @@
 		return AE_NULL_ENTRY;
 	}
 #endif
+	kacpid_wq = create_singlethread_workqueue("kacpid");
+	BUG_ON(!kacpid_wq);
 
 	return AE_OK;
 }
@@ -92,6 +95,8 @@
 						 acpi_irq_handler);
 	}
 
+	destroy_workqueue(kacpid_wq);
+
 	return AE_OK;
 }
 
@@ -654,13 +659,20 @@
 	task = (void *)(dpc+1);
 	INIT_WORK(task, acpi_os_execute_deferred, (void*)dpc);
 
-	if (!schedule_work(task)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to schedule_work() failed.\n"));
+	if (!queue_work(kacpid_wq, task)) {
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n"));
 		kfree(dpc);
 		status = AE_ERROR;
 	}
 
 	return_ACPI_STATUS (status);
+}
+
+void
+acpi_os_wait_events_complete(
+	void *context)
+{
+	flush_workqueue(kacpid_wq);
 }
 
 /*
diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/pci_link.c	Tue Jun 15 22:20:36 2004
@@ -479,7 +479,7 @@
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ9  PCI, often acpi */
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ10 PCI */
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ11 PCI */
-	PIRQ_PENALTY_ISA_TYPICAL,	/* IRQ12 mouse */
+	PIRQ_PENALTY_ISA_USED,	/* IRQ12 mouse */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ13 fpe, sometimes */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ14 ide0 */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ15 ide1 */
@@ -546,17 +546,23 @@
 		if (link->irq.active == link->irq.possible[i])
 			break;
 	}
+	/*
+	 * forget active IRQ that is not in possible list
+	 */
+	if (i == link->irq.possible_count) {
+		if (acpi_strict)
+			printk(KERN_WARNING PREFIX "_CRS %d not found"
+				" in _PRS\n", link->irq.active);
+		link->irq.active = 0;
+	}
 
 	/*
 	 * if active found, use it; else pick entry from end of possible list.
 	 */
-	if (i != link->irq.possible_count) {
+	if (link->irq.active) {
 		irq = link->irq.active;
 	} else {
 		irq = link->irq.possible[link->irq.possible_count - 1];
-		if (acpi_strict)
-			printk(KERN_WARNING PREFIX "_CRS %d not found"
-				" in _PRS\n", link->irq.active);
 	}
 
 	if (acpi_irq_balance || !link->irq.active) {
diff -Nru a/drivers/acpi/power.c b/drivers/acpi/power.c
--- a/drivers/acpi/power.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/power.c	Tue Jun 15 22:20:41 2004
@@ -482,6 +482,8 @@
 	ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_POWER_FILE_STATUS,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c
--- a/drivers/acpi/processor.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/acpi/processor.c	Tue Jun 15 22:20:42 2004
@@ -1948,7 +1948,7 @@
 static ssize_t
 acpi_processor_write_throttling (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         size_t			count,
         loff_t			*data)
 {
@@ -2009,7 +2009,7 @@
 static ssize_t
 acpi_processor_write_limit (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*data)
 {
diff -Nru a/drivers/acpi/scan.c b/drivers/acpi/scan.c
--- a/drivers/acpi/scan.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/scan.c	Tue Jun 15 22:20:39 2004
@@ -4,7 +4,6 @@
 
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
 
 #include <acpi/acpi_drivers.h>
 #include <acpi/acinterp.h>	/* for acpi_ex_eisa_id_to_string() */
@@ -16,12 +15,6 @@
 #define STRUCT_TO_INT(s)	(*((int*)&s))
 
 extern struct acpi_device		*acpi_root;
-struct acpi_device 		*acpi_fixed_pwr_button;
-struct acpi_device 		*acpi_fixed_sleep_button;
-
-EXPORT_SYMBOL(acpi_fixed_pwr_button);
-EXPORT_SYMBOL(acpi_fixed_sleep_button);
-
 
 
 #define ACPI_BUS_CLASS			"system_bus"
@@ -318,8 +311,10 @@
 		struct acpi_device * dev = container_of(node,struct acpi_device,g_list);
 
 		if (dev->driver == drv) {
+			spin_unlock(&acpi_device_lock);
 			if (drv->ops.remove)
 				drv->ops.remove(dev,ACPI_BUS_REMOVAL_NORMAL);
+			spin_lock(&acpi_device_lock);
 			dev->driver = NULL;
 			dev->driver_data = NULL;
 			atomic_dec(&drv->references);
@@ -907,13 +902,10 @@
 	struct acpi_device	*root)
 {
 	int			result = 0;
+	struct acpi_device	*device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
 
-	acpi_fixed_pwr_button = NULL;
-	acpi_fixed_sleep_button = NULL;
-
-
 	if (!root)
 		return_VALUE(-ENODEV);
 
@@ -921,11 +913,11 @@
 	 * Enumerate all fixed-feature devices.
 	 */
 	if (acpi_fadt.pwr_button == 0)
-		result = acpi_bus_add(&acpi_fixed_pwr_button, acpi_root, 
+		result = acpi_bus_add(&device, acpi_root, 
 			NULL, ACPI_BUS_TYPE_POWER_BUTTON);
 
 	if (acpi_fadt.sleep_button == 0)
-		result = acpi_bus_add(&acpi_fixed_sleep_button, acpi_root, 
+		result = acpi_bus_add(&device, acpi_root, 
 			NULL, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	return_VALUE(result);
diff -Nru a/drivers/acpi/system.c b/drivers/acpi/system.c
--- a/drivers/acpi/system.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/system.c	Tue Jun 15 22:20:41 2004
@@ -77,7 +77,7 @@
 	return_VALUE(size);
 }
 
-static ssize_t acpi_system_read_dsdt (struct file*, char*, size_t, loff_t*);
+static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*);
 
 static struct file_operations acpi_system_dsdt_ops = {
 	.read =			acpi_system_read_dsdt,
@@ -86,7 +86,7 @@
 static ssize_t
 acpi_system_read_dsdt (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -120,7 +120,7 @@
 }
 
 
-static ssize_t acpi_system_read_fadt (struct file*, char*, size_t, loff_t*);
+static ssize_t acpi_system_read_fadt (struct file*, char __user *, size_t, loff_t*);
 
 static struct file_operations acpi_system_fadt_ops = {
 	.read =			acpi_system_read_fadt,
@@ -129,7 +129,7 @@
 static ssize_t
 acpi_system_read_fadt (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
diff -Nru a/drivers/acpi/tables.c b/drivers/acpi/tables.c
--- a/drivers/acpi/tables.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/tables.c	Tue Jun 15 22:20:39 2004
@@ -343,10 +343,11 @@
 	entry = (acpi_table_entry_header *)
 		((unsigned long) madt + madt_size);
 
-	while (((unsigned long) entry) < madt_end) {
+	while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) {
 		if (entry->type == entry_id &&
 		    (!max_entries || count++ < max_entries))
-			handler(entry);
+			if (handler(entry, madt_end))
+				return -EINVAL;
 
 		entry = (acpi_table_entry_header *)
 			((unsigned long) entry + entry->length);
diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
--- a/drivers/acpi/thermal.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/acpi/thermal.c	Tue Jun 15 22:20:44 2004
@@ -84,11 +84,11 @@
 static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_trip_points (struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_trip_points (struct file*,const char __user *,size_t,loff_t *);
 static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char __user *,size_t,loff_t *);
 static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_polling(struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_polling(struct file*,const char __user *,size_t,loff_t *);
 
 static struct acpi_driver acpi_thermal_driver = {
 	.name =		ACPI_THERMAL_DRIVER_NAME,
@@ -885,7 +885,7 @@
 static ssize_t
 acpi_thermal_write_trip_points (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         size_t			count,
         loff_t			*ppos)
 {
@@ -954,7 +954,7 @@
 static ssize_t
 acpi_thermal_write_cooling_mode (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -1015,7 +1015,7 @@
 static ssize_t
 acpi_thermal_write_polling (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -1139,6 +1139,16 @@
 	ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_STATE,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
--- a/drivers/acpi/toshiba_acpi.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/toshiba_acpi.c	Tue Jun 15 22:20:36 2004
@@ -252,7 +252,7 @@
 }
 
 static int
-dispatch_write(struct file* file, __user const char* buffer,
+dispatch_write(struct file* file, const char __user * buffer,
 	unsigned long count, ProcItem* item)
 {
 	int result;

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

* RE: 2.6.9 battery status  regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries]
@ 2004-11-29  8:23 Yu, Luming
  0 siblings, 0 replies; 5+ messages in thread
From: Yu, Luming @ 2004-11-29  8:23 UTC (permalink / raw)
  To: Yu, Luming, Fred Labrosse
  Cc: Karol Kozimor, hgfelger-9nAOAgdJVo4b1SvskN2V4Q,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Brown, Len,
	Fu, Michael

If previous debug patch have positive effect, would you please try the following one.

diff -BruN 2.6/drivers/acpi/battery.c edit.stack/drivers/acpi/battery.c
--- 2.6/drivers/acpi/battery.c  2004-11-23 18:46:32.000000000 +0800
+++ edit.stack/drivers/acpi/battery.c   2004-11-29 16:53:25.000000000 +0800
@@ -200,6 +200,7 @@
        if (!battery || !bst)
                return_VALUE(-EINVAL);

+       acpi_os_wait_events_complete(NULL);
        /* Evalute _BST */

        status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
diff -BruN 2.6/drivers/acpi/thermal.c edit.stack/drivers/acpi/thermal.c
--- 2.6/drivers/acpi/thermal.c  2004-11-23 18:46:50.000000000 +0800
+++ edit.stack/drivers/acpi/thermal.c   2004-11-29 16:55:04.000000000 +0800
@@ -224,6 +224,8 @@

        tz->last_temperature = tz->temperature;

+       acpi_os_wait_events_complete(NULL);
+
        status = acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV); 

Thanks
Luming 

>-----Original Message-----
>From: Yu, Luming 
>Sent: 2004年11月29日 15:09
>To: 'Fred Labrosse'
>Cc: Karol Kozimor; hgfelger-9nAOAgdJVo4b1SvskN2V4Q@public.gmane.org; 
>acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org; Brown, Len; Fu, Michael
>Subject: RE: 2.6.9 battery status regression ? [was RE: [ACPI] 
>Battery status wrong from 2.6.7 when running on batteries]
>
>>Bug 3678 is about wrong battery and temperature (and maybe 
>>others) status
>>reported soon after running on batteries, but never when 
>running on AC.
>>The problem remains after plugging back the AC.  THIS IS A 
>>REGRESSION OF
>>2.6.7.
>
>Hi Fred,
>
>  Since the execution for battery and temperature are scheduled through
>workqueue of kacpid. I guess, this issue is just due to some 
>defered task
>haven't been executed , when you are observing them.
>
>Anyway, please try to revert the enclosed patch to verfy it is 
>a regression of 2.6.7.
>
>Please note, I extracted it from patch-2.6.7 from 
>www.kernel.org. If it doesn't
>compile, please look for the missed snippets there.
>
>
>Thanks,
>Luming
>
>
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

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

end of thread, other threads:[~2004-11-29  8:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-16  9:20 2.6.9 battery status regression ? [was RE: Battery status wrong from 2.6.7 when running on batteries] Yu, Luming
2004-11-17 10:06 ` Fred Labrosse
  -- strict thread matches above, loose matches on Subject: below --
2004-11-17 11:30 Yu, Luming
2004-11-29  7:09 Yu, Luming
2004-11-29  8:23 Yu, Luming

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