From e84a02ba0b33a97a8486f3248fd45f50b1a1c014 Mon Sep 17 00:00:00 2001 From: Mattia Dongili Date: Sat, 4 Aug 2007 00:22:30 +0900 Subject: [PATCH 1/7] sony-laptop: restore the last user requested brightness level on resume. Signed-off-by: Mattia Dongili Signed-off-by: Len Brown --- drivers/misc/sony-laptop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 14ee06c8f127..9a803e13c307 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c @@ -942,6 +942,11 @@ static int sony_nc_resume(struct acpi_device *device) } } + /* set the last requested brightness level */ + if (sony_backlight_device && + !sony_backlight_update_status(sony_backlight_device)) + printk(KERN_WARNING DRV_PFX "unable to restore brightness level"); + /* re-initialize models with specific requirements */ dmi_check_system(sony_nc_ids); From 11604ecf6fb9c2ab0152fbddb7ea2724438ef76e Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 4 Aug 2007 00:22:31 +0900 Subject: [PATCH 2/7] sony-laptop: sony_nc_ids[] can become static. Signed-off-by: Adrian Bunk Signed-off-by: Mattia Dongili Signed-off-by: Len Brown --- drivers/misc/sony-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 9a803e13c307..91da6880ae93 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c @@ -845,7 +845,7 @@ static struct sony_nc_event sony_C_events[] = { }; /* SNC-only model map */ -struct dmi_system_id sony_nc_ids[] = { +static struct dmi_system_id sony_nc_ids[] = { { .ident = "Sony Vaio FE Series", .callback = sony_nc_C_enable, From f7b88ccb63188e775fe02e746c39ed177741cfc7 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Sat, 4 Aug 2007 00:22:32 +0900 Subject: [PATCH 3/7] sonypi: fix ids member of struct acpi_driver ids member of struct acpi_driver is of type struct acpi_device_id, not a character array. Signed-off-by: Eugene Teo Signed-off-by: Mattia Dongili Signed-off-by: Len Brown --- drivers/char/sonypi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 73037a4d3c50..aeec67e27264 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -1147,10 +1147,15 @@ static int sonypi_acpi_remove(struct acpi_device *device, int type) return 0; } +const static struct acpi_device_id sonypi_device_ids[] = { + {"SNY6001", 0}, + {"", 0}, +}; + static struct acpi_driver sonypi_acpi_driver = { .name = "sonypi", .class = "hkey", - .ids = "SNY6001", + .ids = sonypi_device_ids, .ops = { .add = sonypi_acpi_add, .remove = sonypi_acpi_remove, From ac36393de6034be7266264a435360e7628849005 Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Fri, 27 Jul 2007 17:04:40 -0300 Subject: [PATCH 4/7] ACPI: thinkpad-acpi: fix the module init failure path Thomas Renninger reports that if one tries to load thinkpad-acpi in a non-thinkpad, one gets: Call Trace: [] kref_get+0x2f/0x36 [] kobject_get+0x12/0x17 [] get_driver+0x14/0x1a [] driver_remove_file+0x11/0x32 [] :thinkpad_acpi:thinkpad_acpi_module_exit+0xa8/0xfc [] :thinkpad_acpi:thinkpad_acpi_module_init+0x74a/0x776 [] __link_module+0x0/0x25 [] sys_init_module+0x162c/0x178f [] system_call+0x7e/0x83 So, track if the platform driver and its driver attributes were registered, and only deallocate them in that case. This patch is based on Thomas Renninger's patch for the issue. Signed-off-by: Henrique de Moraes Holschuh Acked-by: Thomas Renninger Signed-off-by: Len Brown --- drivers/misc/thinkpad_acpi.c | 10 ++++++++-- drivers/misc/thinkpad_acpi.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index fa80f355e522..f6cd34a3dbac 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -4668,12 +4668,15 @@ static int __init thinkpad_acpi_module_init(void) thinkpad_acpi_module_exit(); return ret; } + tp_features.platform_drv_registered = 1; + ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); if (ret) { printk(IBM_ERR "unable to create sysfs driver attributes\n"); thinkpad_acpi_module_exit(); return ret; } + tp_features.platform_drv_attrs_registered = 1; /* Device initialization */ @@ -4756,8 +4759,11 @@ static void thinkpad_acpi_module_exit(void) if (tpacpi_pdev) platform_device_unregister(tpacpi_pdev); - tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); - platform_driver_unregister(&tpacpi_pdriver); + if (tp_features.platform_drv_attrs_registered) + tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); + + if (tp_features.platform_drv_registered) + platform_driver_unregister(&tpacpi_pdriver); if (proc_dir) remove_proc_entry(IBM_PROC_DIR, acpi_root_dir); diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 88af089d6494..eee8809a50d9 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h @@ -246,6 +246,8 @@ static struct { u16 wan:1; u16 fan_ctrl_status_undef:1; u16 input_device_registered:1; + u16 platform_drv_registered:1; + u16 platform_drv_attrs_registered:1; } tp_features; struct thinkpad_id_data { From de47b69c7b7be46b0848b2c4f8e23c478cd68690 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sun, 29 Jul 2007 00:45:59 +0200 Subject: [PATCH 5/7] asus_acpi: fix possible double free (found by Coverity) Signed-off-by: Jesper Juhl Signed-off-by: Len Brown --- drivers/acpi/asus_acpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 9c4bd220c44f..86fd142f4bf3 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -1192,6 +1192,7 @@ static int asus_hotk_get_info(void) break; default: kfree(model); + model = NULL; break; } } From 5f70bf7510e5e51b0bac32b1470c92e9332452a4 Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Sun, 5 Aug 2007 15:20:45 -0300 Subject: [PATCH 6/7] ACPI: thinkpad-acpi: change thinkpad-acpi input default and kconfig help The current kconfig help text was misleading users. Also, the default for an input-layer-optimized support caused way too many problems without up-to-date userspace in place. So, rework the help text, and change the default to N. Note that distributions are supposed to enable this option as soon as they update HAL to a version that handles the thinkpad-acpi new input layer interface. Signed-off-by: Henrique de Moraes Holschuh Cc: Michael S. Tsirkin Cc: Hugh Dickins Signed-off-by: Len Brown --- drivers/misc/Kconfig | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index aaaa61ea4217..518d5d335464 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -200,14 +200,22 @@ config THINKPAD_ACPI_BAY config THINKPAD_ACPI_INPUT_ENABLED bool "Enable input layer support by default" depends on THINKPAD_ACPI - default y + default n ---help--- - Enables hot key handling over the input layer by default. If unset, - the driver does not enable any hot key handling by default, and also - starts up with a mostly empty keymap. + This option enables thinkpad-acpi hot key handling over the input + layer at driver load time. When it is unset, the driver does not + enable hot key handling by default, and also starts up with a mostly + empty keymap. - If you are not sure, say Y here. Say N to retain the deprecated - behavior of ibm-acpi, and thinkpad-acpi for kernels up to 2.6.21. + This option should be enabled if you have a new enough HAL or other + userspace support that properly handles the thinkpad-acpi event + device. It auto-tunes the hot key support to those reported by the + firmware and enables it automatically. + + If unsure, say N here to retain the old behaviour of ibm-acpi, and + thinkpad-acpi up to kernel 2.6.21: userspace will have to enable and + set up the thinkpad-acpi hot key handling using the sysfs interace + after loading the driver. endif # MISC_DEVICES From 9de1cc4a1724adda84101912e8ba51460f110044 Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Sat, 11 Aug 2007 00:08:33 -0300 Subject: [PATCH 7/7] ACPI: thinkpad-acpi: fix sysfs paths in documentation The documentation used "thinkpad-acpi" to refer to the directories in sysfs, while it should have been using "thinkpad_acpi". Thanks to Hugh Dickins for the error report. I wish I could just call the module and everything else by the proper name with the "-", instead of using these ugly translations to "_". Signed-off-by: Henrique de Moraes Holschuh Cc: Hugh Dickins Signed-off-by: Len Brown --- Documentation/thinkpad-acpi.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index 6711fbcf4080..eb2f5986e1eb 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/thinkpad-acpi.txt @@ -105,10 +105,10 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver as a driver attribute (see below). Sysfs driver attributes are on the driver's sysfs attribute space, -for 2.6.20 this is /sys/bus/platform/drivers/thinkpad-acpi/. +for 2.6.20 this is /sys/bus/platform/drivers/thinkpad_acpi/. Sysfs device attributes are on the driver's sysfs attribute space, -for 2.6.20 this is /sys/devices/platform/thinkpad-acpi/. +for 2.6.20 this is /sys/devices/platform/thinkpad_acpi/. Driver version --------------