--- ../../acpi4asus-0.41/driver/asus-laptop.c 2007-05-05 16:57:34.000000000 +0200 +++ ./asus-laptop.c 2007-05-05 17:08:51.000000000 +0200 @@ -3,7 +3,7 @@ * * * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor - * Copyright (C) 2006 Corentin Chary + * Copyright (C) 2006-2007 Corentin Chary * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,8 +35,8 @@ #include -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,19) -#warning "This module does not support 2.6.19" +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20) +#warning "This module does not support 2.6.20" #endif #include @@ -54,7 +54,7 @@ #include #include -#define ASUS_LAPTOP_VERSION "0.41" +#define ASUS_LAPTOP_VERSION "0.42-cvs" #define ASUS_HOTK_NAME "Asus Laptop Support" #define ASUS_HOTK_CLASS "hotkey" @@ -222,11 +222,9 @@ */ static int read_brightness(struct backlight_device *bd); static int update_bl_status(struct backlight_device *bd); -static struct backlight_properties asusbl_data = { - .owner = THIS_MODULE, +static struct backlight_ops asusbl_ops = { .get_brightness = read_brightness, .update_status = update_bl_status, - .max_brightness = 15, }; /* These functions actually update the LED's, and are called from a @@ -238,9 +236,9 @@ #define ASUS_LED(object, ledname) \ static void object##_led_set(struct led_classdev *led_cdev, \ enum led_brightness value); \ + static void object##_led_update(struct work_struct *ignored); \ static int object##_led_wk; \ - static void object##_led_update(struct work_struct *dummy); \ - static DECLARE_WORK(object##_led_work, object##_led_update); \ + static DECLARE_WORK(object##_led_work, object##_led_update); \ static struct led_classdev object##_led = { \ .name = "asus:" ledname, \ .brightness_set = object##_led_set, \ @@ -326,7 +324,7 @@ out = !out & 0x1; break; case GLED_ON: - out += 1; + out = (out & 0x1) + 1; break; case GPS_ON: handle = (out) ? gps_on_handle : gps_off_handle; @@ -349,7 +347,7 @@ object##_led_wk = value; \ queue_work(led_workqueue, &object##_led_work); \ } \ - static void object##_led_update(struct work_struct *dummy) \ + static void object##_led_update(struct work_struct *ignored) \ { \ int value = object##_led_wk; \ write_status(object##_set_handle, value, (mask)); \ @@ -393,13 +391,8 @@ struct backlight_device *bd = asus_backlight_device; if (bd) { - down(&bd->sem); - if (likely(bd->props)) { - bd->props->power = blank; - if (likely(bd->props->update_status)) - bd->props->update_status(bd); - } - up(&bd->sem); + bd->props.power = blank; + backlight_update_status(bd); } } @@ -433,13 +426,13 @@ static int update_bl_status(struct backlight_device *bd) { int rv; - int value = bd->props->brightness; + int value = bd->props.brightness; rv = set_brightness(bd, value); if (rv) return rv; - value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0; + value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0; return set_lcd_state(value); } @@ -850,7 +843,7 @@ static int asus_hotk_get_info(void) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *model = NULL; ulong bsts_result, hwrs_result; char *string = NULL; @@ -864,11 +857,9 @@ * HID), this bit will be moved. A global variable asus_info contains * the DSDT header. */ - status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); + status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info); if (ACPI_FAILURE(status)) printk(ASUS_WARNING "Couldn't get the DSDT table header\n"); - else - asus_info = dsdt.pointer; /* We have to write 0 on init this far for all ASUS models */ if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { @@ -1107,8 +1098,6 @@ sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group); platform_device_unregister(asuspf_device); platform_driver_unregister(&asuspf_driver); - - kfree(asus_info); } static int asus_backlight_init(struct device *dev) @@ -1117,7 +1106,7 @@ if (brightness_set_handle && lcd_switch_handle) { bd = backlight_device_register(ASUS_HOTK_FILE, dev, - NULL, &asusbl_data); + NULL, &asusbl_ops); if (IS_ERR(bd)) { printk(ASUS_ERR @@ -1128,14 +1117,10 @@ asus_backlight_device = bd; - down(&bd->sem); - if (likely(bd->props)) { - bd->props->brightness = read_brightness(NULL); - bd->props->power = FB_BLANK_UNBLANK; - if (likely(bd->props->update_status)) - bd->props->update_status(bd); - } - up(&bd->sem); + bd->props.max_brightness = 15; + bd->props.brightness = read_brightness(NULL); + bd->props.power = FB_BLANK_UNBLANK; + backlight_update_status(bd); } return 0; }