aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/asus-laptop.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2009-06-16 15:28:46 -0400
committerLen Brown <len.brown@intel.com>2009-06-24 01:30:47 -0400
commit116bf2e010a0600371aede450351973821dfd9e2 (patch)
treec782aa006e2008a7e045cd39d1e91c7de75d41df /drivers/platform/x86/asus-laptop.c
parentcede2cb6ee9b0ddaa3dbc9939418ff177a831600 (diff)
asus-laptop: platform dev as parent for led and backlight
Makes asus-laptop platform device the parent device of backlight and led classes. With this patch, leds and backlight are also available in /sys/devices/platform/asus-laptop/ like thinkpad_acpi. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/asus-laptop.c')
-rw-r--r--drivers/platform/x86/asus-laptop.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index eaffe732653..faa87d3e398 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1321,7 +1321,6 @@ out:
1321 1321
1322static int __init asus_laptop_init(void) 1322static int __init asus_laptop_init(void)
1323{ 1323{
1324 struct device *dev;
1325 int result; 1324 int result;
1326 1325
1327 if (acpi_disabled) 1326 if (acpi_disabled)
@@ -1343,24 +1342,10 @@ static int __init asus_laptop_init(void)
1343 return -ENODEV; 1342 return -ENODEV;
1344 } 1343 }
1345 1344
1346 dev = acpi_get_physical_device(hotk->device->handle);
1347
1348 if (!acpi_video_backlight_support()) {
1349 result = asus_backlight_init(dev);
1350 if (result)
1351 goto fail_backlight;
1352 } else
1353 printk(ASUS_INFO "Brightness ignored, must be controlled by "
1354 "ACPI video driver\n");
1355
1356 result = asus_input_init(); 1345 result = asus_input_init();
1357 if (result) 1346 if (result)
1358 goto fail_input; 1347 goto fail_input;
1359 1348
1360 result = asus_led_init(dev);
1361 if (result)
1362 goto fail_led;
1363
1364 /* Register platform stuff */ 1349 /* Register platform stuff */
1365 result = platform_driver_register(&asuspf_driver); 1350 result = platform_driver_register(&asuspf_driver);
1366 if (result) 1351 if (result)
@@ -1381,8 +1366,27 @@ static int __init asus_laptop_init(void)
1381 if (result) 1366 if (result)
1382 goto fail_sysfs; 1367 goto fail_sysfs;
1383 1368
1369 result = asus_led_init(&asuspf_device->dev);
1370 if (result)
1371 goto fail_led;
1372
1373 if (!acpi_video_backlight_support()) {
1374 result = asus_backlight_init(&asuspf_device->dev);
1375 if (result)
1376 goto fail_backlight;
1377 } else
1378 printk(ASUS_INFO "Brightness ignored, must be controlled by "
1379 "ACPI video driver\n");
1380
1384 return 0; 1381 return 0;
1385 1382
1383fail_backlight:
1384 asus_led_exit();
1385
1386fail_led:
1387 sysfs_remove_group(&asuspf_device->dev.kobj,
1388 &asuspf_attribute_group);
1389
1386fail_sysfs: 1390fail_sysfs:
1387 platform_device_del(asuspf_device); 1391 platform_device_del(asuspf_device);
1388 1392
@@ -1393,15 +1397,9 @@ fail_platform_device1:
1393 platform_driver_unregister(&asuspf_driver); 1397 platform_driver_unregister(&asuspf_driver);
1394 1398
1395fail_platform_driver: 1399fail_platform_driver:
1396 asus_led_exit();
1397
1398fail_led:
1399 asus_input_exit(); 1400 asus_input_exit();
1400 1401
1401fail_input: 1402fail_input:
1402 asus_backlight_exit();
1403
1404fail_backlight:
1405 1403
1406 return result; 1404 return result;
1407} 1405}