All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.30 oops with acpi/button
@ 2009-07-09  8:29 Stephen J. Gowdy
  2009-07-09 20:25 ` [Bug 13751] " Bjorn Helgaas
  2009-07-10  2:57   ` ykzhao
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen J. Gowdy @ 2009-07-09  8:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-acpi

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1524 bytes --]

Hi Len & Bjorn,
 	I've not had time to go back to it but with 2.6.30 I get an oops 
when I close the lid on my HP Compaq 6910p laptop. I see you removed some 
null pointer checks.. perhaps tha tis why? Here is the oops extracted from 
my log file. If you want me to test a patch let me know. I'm about to try 
2.6.30.1 but I don't see anything in the ChangeLog that is likely to make 
a difference.
 	I've gone back to 2.6.29.4 where it is fine. I tried unloading the 
"button" module first but in that case my laptop locked up without an 
oops. No flashing num/caps lock or anything, just froze when I close the 
lid. The version of button.c from 2.6.29.4  doesn't compile in the 2.6.30 
tree;

drivers/acpi/button.c: In function ‘acpi_button_add_fs’:
drivers/acpi/button.c:203: error: ‘struct proc_dir_entry’ has no member 
named ‘owner’
drivers/acpi/button.c:208: error: ‘struct proc_dir_entry’ has no member 
named ‘owner’
drivers/acpi/button.c: In function ‘acpi_button_init’:
drivers/acpi/button.c:525: error: ‘struct proc_dir_entry’ has no member 
named ‘owner’

 	Any ideas?


 						regards,

 						Stephen.

-- 
  /------------------------------------+-------------------------\
|Stephen J. Gowdy                     | CERN       Office: 8-1-11|
|http://cern.ch/gowdy/                | CH-1211 Geneva 23        |
|                                     | Switzerland              |
|EMail: gowdy@cern.ch                 | Tel: +41 76 487 2215     |
  \------------------------------------+-------------------------/

[-- Attachment #2: Type: APPLICATION/OCTET-STREAM, Size: 10725 bytes --]

Jun 19 09:34:12 localhost kernel: kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
Jun 19 09:34:12 localhost kernel: BUG: unable to handle kernel paging request at ffff88007f2f0001
Jun 19 09:34:12 localhost kernel: IP: [<ffff88007f2f0001>] 0xffff88007f2f0001
Jun 19 09:34:12 localhost kernel: PGD 202063 PUD 8067 PMD 800000007f2001e3 
Jun 19 09:34:12 localhost kernel: Oops: 0011 [#1] SMP 
Jun 19 09:34:12 localhost kernel: last sysfs file: /sys/class/input/input9/event9/dev
Jun 19 09:34:12 localhost kernel: kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
Jun 19 09:34:12 localhost kernel: BUG: unable to handle kernel paging request at ffff88007f223c30
Jun 19 09:34:12 localhost kernel: IP: [<ffff88007f223c30>] 0xffff88007f223c30
Jun 19 09:34:12 localhost kernel: PGD 202063 PUD 8067 PMD 800000007f2001e3 
Jun 19 09:34:12 localhost kernel: Oops: 0011 [#2] SMP 
Jun 19 09:34:12 localhost kernel: last sysfs file: /sys/class/input/input9/event9/dev
Jun 19 09:34:12 localhost kernel: CPU 1 
Jun 19 09:34:12 localhost kernel: Modules linked in: i915 drm i2c_algo_bit coretemp hwmon i2c_dev i2c_core hidp hid rfcomm l2cap nf_conntrack_netbios_ns ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack iptable_filter ip_tables ip6t_REJECT xt_tcpudp ip6table_filter ip6_tables x_tables ipv6 acpi_cpufreq sbs sbshc pci_slot nvram ide_cs sg joydev arc4 usb_storage ecb snd_hda_codec_analog ide_cd_mod cryptomgr btusb snd_hda_intel cdrom aead bluetooth pcompress crypto_blkcipher crypto_hash snd_hda_codec crypto_algapi serio_raw snd_hwdep video snd_seq_dummy fan backlight snd_seq_oss snd_seq_midi_event hp_accel output lis3lv02d snd_seq ohci1394 container iwlagn snd_seq_device iwlcore rfkill lib80211 snd_pcm_oss snd_mixer_oss ieee1394 snd_pcm thermal ac processor battery button sdhci_pci sdhci e1000e mac80211 wmi ricoh_mmc mmc_core yenta_socket rsrc_nonstatic pata_acpi snd_timer snd ata_piix soundcore cfg80211 iTCO_wdt pcspkr snd_page_alloc ide_gd_mod ahci libata sd_mod scsi_mod ext3 jbd uhci_hcd ehci_hcd [
Jun 19 09:34:12 localhost kernel: ast unloaded: microcode]
Jun 19 09:34:12 localhost kernel: Pid: 85, comm: kacpid Not tainted 2.6.30 #1 HP Compaq 6910p
Jun 19 09:34:12 localhost kernel: RIP: 61e0:[<000000007f7e7de0>]  [<000000007f7e7de0>] 0x7f7e7de0
Jun 19 09:34:12 localhost kernel: RSP: ffff88007f089a98:ffffffff80354905  EFLAGS: ffff88007f089ae0
Jun 19 09:34:12 localhost kernel: RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff8059fee0
Jun 19 09:34:12 localhost kernel: RDX: ffff88007f223b28 RSI: 0000000000000000 RDI: ffffffff8059fee0
Jun 19 09:34:12 localhost kernel: RBP: 00000000ffffffff R08: 0000000000000000 R09: 000000000000000b
Jun 19 09:34:12 localhost kernel: R10: ffff88007f089a98 R11: 0000000000000004 R12: 0000000000000000
Jun 19 09:34:12 localhost kernel: R13: ffff88007f223b28 R14: 0000000000000001 R15: 0000000000000046
Jun 19 09:34:12 localhost kernel: FS:  0000000000000000(0000) GS:ffff880001028000(0000) knlGS:0000000000000000
Jun 19 09:34:12 localhost kernel: CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
Jun 19 09:34:12 localhost kernel: CR2: ffff88007f223c30 CR3: 0000000059298000 CR4: 00000000000006e0
Jun 19 09:34:12 localhost kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jun 19 09:34:12 localhost kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Jun 19 09:34:12 localhost kernel: Process kacpid (pid: 85, threadinfo ffff88007f222000, task ffff88007f12e6d0)
Jun 19 09:34:12 localhost kernel: Stack:
Jun 19 09:34:12 localhost kernel:  ffffffff8034d8bc ffff88007f223bc8 000000007f7e7de0 000000007f12e6d0
Jun 19 09:34:12 localhost kernel:  0000000000000011 0000000000000000 ffff88007f089ae0 ffff88007f0a5a50
Jun 19 09:34:12 localhost kernel:  0000000000000004 ffff88007f089ae0 0000000000000140 0000000000000000
Jun 19 09:34:12 localhost kernel: Call Trace:
Jun 19 09:34:12 localhost kernel:  [<ffffffff8034d8bc>] ? acpi_ev_address_space_dispatch+0x168/0x1b5
Jun 19 09:34:12 localhost kernel:  [<ffffffff80351ec6>] ? acpi_ex_access_region+0x1f4/0x211
Jun 19 09:34:12 localhost kernel:  [<ffffffff80221ddd>] ? no_context+0x1c8/0x1fd
Jun 19 09:34:12 localhost kernel:  [<ffffffff802298d5>] ? update_curr+0x52/0x8e
Jun 19 09:34:12 localhost kernel:  [<ffffffff8035f14a>] ? acpi_ut_valid_acpi_name+0x1e/0x3b
Jun 19 09:34:12 localhost kernel:  [<ffffffff80229991>] ? __dequeue_entity+0x1b/0x2e
Jun 19 09:34:12 localhost kernel:  [<ffffffff802299bb>] ? set_next_entity+0x17/0x32
Jun 19 09:34:12 localhost kernel:  [<ffffffff80229b17>] ? pick_next_task_fair+0x7a/0x82
Jun 19 09:34:12 localhost kernel:  [<ffffffff802298d5>] ? update_curr+0x52/0x8e
Jun 19 09:34:12 localhost kernel:  [<ffffffff8022f1af>] ? check_preempt_wakeup+0x39/0x108
Jun 19 09:34:12 localhost kernel:  [<ffffffff8044dc29>] ? schedule+0x9/0x1d
Jun 19 09:34:12 localhost kernel:  [<ffffffff8044dfd0>] ? schedule_timeout+0x130/0x158
Jun 19 09:34:12 localhost kernel:  [<ffffffff8023a6d5>] ? process_timeout+0x0/0x5
Jun 19 09:34:12 localhost kernel:  [<ffffffff8035385c>] ? acpi_ex_system_do_suspend+0x11/0x1a
Jun 19 09:34:12 localhost kernel:  [<ffffffff8034aafd>] ? acpi_ds_exec_end_op+0xe5/0x408
Jun 19 09:34:12 localhost kernel:  [<ffffffff8035b3c1>] ? acpi_ps_parse_loop+0x65d/0x83c
Jun 19 09:34:12 localhost kernel:  [<ffffffff8035a684>] ? acpi_ps_parse_aml+0x8c/0x2ec
Jun 19 09:34:12 localhost kernel:  [<ffffffff8033f3a3>] ? acpi_os_execute_deferred+0x0/0x2c
Jun 19 09:34:12 localhost kernel:  [<ffffffff8035bbe4>] ? acpi_ps_execute_method+0x1b4/0x260
Jun 19 09:34:12 localhost kernel:  [<ffffffff80357fa1>] ? acpi_ns_evaluate+0xdd/0x1b8
Jun 19 09:34:12 localhost kernel:  [<ffffffff8034f78c>] ? acpi_ev_asynch_execute_gpe_method+0xf7/0x14c
Jun 19 09:34:12 localhost kernel:  [<ffffffff8033f3c6>] ? acpi_os_execute_deferred+0x23/0x2c
Jun 19 09:34:12 localhost kernel:  [<ffffffff80240f81>] ? worker_thread+0x15b/0x1f5
Jun 19 09:34:12 localhost kernel:  [<ffffffff80243b10>] ? autoremove_wake_function+0x0/0x2e
Jun 19 09:34:12 localhost kernel:  [<ffffffff80240e26>] ? worker_thread+0x0/0x1f5
Jun 19 09:34:12 localhost kernel:  [<ffffffff802439f2>] ? kthread+0x54/0x82
Jun 19 09:34:12 localhost kernel:  [<ffffffff8020c93a>] ? child_rip+0xa/0x20
Jun 19 09:34:12 localhost kernel:  [<ffffffff8024399e>] ? kthread+0x0/0x82
Jun 19 09:34:12 localhost kernel:  [<ffffffff8020c930>] ? child_rip+0x0/0x20
Jun 19 09:34:12 localhost kernel: Code:  Bad RIP value.
Jun 19 09:34:12 localhost kernel: RIP  [<000000007f7e7de0>] 0x7f7e7de0
Jun 19 09:34:12 localhost kernel:  RSP <ffffffff80354905>
Jun 19 09:34:12 localhost kernel: CR2: ffff88007f223c30
Jun 19 09:34:12 localhost kernel: ---[ end trace 7e436e2dd8db8c4a ]---
Jun 19 09:34:12 localhost kernel: Kernel panic - not syncing: Attempted to kill the idle task!
Jun 19 09:34:12 localhost kernel: Pid: 0, comm: swapper Tainted: G      D    2.6.30 #1
Jun 19 09:34:12 localhost kernel: Call Trace:
Jun 19 09:41:10 localhost kernel: ------------[ cut here ]------------
Jun 19 09:41:10 localhost kernel: WARNING: at net/sched/sch_generic.c:226 dev_watchdog+0x11f/0x1b0()
Jun 19 09:41:10 localhost kernel: Hardware name: HP Compaq 6910p
Jun 19 09:41:10 localhost kernel: NETDEV WATCHDOG: eth0 (e1000e): transmit timed out
Jun 19 09:41:10 localhost kernel: Modules linked in: i915 drm i2c_algo_bit coretemp hwmon i2c_dev i2c_core hidp hid rfcomm l2cap nf_conntrack_netbios_ns ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack iptable_filter ip_tables ip6t_REJECT xt_tcpudp ip6table_filter ip6_tables x_tables ipv6 acpi_cpufreq sbs sbshc pci_slot nvram ide_cs sg joydev arc4 usb_storage ecb snd_hda_codec_analog ide_cd_mod cryptomgr btusb snd_hda_intel cdrom aead bluetooth pcompress crypto_blkcipher crypto_hash snd_hda_codec crypto_algapi serio_raw snd_hwdep video snd_seq_dummy fan backlight snd_seq_oss snd_seq_midi_event hp_accel output lis3lv02d snd_seq ohci1394 container iwlagn snd_seq_device iwlcore rfkill lib80211 snd_pcm_oss snd_mixer_oss ieee1394 snd_pcm thermal ac processor battery button sdhci_pci sdhci e1000e mac80211 wmi ricoh_mmc mmc_core yenta_socket rsrc_nonstatic pata_acpi snd_timer snd ata_piix soundcore cfg80211 iTCO_wdt pcspkr snd_page_alloc ide_gd_mod ahci libata sd_mod scsi_mod ext3 jbd uhci_hcd ehci_hcd [
Jun 19 09:41:10 localhost kernel: ast unloaded: microcode]
Jun 19 09:41:10 localhost kernel: Pid: 0, comm: swapper Tainted: G      D    2.6.30 #1
Jun 19 09:41:10 localhost kernel: Call Trace:
Jun 19 09:41:10 localhost kernel:  <IRQ>  [<ffffffff803e579f>] ? dev_watchdog+0x11f/0x1b0
Jun 19 09:41:10 localhost kernel:  [<ffffffff80231f16>] ? warn_slowpath_common+0x77/0x8e
Jun 19 09:41:10 localhost kernel:  [<ffffffff802464a6>] ? ktime_get_ts+0x22/0x4a
Jun 19 09:41:10 localhost kernel:  [<ffffffff80231fc8>] ? warn_slowpath_fmt+0x90/0x98
Jun 19 09:41:10 localhost kernel:  [<ffffffff802499ee>] ? getnstimeofday+0x56/0xb5
Jun 19 09:41:10 localhost kernel:  [<ffffffff802464a6>] ? ktime_get_ts+0x22/0x4a
Jun 19 09:41:10 localhost kernel:  [<ffffffff802464da>] ? ktime_get+0xc/0x41
Jun 19 09:41:10 localhost kernel:  [<ffffffff8021b7ce>] ? lapic_next_event+0x18/0x1d
Jun 19 09:41:10 localhost kernel:  [<ffffffff8024d095>] ? tick_dev_program_event+0x29/0x9a
Jun 19 09:41:10 localhost kernel:  [<ffffffff8024662c>] ? hrtimer_interrupt+0x11d/0x134
Jun 19 09:41:10 localhost kernel:  [<ffffffff803d4c15>] ? netdev_drivername+0x3b/0x40
Jun 19 09:41:10 localhost kernel:  [<ffffffff803e579f>] ? dev_watchdog+0x11f/0x1b0
Jun 19 09:41:10 localhost kernel:  [<ffffffff803068bf>] ? blk_rq_timed_out_timer+0x1c/0xe5
Jun 19 09:41:10 localhost kernel:  [<ffffffff803e5680>] ? dev_watchdog+0x0/0x1b0
Jun 19 09:41:10 localhost kernel:  [<ffffffff8023a25d>] ? run_timer_softirq+0x12c/0x193
Jun 19 09:41:10 localhost kernel:  [<ffffffff80236662>] ? __do_softirq+0xa3/0x163
Jun 19 09:41:10 localhost kernel:  [<ffffffff8020ca3c>] ? call_softirq+0x1c/0x28
Jun 19 09:41:10 localhost kernel:  [<ffffffff8020e210>] ? do_softirq+0x2c/0x68
Jun 19 09:41:10 localhost kernel:  [<ffffffff8020dacb>] ? do_IRQ+0xa9/0xbf
Jun 19 09:41:10 localhost kernel:  [<ffffffff8020c313>] ? ret_from_intr+0x0/0xa
Jun 19 09:41:10 localhost kernel:  <EOI>  [<ffffffff8021fc47>] ? hpet_legacy_next_event+0x0/0x7
Jun 19 09:41:10 localhost kernel:  [<ffffffffa01c5642>] ? acpi_idle_enter_simple+0x120/0x14e [processor]
Jun 19 09:41:10 localhost kernel:  [<ffffffffa01c5638>] ? acpi_idle_enter_simple+0x116/0x14e [processor]
Jun 19 09:41:10 localhost kernel:  [<ffffffff803c2fee>] ? cpuidle_idle_call+0x7f/0xbd
Jun 19 09:41:10 localhost kernel:  [<ffffffff8020aa79>] ? cpu_idle+0x40/0x5e
Jun 19 09:41:10 localhost kernel: ---[ end trace 7e436e2dd8db8c4b ]---

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

* [Bug 13751] 2.6.30 oops with acpi/button
  2009-07-09  8:29 2.6.30 oops with acpi/button Stephen J. Gowdy
@ 2009-07-09 20:25 ` Bjorn Helgaas
  2009-07-10  2:57   ` ykzhao
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2009-07-09 20:25 UTC (permalink / raw)
  To: Stephen J. Gowdy; +Cc: linux-kernel, linux-acpi, bugme-daemon, Matthew Garrett

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

>  	I've not had time to go back to it but with 2.6.30 I get an oops 
> when I close the lid on my HP Compaq 6910p laptop.

I opened this bugzilla for the oops:
  http://bugzilla.kernel.org/show_bug.cgi?id=13751

Other reports that may be related:
  http://lkml.indiana.edu/hypermail/linux/kernel/0906.2/02139.html
  https://bugs.launchpad.net/ubuntu/hardy/+source/hotkey-setup/+bug/157691

I see floundering and workarounds in the reports above, but no
real solution yet.

The oops is a page fault on the IP, which means we branched into
the weeds, possibly by following a bad function pointer:

  BUG: unable to handle kernel paging request at ffff88007f223c30
  IP: [<ffff88007f223c30>] 0xffff88007f223c30

One possible cause is a module that doesn't clean up properly
when it is unloaded.  Can you reproduce the problem with
CONFIG_MODULE_UNLOAD turned off?

I doubt this is a button driver problem, but attached is a patch that
reverts the driver to the 2.6.29 version.  Can you try it out?

Bjorn

[-- Attachment #2: button.patch --]
[-- Type: text/x-diff, Size: 14063 bytes --]

commit e82e0de17d168f1352da986053943e98aa41a47a
Author: Bjorn Helgaas <bjorn.helgaas@hp.com>
Date:   Thu Jul 9 09:45:38 2009 -0600

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 9195deb..c2f0606 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -1,5 +1,5 @@
 /*
- *  button.c - ACPI Button Driver
+ *  acpi_button.c - ACPI Button Driver ($Revision: 30 $)
  *
  *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
@@ -41,13 +41,17 @@
 
 #define ACPI_BUTTON_SUBCLASS_POWER	"power"
 #define ACPI_BUTTON_HID_POWER		"PNP0C0C"
-#define ACPI_BUTTON_DEVICE_NAME_POWER	"Power Button"
+#define ACPI_BUTTON_DEVICE_NAME_POWER	"Power Button (CM)"
+#define ACPI_BUTTON_DEVICE_NAME_POWERF	"Power Button (FF)"
 #define ACPI_BUTTON_TYPE_POWER		0x01
+#define ACPI_BUTTON_TYPE_POWERF		0x02
 
 #define ACPI_BUTTON_SUBCLASS_SLEEP	"sleep"
 #define ACPI_BUTTON_HID_SLEEP		"PNP0C0E"
-#define ACPI_BUTTON_DEVICE_NAME_SLEEP	"Sleep Button"
+#define ACPI_BUTTON_DEVICE_NAME_SLEEP	"Sleep Button (CM)"
+#define ACPI_BUTTON_DEVICE_NAME_SLEEPF	"Sleep Button (FF)"
 #define ACPI_BUTTON_TYPE_SLEEP		0x03
+#define ACPI_BUTTON_TYPE_SLEEPF		0x04
 
 #define ACPI_BUTTON_SUBCLASS_LID	"lid"
 #define ACPI_BUTTON_HID_LID		"PNP0C0D"
@@ -74,7 +78,6 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
 static int acpi_button_add(struct acpi_device *device);
 static int acpi_button_remove(struct acpi_device *device, int type);
 static int acpi_button_resume(struct acpi_device *device);
-static void acpi_button_notify(struct acpi_device *device, u32 event);
 static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
 static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
 
@@ -86,11 +89,11 @@ static struct acpi_driver acpi_button_driver = {
 		.add = acpi_button_add,
 		.resume = acpi_button_resume,
 		.remove = acpi_button_remove,
-		.notify = acpi_button_notify,
 	},
 };
 
 struct acpi_button {
+	struct acpi_device *device;	/* Fixed button kludge */
 	unsigned int type;
 	struct input_dev *input;
 	char phys[32];			/* for input device */
@@ -121,10 +124,14 @@ static struct proc_dir_entry *acpi_button_dir;
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_device *device = seq->private;
+	struct acpi_button *button = seq->private;
+
+	if (!button || !button->device)
+		return 0;
 
 	seq_printf(seq, "type:                    %s\n",
-		   acpi_device_name(device));
+		   acpi_device_name(button->device));
+
 	return 0;
 }
 
@@ -135,11 +142,14 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
 
 static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_device *device = seq->private;
+	struct acpi_button *button = seq->private;
 	acpi_status status;
 	unsigned long long state;
 
-	status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state);
+	if (!button || !button->device)
+		return 0;
+
+	status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state);
 	seq_printf(seq, "state:      %s\n",
 		   ACPI_FAILURE(status) ? "unsupported" :
 			(state ? "open" : "closed"));
@@ -157,17 +167,24 @@ static struct proc_dir_entry *acpi_lid_dir;
 
 static int acpi_button_add_fs(struct acpi_device *device)
 {
-	struct acpi_button *button = acpi_driver_data(device);
 	struct proc_dir_entry *entry = NULL;
+	struct acpi_button *button;
+
+	if (!device || !acpi_driver_data(device))
+		return -EINVAL;
+
+	button = acpi_driver_data(device);
 
 	switch (button->type) {
 	case ACPI_BUTTON_TYPE_POWER:
+	case ACPI_BUTTON_TYPE_POWERF:
 		if (!acpi_power_dir)
 			acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
 						    acpi_button_dir);
 		entry = acpi_power_dir;
 		break;
 	case ACPI_BUTTON_TYPE_SLEEP:
+	case ACPI_BUTTON_TYPE_SLEEPF:
 		if (!acpi_sleep_dir)
 			acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
 						    acpi_button_dir);
@@ -191,7 +208,8 @@ static int acpi_button_add_fs(struct acpi_device *device)
 	/* 'info' [R] */
 	entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
 				 S_IRUGO, acpi_device_dir(device),
-				 &acpi_button_info_fops, device);
+				 &acpi_button_info_fops,
+				 acpi_driver_data(device));
 	if (!entry)
 		return -ENODEV;
 
@@ -199,7 +217,8 @@ static int acpi_button_add_fs(struct acpi_device *device)
 	if (button->type == ACPI_BUTTON_TYPE_LID) {
 		entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
 					 S_IRUGO, acpi_device_dir(device),
-					 &acpi_button_state_fops, device);
+					 &acpi_button_state_fops,
+					 acpi_driver_data(device));
 		if (!entry)
 			return -ENODEV;
 	}
@@ -229,35 +248,34 @@ static int acpi_button_remove_fs(struct acpi_device *device)
 /* --------------------------------------------------------------------------
                                 Driver Interface
    -------------------------------------------------------------------------- */
-static int acpi_lid_send_state(struct acpi_device *device)
+static int acpi_lid_send_state(struct acpi_button *button)
 {
-	struct acpi_button *button = acpi_driver_data(device);
 	unsigned long long state;
 	acpi_status status;
 
-	status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state);
+	status = acpi_evaluate_integer(button->device->handle, "_LID", NULL,
+					&state);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
-
 	/* input layer checks if event is redundant */
 	input_report_switch(button->input, SW_LID, !state);
 	input_sync(button->input);
 	return 0;
 }
 
-static void acpi_button_notify(struct acpi_device *device, u32 event)
+static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_button *button = acpi_driver_data(device);
+	struct acpi_button *button = data;
 	struct input_dev *input;
 
+	if (!button || !button->device)
+		return;
+
 	switch (event) {
-	case ACPI_FIXED_HARDWARE_EVENT:
-		event = ACPI_BUTTON_NOTIFY_STATUS;
-		/* fall through */
 	case ACPI_BUTTON_NOTIFY_STATUS:
 		input = button->input;
 		if (button->type == ACPI_BUTTON_TYPE_LID) {
-			acpi_lid_send_state(device);
+			acpi_lid_send_state(button);
 		} else {
 			int keycode = test_bit(KEY_SLEEP, input->keybit) ?
 						KEY_SLEEP : KEY_POWER;
@@ -268,35 +286,102 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
 			input_sync(input);
 		}
 
-		acpi_bus_generate_proc_event(device, event, ++button->pushed);
+		acpi_bus_generate_proc_event(button->device, event,
+					++button->pushed);
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
+
+	return;
 }
 
-static int acpi_button_resume(struct acpi_device *device)
+static acpi_status acpi_button_notify_fixed(void *data)
 {
-	struct acpi_button *button = acpi_driver_data(device);
+	struct acpi_button *button = data;
 
-	if (button->type == ACPI_BUTTON_TYPE_LID)
-		return acpi_lid_send_state(device);
+	if (!button)
+		return AE_BAD_PARAMETER;
+
+	acpi_button_notify(button->device->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
+
+	return AE_OK;
+}
+
+static int acpi_button_install_notify_handlers(struct acpi_button *button)
+{
+	acpi_status status;
+
+	switch (button->type) {
+	case ACPI_BUTTON_TYPE_POWERF:
+		status =
+		    acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
+						     acpi_button_notify_fixed,
+						     button);
+		break;
+	case ACPI_BUTTON_TYPE_SLEEPF:
+		status =
+		    acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
+						     acpi_button_notify_fixed,
+						     button);
+		break;
+	default:
+		status = acpi_install_notify_handler(button->device->handle,
+						     ACPI_DEVICE_NOTIFY,
+						     acpi_button_notify,
+						     button);
+		break;
+	}
+
+	return ACPI_FAILURE(status) ? -ENODEV : 0;
+}
+
+static int acpi_button_resume(struct acpi_device *device)
+{
+	struct acpi_button *button;
+	if (!device)
+		return -EINVAL;
+	button = acpi_driver_data(device);
+	if (button && button->type == ACPI_BUTTON_TYPE_LID)
+		return acpi_lid_send_state(button);
 	return 0;
 }
 
+static void acpi_button_remove_notify_handlers(struct acpi_button *button)
+{
+	switch (button->type) {
+	case ACPI_BUTTON_TYPE_POWERF:
+		acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
+						acpi_button_notify_fixed);
+		break;
+	case ACPI_BUTTON_TYPE_SLEEPF:
+		acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
+						acpi_button_notify_fixed);
+		break;
+	default:
+		acpi_remove_notify_handler(button->device->handle,
+					   ACPI_DEVICE_NOTIFY,
+					   acpi_button_notify);
+		break;
+	}
+}
+
 static int acpi_button_add(struct acpi_device *device)
 {
+	int error;
 	struct acpi_button *button;
 	struct input_dev *input;
-	char *hid, *name, *class;
-	int error;
+
+	if (!device)
+		return -EINVAL;
 
 	button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
 	if (!button)
 		return -ENOMEM;
 
+	button->device = device;
 	device->driver_data = button;
 
 	button->input = input = input_allocate_device();
@@ -305,29 +390,40 @@ static int acpi_button_add(struct acpi_device *device)
 		goto err_free_button;
 	}
 
-	hid = acpi_device_hid(device);
-	name = acpi_device_name(device);
-	class = acpi_device_class(device);
-
-	if (!strcmp(hid, ACPI_BUTTON_HID_POWER) ||
-	    !strcmp(hid, ACPI_BUTTON_HID_POWERF)) {
+	/*
+	 * Determine the button type (via hid), as fixed-feature buttons
+	 * need to be handled a bit differently than generic-space.
+	 */
+	if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
 		button->type = ACPI_BUTTON_TYPE_POWER;
-		strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER);
-		sprintf(class, "%s/%s",
+		strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
-	} else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) ||
-		   !strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) {
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
+		button->type = ACPI_BUTTON_TYPE_POWERF;
+		strcpy(acpi_device_name(device),
+		       ACPI_BUTTON_DEVICE_NAME_POWERF);
+		sprintf(acpi_device_class(device), "%s/%s",
+			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
 		button->type = ACPI_BUTTON_TYPE_SLEEP;
-		strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP);
-		sprintf(class, "%s/%s",
+		strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
+		sprintf(acpi_device_class(device), "%s/%s",
+			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
+		button->type = ACPI_BUTTON_TYPE_SLEEPF;
+		strcpy(acpi_device_name(device),
+		       ACPI_BUTTON_DEVICE_NAME_SLEEPF);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
-	} else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) {
+	} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
 		button->type = ACPI_BUTTON_TYPE_LID;
-		strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID);
-		sprintf(class, "%s/%s",
+		strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
+		sprintf(acpi_device_class(device), "%s/%s",
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
 	} else {
-		printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid);
+		printk(KERN_ERR PREFIX "Unsupported hid [%s]\n",
+			    acpi_device_hid(device));
 		error = -ENODEV;
 		goto err_free_input;
 	}
@@ -336,9 +432,14 @@ static int acpi_button_add(struct acpi_device *device)
 	if (error)
 		goto err_free_input;
 
-	snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid);
+	error = acpi_button_install_notify_handlers(button);
+	if (error)
+		goto err_remove_fs;
 
-	input->name = name;
+	snprintf(button->phys, sizeof(button->phys),
+		 "%s/button/input0", acpi_device_hid(device));
+
+	input->name = acpi_device_name(device);
 	input->phys = button->phys;
 	input->id.bustype = BUS_HOST;
 	input->id.product = button->type;
@@ -346,11 +447,13 @@ static int acpi_button_add(struct acpi_device *device)
 
 	switch (button->type) {
 	case ACPI_BUTTON_TYPE_POWER:
+	case ACPI_BUTTON_TYPE_POWERF:
 		input->evbit[0] = BIT_MASK(EV_KEY);
 		set_bit(KEY_POWER, input->keybit);
 		break;
 
 	case ACPI_BUTTON_TYPE_SLEEP:
+	case ACPI_BUTTON_TYPE_SLEEPF:
 		input->evbit[0] = BIT_MASK(EV_KEY);
 		set_bit(KEY_SLEEP, input->keybit);
 		break;
@@ -363,9 +466,9 @@ static int acpi_button_add(struct acpi_device *device)
 
 	error = input_register_device(input);
 	if (error)
-		goto err_remove_fs;
+		goto err_remove_handlers;
 	if (button->type == ACPI_BUTTON_TYPE_LID)
-		acpi_lid_send_state(device);
+		acpi_lid_send_state(button);
 
 	if (device->wakeup.flags.valid) {
 		/* Button's GPE is run-wake GPE */
@@ -377,9 +480,13 @@ static int acpi_button_add(struct acpi_device *device)
 		device->wakeup.state.enabled = 1;
 	}
 
-	printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
+	printk(KERN_INFO PREFIX "%s [%s]\n",
+	       acpi_device_name(device), acpi_device_bid(device));
+
 	return 0;
 
+ err_remove_handlers:
+	acpi_button_remove_notify_handlers(button);
  err_remove_fs:
 	acpi_button_remove_fs(device);
  err_free_input:
@@ -391,11 +498,18 @@ static int acpi_button_add(struct acpi_device *device)
 
 static int acpi_button_remove(struct acpi_device *device, int type)
 {
-	struct acpi_button *button = acpi_driver_data(device);
+	struct acpi_button *button;
+
+	if (!device || !acpi_driver_data(device))
+		return -EINVAL;
 
+	button = acpi_driver_data(device);
+
+	acpi_button_remove_notify_handlers(button);
 	acpi_button_remove_fs(device);
 	input_unregister_device(button->input);
 	kfree(button);
+
 	return 0;
 }
 
@@ -406,7 +520,6 @@ static int __init acpi_button_init(void)
 	acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
 	if (!acpi_button_dir)
 		return -ENODEV;
-
 	result = acpi_bus_register_driver(&acpi_button_driver);
 	if (result < 0) {
 		remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);

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

* Re: 2.6.30 oops with acpi/button
  2009-07-09  8:29 2.6.30 oops with acpi/button Stephen J. Gowdy
@ 2009-07-10  2:57   ` ykzhao
  2009-07-10  2:57   ` ykzhao
  1 sibling, 0 replies; 4+ messages in thread
From: ykzhao @ 2009-07-10  2:57 UTC (permalink / raw)
  To: Stephen J. Gowdy; +Cc: linux-kernel, linux-acpi

On Thu, 2009-07-09 at 16:29 +0800, Stephen J. Gowdy wrote:
> Hi Len & Bjorn,
>  	I've not had time to go back to it but with 2.6.30 I get an oops 
> when I close the lid on my HP Compaq 6910p laptop. I see you removed some 
> null pointer checks.. perhaps tha tis why? Here is the oops extracted from 
> my log file. If you want me to test a patch let me know. I'm about to try 
> 2.6.30.1 but I don't see anything in the ChangeLog that is likely to make 
> a difference.
>  	I've gone back to 2.6.29.4 where it is fine. I tried unloading the 
> "button" module first but in that case my laptop locked up without an 
> oops. No flashing num/caps lock or anything, just froze when I close the 
> lid. The version of button.c from 2.6.29.4  doesn't compile in the 2.6.30 
> tree;
> 
> drivers/acpi/button.c: In function ‘acpi_button_add_fs’:
> drivers/acpi/button.c:203: error: ‘struct proc_dir_entry’ has no member 
> named ‘owner’
> drivers/acpi/button.c:208: error: ‘struct proc_dir_entry’ has no member 
> named ‘owner’
> drivers/acpi/button.c: In function ‘acpi_button_init’:
> drivers/acpi/button.c:525: error: ‘struct proc_dir_entry’ has no member 
> named ‘owner’
The proc_dir_entry::owner member is removed after the following commit
is shipped:
    commit 99b76233803beab302123d243eea9e41149804f3
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Wed Mar 25 22:48:06 2009 +0300

    proc 2/2: remove struct proc_dir_entry::owner

It seems that the owner member is already removed in the button driver.
Why does the above issue still exist?

Will you please try the latest kernel and see whether the issue still
exists?

For the LID oops issue on the HP6910P, will you please enable
"CONFIG_DRM_I915_KMS" in kernel configuration and see whether the issue
still exists? This had better be done in the latest kernel(for example:
2.6.31-rc1/2)

thanks.
   Yakui

> 
>  	Any ideas?
> 
> 
>  						regards,
> 
>  						Stephen.
> 
> -- 
>   /------------------------------------+-------------------------\
> |Stephen J. Gowdy                     | CERN       Office: 8-1-11|
> |http://cern.ch/gowdy/                | CH-1211 Geneva 23        |
> |                                     | Switzerland              |
> |EMail: gowdy@cern.ch                 | Tel: +41 76 487 2215     |
>   \------------------------------------+-------------------------/

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

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

* Re: 2.6.30 oops with acpi/button
@ 2009-07-10  2:57   ` ykzhao
  0 siblings, 0 replies; 4+ messages in thread
From: ykzhao @ 2009-07-10  2:57 UTC (permalink / raw)
  To: Stephen J. Gowdy; +Cc: linux-kernel, linux-acpi

On Thu, 2009-07-09 at 16:29 +0800, Stephen J. Gowdy wrote:
> Hi Len & Bjorn,
>  	I've not had time to go back to it but with 2.6.30 I get an oops 
> when I close the lid on my HP Compaq 6910p laptop. I see you removed some 
> null pointer checks.. perhaps tha tis why? Here is the oops extracted from 
> my log file. If you want me to test a patch let me know. I'm about to try 
> 2.6.30.1 but I don't see anything in the ChangeLog that is likely to make 
> a difference.
>  	I've gone back to 2.6.29.4 where it is fine. I tried unloading the 
> "button" module first but in that case my laptop locked up without an 
> oops. No flashing num/caps lock or anything, just froze when I close the 
> lid. The version of button.c from 2.6.29.4  doesn't compile in the 2.6.30 
> tree;
> 
> drivers/acpi/button.c: In function ‘acpi_button_add_fs’:
> drivers/acpi/button.c:203: error: ‘struct proc_dir_entry’ has no member 
> named ‘owner’
> drivers/acpi/button.c:208: error: ‘struct proc_dir_entry’ has no member 
> named ‘owner’
> drivers/acpi/button.c: In function ‘acpi_button_init’:
> drivers/acpi/button.c:525: error: ‘struct proc_dir_entry’ has no member 
> named ‘owner’
The proc_dir_entry::owner member is removed after the following commit
is shipped:
    commit 99b76233803beab302123d243eea9e41149804f3
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Wed Mar 25 22:48:06 2009 +0300

    proc 2/2: remove struct proc_dir_entry::owner

It seems that the owner member is already removed in the button driver.
Why does the above issue still exist?

Will you please try the latest kernel and see whether the issue still
exists?

For the LID oops issue on the HP6910P, will you please enable
"CONFIG_DRM_I915_KMS" in kernel configuration and see whether the issue
still exists? This had better be done in the latest kernel(for example:
2.6.31-rc1/2)

thanks.
   Yakui

> 
>  	Any ideas?
> 
> 
>  						regards,
> 
>  						Stephen.
> 
> -- 
>   /------------------------------------+-------------------------\
> |Stephen J. Gowdy                     | CERN       Office: 8-1-11|
> |http://cern.ch/gowdy/                | CH-1211 Geneva 23        |
> |                                     | Switzerland              |
> |EMail: gowdy@cern.ch                 | Tel: +41 76 487 2215     |
>   \------------------------------------+-------------------------/


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

end of thread, other threads:[~2009-07-10  2:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09  8:29 2.6.30 oops with acpi/button Stephen J. Gowdy
2009-07-09 20:25 ` [Bug 13751] " Bjorn Helgaas
2009-07-10  2:57 ` ykzhao
2009-07-10  2:57   ` ykzhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.