diff options
author | Corentin Chary <corentincj@iksaif.net> | 2010-08-24 03:30:44 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2010-10-21 09:36:43 -0400 |
commit | 71e687dc499819caa0d6ee0f80dcda1d5c24b5b2 (patch) | |
tree | 33b70e066417a74e90b093816ae7796b5e0a3eb7 /drivers/platform/x86 | |
parent | 384a7cd9ace5b37a17ffea436f09170cdf671c88 (diff) |
platform-x86: sync eeepc-laptop and asus-laptop
Makes asus-laptop and eeepc-laptop _init/_exit functions
looks exactly the same as they do the same thing.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 54 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 16 |
2 files changed, 36 insertions, 34 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index b756e07d41b4..ffab9b45f0c8 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -639,29 +639,29 @@ static int asus_backlight_notify(struct asus_laptop *asus) | |||
639 | static int asus_backlight_init(struct asus_laptop *asus) | 639 | static int asus_backlight_init(struct asus_laptop *asus) |
640 | { | 640 | { |
641 | struct backlight_device *bd; | 641 | struct backlight_device *bd; |
642 | struct device *dev = &asus->platform_device->dev; | ||
643 | struct backlight_properties props; | 642 | struct backlight_properties props; |
644 | 643 | ||
645 | if (!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) && | 644 | if (acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) || |
646 | !acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) && | 645 | acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) || |
647 | lcd_switch_handle) { | 646 | !lcd_switch_handle) |
648 | memset(&props, 0, sizeof(struct backlight_properties)); | 647 | return 0; |
649 | props.max_brightness = 15; | ||
650 | |||
651 | bd = backlight_device_register(ASUS_LAPTOP_FILE, dev, | ||
652 | asus, &asusbl_ops, &props); | ||
653 | if (IS_ERR(bd)) { | ||
654 | pr_err("Could not register asus backlight device\n"); | ||
655 | asus->backlight_device = NULL; | ||
656 | return PTR_ERR(bd); | ||
657 | } | ||
658 | 648 | ||
659 | asus->backlight_device = bd; | 649 | memset(&props, 0, sizeof(struct backlight_properties)); |
650 | props.max_brightness = 15; | ||
660 | 651 | ||
661 | bd->props.power = FB_BLANK_UNBLANK; | 652 | bd = backlight_device_register(ASUS_LAPTOP_FILE, |
662 | bd->props.brightness = asus_read_brightness(bd); | 653 | &asus->platform_device->dev, asus, |
663 | backlight_update_status(bd); | 654 | &asusbl_ops, &props); |
655 | if (IS_ERR(bd)) { | ||
656 | pr_err("Could not register asus backlight device\n"); | ||
657 | asus->backlight_device = NULL; | ||
658 | return PTR_ERR(bd); | ||
664 | } | 659 | } |
660 | |||
661 | asus->backlight_device = bd; | ||
662 | bd->props.brightness = asus_read_brightness(bd); | ||
663 | bd->props.power = FB_BLANK_UNBLANK; | ||
664 | backlight_update_status(bd); | ||
665 | return 0; | 665 | return 0; |
666 | } | 666 | } |
667 | 667 | ||
@@ -1130,7 +1130,6 @@ static int asus_input_init(struct asus_laptop *asus) | |||
1130 | input->phys = ASUS_LAPTOP_FILE "/input0"; | 1130 | input->phys = ASUS_LAPTOP_FILE "/input0"; |
1131 | input->id.bustype = BUS_HOST; | 1131 | input->id.bustype = BUS_HOST; |
1132 | input->dev.parent = &asus->platform_device->dev; | 1132 | input->dev.parent = &asus->platform_device->dev; |
1133 | input_set_drvdata(input, asus); | ||
1134 | 1133 | ||
1135 | error = sparse_keymap_setup(input, asus_keymap, NULL); | 1134 | error = sparse_keymap_setup(input, asus_keymap, NULL); |
1136 | if (error) { | 1135 | if (error) { |
@@ -1159,6 +1158,7 @@ static void asus_input_exit(struct asus_laptop *asus) | |||
1159 | sparse_keymap_free(asus->inputdev); | 1158 | sparse_keymap_free(asus->inputdev); |
1160 | input_unregister_device(asus->inputdev); | 1159 | input_unregister_device(asus->inputdev); |
1161 | } | 1160 | } |
1161 | asus->inputdev = NULL; | ||
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | /* | 1164 | /* |
@@ -1278,19 +1278,19 @@ static int asus_sysfs_init(struct asus_laptop *asus) | |||
1278 | 1278 | ||
1279 | static int asus_platform_init(struct asus_laptop *asus) | 1279 | static int asus_platform_init(struct asus_laptop *asus) |
1280 | { | 1280 | { |
1281 | int err; | 1281 | int result; |
1282 | 1282 | ||
1283 | asus->platform_device = platform_device_alloc(ASUS_LAPTOP_FILE, -1); | 1283 | asus->platform_device = platform_device_alloc(ASUS_LAPTOP_FILE, -1); |
1284 | if (!asus->platform_device) | 1284 | if (!asus->platform_device) |
1285 | return -ENOMEM; | 1285 | return -ENOMEM; |
1286 | platform_set_drvdata(asus->platform_device, asus); | 1286 | platform_set_drvdata(asus->platform_device, asus); |
1287 | 1287 | ||
1288 | err = platform_device_add(asus->platform_device); | 1288 | result = platform_device_add(asus->platform_device); |
1289 | if (err) | 1289 | if (result) |
1290 | goto fail_platform_device; | 1290 | goto fail_platform_device; |
1291 | 1291 | ||
1292 | err = asus_sysfs_init(asus); | 1292 | result = asus_sysfs_init(asus); |
1293 | if (err) | 1293 | if (result) |
1294 | goto fail_sysfs; | 1294 | goto fail_sysfs; |
1295 | return 0; | 1295 | return 0; |
1296 | 1296 | ||
@@ -1299,7 +1299,7 @@ fail_sysfs: | |||
1299 | platform_device_del(asus->platform_device); | 1299 | platform_device_del(asus->platform_device); |
1300 | fail_platform_device: | 1300 | fail_platform_device: |
1301 | platform_device_put(asus->platform_device); | 1301 | platform_device_put(asus->platform_device); |
1302 | return err; | 1302 | return result; |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | static void asus_platform_exit(struct asus_laptop *asus) | 1305 | static void asus_platform_exit(struct asus_laptop *asus) |
@@ -1428,8 +1428,6 @@ static int asus_laptop_get_info(struct asus_laptop *asus) | |||
1428 | return AE_OK; | 1428 | return AE_OK; |
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | static bool asus_device_present; | ||
1432 | |||
1433 | static int __devinit asus_acpi_init(struct asus_laptop *asus) | 1431 | static int __devinit asus_acpi_init(struct asus_laptop *asus) |
1434 | { | 1432 | { |
1435 | int result = 0; | 1433 | int result = 0; |
@@ -1474,6 +1472,8 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus) | |||
1474 | return result; | 1472 | return result; |
1475 | } | 1473 | } |
1476 | 1474 | ||
1475 | static bool asus_device_present; | ||
1476 | |||
1477 | static int __devinit asus_acpi_add(struct acpi_device *device) | 1477 | static int __devinit asus_acpi_add(struct acpi_device *device) |
1478 | { | 1478 | { |
1479 | struct asus_laptop *asus; | 1479 | struct asus_laptop *asus; |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 6b8e06206c46..b2edfdcdcb84 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -165,6 +165,7 @@ struct eeepc_laptop { | |||
165 | u16 event_count[128]; /* count for each event */ | 165 | u16 event_count[128]; /* count for each event */ |
166 | 166 | ||
167 | struct platform_device *platform_device; | 167 | struct platform_device *platform_device; |
168 | struct acpi_device *device; /* the device we are in */ | ||
168 | struct device *hwmon_device; | 169 | struct device *hwmon_device; |
169 | struct backlight_device *backlight_device; | 170 | struct backlight_device *backlight_device; |
170 | 171 | ||
@@ -1193,9 +1194,9 @@ static int eeepc_input_init(struct eeepc_laptop *eeepc) | |||
1193 | eeepc->inputdev = input; | 1194 | eeepc->inputdev = input; |
1194 | return 0; | 1195 | return 0; |
1195 | 1196 | ||
1196 | err_free_keymap: | 1197 | err_free_keymap: |
1197 | sparse_keymap_free(input); | 1198 | sparse_keymap_free(input); |
1198 | err_free_dev: | 1199 | err_free_dev: |
1199 | input_free_device(input); | 1200 | input_free_device(input); |
1200 | return error; | 1201 | return error; |
1201 | } | 1202 | } |
@@ -1206,6 +1207,7 @@ static void eeepc_input_exit(struct eeepc_laptop *eeepc) | |||
1206 | sparse_keymap_free(eeepc->inputdev); | 1207 | sparse_keymap_free(eeepc->inputdev); |
1207 | input_unregister_device(eeepc->inputdev); | 1208 | input_unregister_device(eeepc->inputdev); |
1208 | } | 1209 | } |
1210 | eeepc->inputdev = NULL; | ||
1209 | } | 1211 | } |
1210 | 1212 | ||
1211 | /* | 1213 | /* |
@@ -1326,16 +1328,15 @@ static void cmsg_quirks(struct eeepc_laptop *eeepc) | |||
1326 | cmsg_quirk(eeepc, CM_ASL_TPD, "TPD"); | 1328 | cmsg_quirk(eeepc, CM_ASL_TPD, "TPD"); |
1327 | } | 1329 | } |
1328 | 1330 | ||
1329 | static int eeepc_acpi_init(struct eeepc_laptop *eeepc, | 1331 | static int __devinit eeepc_acpi_init(struct eeepc_laptop *eeepc) |
1330 | struct acpi_device *device) | ||
1331 | { | 1332 | { |
1332 | unsigned int init_flags; | 1333 | unsigned int init_flags; |
1333 | int result; | 1334 | int result; |
1334 | 1335 | ||
1335 | result = acpi_bus_get_status(device); | 1336 | result = acpi_bus_get_status(eeepc->device); |
1336 | if (result) | 1337 | if (result) |
1337 | return result; | 1338 | return result; |
1338 | if (!device->status.present) { | 1339 | if (!eeepc->device->status.present) { |
1339 | pr_err("Hotkey device not present, aborting\n"); | 1340 | pr_err("Hotkey device not present, aborting\n"); |
1340 | return -ENODEV; | 1341 | return -ENODEV; |
1341 | } | 1342 | } |
@@ -1384,12 +1385,13 @@ static int __devinit eeepc_acpi_add(struct acpi_device *device) | |||
1384 | strcpy(acpi_device_name(device), EEEPC_ACPI_DEVICE_NAME); | 1385 | strcpy(acpi_device_name(device), EEEPC_ACPI_DEVICE_NAME); |
1385 | strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); | 1386 | strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); |
1386 | device->driver_data = eeepc; | 1387 | device->driver_data = eeepc; |
1388 | eeepc->device = device; | ||
1387 | 1389 | ||
1388 | eeepc->hotplug_disabled = hotplug_disabled; | 1390 | eeepc->hotplug_disabled = hotplug_disabled; |
1389 | 1391 | ||
1390 | eeepc_dmi_check(eeepc); | 1392 | eeepc_dmi_check(eeepc); |
1391 | 1393 | ||
1392 | result = eeepc_acpi_init(eeepc, device); | 1394 | result = eeepc_acpi_init(eeepc); |
1393 | if (result) | 1395 | if (result) |
1394 | goto fail_platform; | 1396 | goto fail_platform; |
1395 | eeepc_enable_camera(eeepc); | 1397 | eeepc_enable_camera(eeepc); |