mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
asus-laptop: Lindent
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
8b85735323
commit
8def05fa82
1 changed files with 122 additions and 123 deletions
|
@ -130,8 +130,7 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */
|
|||
|
||||
/* Display */
|
||||
ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP");
|
||||
ASUS_HANDLE(display_get,
|
||||
"\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G
|
||||
ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G
|
||||
M6A M6V VX-1 V6J V6V W3Z */
|
||||
"\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V
|
||||
S5A M5A z33A W1Jc W2V */
|
||||
|
@ -263,7 +262,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val,
|
|||
return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
|
||||
}
|
||||
|
||||
static int read_wireless_status(int mask) {
|
||||
static int read_wireless_status(int mask)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (!wireless_status_handle)
|
||||
|
@ -287,8 +287,7 @@ static int read_status(int mask)
|
|||
return (hotk->status & mask) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void write_status(acpi_handle handle, int out, int mask,
|
||||
int invert)
|
||||
static void write_status(acpi_handle handle, int out, int mask, int invert)
|
||||
{
|
||||
hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask);
|
||||
|
||||
|
@ -333,7 +332,7 @@ static int set_lcd_state(int value)
|
|||
if (lcd == get_lcd_state())
|
||||
return 0;
|
||||
|
||||
if(lcd_switch_handle) {
|
||||
if (lcd_switch_handle) {
|
||||
status = acpi_evaluate_object(lcd_switch_handle,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
|
@ -349,11 +348,11 @@ static void lcd_blank(int blank)
|
|||
{
|
||||
struct backlight_device *bd = asus_backlight_device;
|
||||
|
||||
if(bd) {
|
||||
if (bd) {
|
||||
down(&bd->sem);
|
||||
if(likely(bd->props)) {
|
||||
if (likely(bd->props)) {
|
||||
bd->props->power = blank;
|
||||
if(likely(bd->props->update_status))
|
||||
if (likely(bd->props->update_status))
|
||||
bd->props->update_status(bd);
|
||||
}
|
||||
up(&bd->sem);
|
||||
|
@ -391,7 +390,7 @@ static int update_bl_status(struct backlight_device *bd)
|
|||
int value = bd->props->brightness;
|
||||
|
||||
rv = set_brightness(bd, value);
|
||||
if(rv)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0;
|
||||
|
@ -535,8 +534,9 @@ static ssize_t show_bluetooth(struct device *dev,
|
|||
return sprintf(buf, "%d\n", read_status(BT_ON));
|
||||
}
|
||||
|
||||
static ssize_t store_bluetooth(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t store_bluetooth(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
return store_status(buf, count, bt_switch_handle, BT_ON, 0);
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ static int read_display(void)
|
|||
|
||||
/* In most of the case, we know how to set the display, but sometime
|
||||
we can't read it */
|
||||
if(display_get_handle) {
|
||||
if (display_get_handle) {
|
||||
if (!read_acpi_int(display_get_handle, NULL, &value, NULL))
|
||||
printk(ASUS_WARNING "Error reading display status\n");
|
||||
}
|
||||
|
@ -567,6 +567,7 @@ static int read_display(void)
|
|||
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now, *this* one could be more user-friendly, but so far, no-one has
|
||||
* complained. The significance of bits is the same as in store_disp()
|
||||
|
@ -664,7 +665,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
|
|||
if (event == ATKD_LCD_ON) {
|
||||
write_status(NULL, 1, LCD_ON, 0);
|
||||
lcd_blank(FB_BLANK_UNBLANK);
|
||||
} else if(event == ATKD_LCD_OFF) {
|
||||
} else if (event == ATKD_LCD_OFF) {
|
||||
write_status(NULL, 0, LCD_ON, 0);
|
||||
lcd_blank(FB_BLANK_POWERDOWN);
|
||||
}
|
||||
|
@ -724,7 +725,6 @@ static struct platform_driver asuspf_driver = {
|
|||
|
||||
static struct platform_device *asuspf_device;
|
||||
|
||||
|
||||
static void asus_hotk_add_fs(void)
|
||||
{
|
||||
ASUS_SET_DEVICE_ATTR(infos, 0444, show_infos, NULL);
|
||||
|
@ -738,7 +738,7 @@ static void asus_hotk_add_fs(void)
|
|||
|
||||
if (display_set_handle && display_get_handle)
|
||||
ASUS_SET_DEVICE_ATTR(display, 0644, show_disp, store_disp);
|
||||
else if(display_set_handle)
|
||||
else if (display_set_handle)
|
||||
ASUS_SET_DEVICE_ATTR(display, 0200, NULL, store_disp);
|
||||
|
||||
if (ledd_set_handle)
|
||||
|
@ -750,7 +750,7 @@ static void asus_hotk_add_fs(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int asus_handle_init(char *name, acpi_handle *handle,
|
||||
static int asus_handle_init(char *name, acpi_handle * handle,
|
||||
char **paths, int num_paths)
|
||||
{
|
||||
int i;
|
||||
|
@ -770,7 +770,6 @@ static int asus_handle_init(char *name, acpi_handle *handle,
|
|||
asus_handle_init(#object, &object##_handle, object##_paths, \
|
||||
ARRAY_SIZE(object##_paths))
|
||||
|
||||
|
||||
/*
|
||||
* This function is used to initialize the hotk with right values. In this
|
||||
* method, we can make all the detection we want, and modify the hotk struct
|
||||
|
@ -835,7 +834,7 @@ static int asus_hotk_get_info(void)
|
|||
if (!hotk->name)
|
||||
return -ENOMEM;
|
||||
|
||||
if(*string)
|
||||
if (*string)
|
||||
printk(ASUS_NOTICE " %s model detected\n", string);
|
||||
|
||||
ASUS_HANDLE_INIT(mled_set);
|
||||
|
@ -854,9 +853,9 @@ static int asus_hotk_get_info(void)
|
|||
if (!read_acpi_int(hotk->handle, "HRWS", &hwrs_result, NULL))
|
||||
hwrs_result = WL_HWRS | BT_HWRS;
|
||||
|
||||
if(hwrs_result & WL_HWRS)
|
||||
if (hwrs_result & WL_HWRS)
|
||||
ASUS_HANDLE_INIT(wl_switch);
|
||||
if(hwrs_result & BT_HWRS)
|
||||
if (hwrs_result & BT_HWRS)
|
||||
ASUS_HANDLE_INIT(bt_switch);
|
||||
|
||||
ASUS_HANDLE_INIT(wireless_status);
|
||||
|
@ -871,7 +870,7 @@ static int asus_hotk_get_info(void)
|
|||
|
||||
/* There is a lot of models with "ALSL", but a few get
|
||||
a real light sens, so we need to check it. */
|
||||
if(ASUS_HANDLE_INIT(ls_switch))
|
||||
if (ASUS_HANDLE_INIT(ls_switch))
|
||||
ASUS_HANDLE_INIT(ls_level);
|
||||
|
||||
kfree(model);
|
||||
|
@ -987,7 +986,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
|
|||
|
||||
static void asus_backlight_exit(void)
|
||||
{
|
||||
if(asus_backlight_device)
|
||||
if (asus_backlight_device)
|
||||
backlight_device_unregister(asus_backlight_device);
|
||||
}
|
||||
|
||||
|
@ -1019,14 +1018,14 @@ static void __exit asus_laptop_exit(void)
|
|||
kfree(asus_info);
|
||||
}
|
||||
|
||||
static int asus_backlight_init(struct device * dev)
|
||||
static int asus_backlight_init(struct device *dev)
|
||||
{
|
||||
struct backlight_device *bd;
|
||||
|
||||
if(brightness_set_handle && lcd_switch_handle) {
|
||||
bd = backlight_device_register (ASUS_HOTK_FILE, dev,
|
||||
if (brightness_set_handle && lcd_switch_handle) {
|
||||
bd = backlight_device_register(ASUS_HOTK_FILE, dev,
|
||||
NULL, &asusbl_data);
|
||||
if (IS_ERR (bd)) {
|
||||
if (IS_ERR(bd)) {
|
||||
printk(ASUS_ERR
|
||||
"Could not register asus backlight device\n");
|
||||
asus_backlight_device = NULL;
|
||||
|
@ -1036,10 +1035,10 @@ static int asus_backlight_init(struct device * dev)
|
|||
asus_backlight_device = bd;
|
||||
|
||||
down(&bd->sem);
|
||||
if(likely(bd->props)) {
|
||||
if (likely(bd->props)) {
|
||||
bd->props->brightness = read_brightness(NULL);
|
||||
bd->props->power = FB_BLANK_UNBLANK;
|
||||
if(likely(bd->props->update_status))
|
||||
if (likely(bd->props->update_status))
|
||||
bd->props->update_status(bd);
|
||||
}
|
||||
up(&bd->sem);
|
||||
|
@ -1048,39 +1047,39 @@ static int asus_backlight_init(struct device * dev)
|
|||
}
|
||||
|
||||
static int asus_led_register(acpi_handle handle,
|
||||
struct led_classdev * ldev,
|
||||
struct device * dev)
|
||||
struct led_classdev *ldev, struct device *dev)
|
||||
{
|
||||
if(!handle)
|
||||
if (!handle)
|
||||
return 0;
|
||||
|
||||
return led_classdev_register(dev, ldev);
|
||||
}
|
||||
|
||||
#define ASUS_LED_REGISTER(object, device) \
|
||||
asus_led_register(object##_set_handle, &object##_led, device)
|
||||
|
||||
static int asus_led_init(struct device * dev)
|
||||
static int asus_led_init(struct device *dev)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = ASUS_LED_REGISTER(mled, dev);
|
||||
if(rv)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
rv = ASUS_LED_REGISTER(tled, dev);
|
||||
if(rv)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
rv = ASUS_LED_REGISTER(rled, dev);
|
||||
if(rv)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
rv = ASUS_LED_REGISTER(pled, dev);
|
||||
if(rv)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
led_workqueue = create_singlethread_workqueue("led_workqueue");
|
||||
if(!led_workqueue)
|
||||
if (!led_workqueue)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
|
@ -1118,11 +1117,11 @@ static int __init asus_laptop_init(void)
|
|||
dev = acpi_get_physical_device(hotk->device->handle);
|
||||
|
||||
result = asus_backlight_init(dev);
|
||||
if(result)
|
||||
if (result)
|
||||
goto fail_backlight;
|
||||
|
||||
result = asus_led_init(dev);
|
||||
if(result)
|
||||
if (result)
|
||||
goto fail_led;
|
||||
|
||||
/* Register platform stuff */
|
||||
|
@ -1147,22 +1146,22 @@ static int __init asus_laptop_init(void)
|
|||
|
||||
return 0;
|
||||
|
||||
fail_sysfs:
|
||||
fail_sysfs:
|
||||
platform_device_del(asuspf_device);
|
||||
|
||||
fail_platform_device2:
|
||||
fail_platform_device2:
|
||||
platform_device_put(asuspf_device);
|
||||
|
||||
fail_platform_device1:
|
||||
fail_platform_device1:
|
||||
platform_driver_unregister(&asuspf_driver);
|
||||
|
||||
fail_platform_driver:
|
||||
fail_platform_driver:
|
||||
asus_led_exit();
|
||||
|
||||
fail_led:
|
||||
fail_led:
|
||||
asus_backlight_exit();
|
||||
|
||||
fail_backlight:
|
||||
fail_backlight:
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue