From e84a02ba0b33a97a8486f3248fd45f50b1a1c014 Mon Sep 17 00:00:00 2001 From: Mattia Dongili Date: Sat, 4 Aug 2007 00:22:30 +0900 Subject: 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(+) (limited to 'drivers') diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 14ee06c8f12..9a803e13c30 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); -- cgit v1.2.3 From 11604ecf6fb9c2ab0152fbddb7ea2724438ef76e Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 4 Aug 2007 00:22:31 +0900 Subject: 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(-) (limited to 'drivers') diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 9a803e13c30..91da6880ae9 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, -- cgit v1.2.3 From f7b88ccb63188e775fe02e746c39ed177741cfc7 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Sat, 4 Aug 2007 00:22:32 +0900 Subject: 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(-) (limited to 'drivers') diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 73037a4d3c5..aeec67e2726 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, -- cgit v1.2.3 From ac36393de6034be7266264a435360e7628849005 Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Fri, 27 Jul 2007 17:04:40 -0300 Subject: 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(-) (limited to 'drivers') diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index fa80f355e52..f6cd34a3dba 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 88af089d649..eee8809a50d 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 { -- cgit v1.2.3 From de47b69c7b7be46b0848b2c4f8e23c478cd68690 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sun, 29 Jul 2007 00:45:59 +0200 Subject: 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(+) (limited to 'drivers') diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 9c4bd220c44..86fd142f4bf 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; } } -- cgit v1.2.3 From 5f70bf7510e5e51b0bac32b1470c92e9332452a4 Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Sun, 5 Aug 2007 15:20:45 -0300 Subject: 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 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index aaaa61ea421..518d5d33546 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. - - 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 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. + + 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 -- cgit v1.2.3