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>

authored by

Corentin Chary and committed by
Len Brown
116bf2e0 cede2cb6

+19 -21
+19 -21
drivers/platform/x86/asus-laptop.c
··· 1321 1322 static int __init asus_laptop_init(void) 1323 { 1324 - struct device *dev; 1325 int result; 1326 1327 if (acpi_disabled) ··· 1342 return -ENODEV; 1343 } 1344 1345 - dev = acpi_get_physical_device(hotk->device->handle); 1346 - 1347 - if (!acpi_video_backlight_support()) { 1348 - result = asus_backlight_init(dev); 1349 - if (result) 1350 - goto fail_backlight; 1351 - } else 1352 - printk(ASUS_INFO "Brightness ignored, must be controlled by " 1353 - "ACPI video driver\n"); 1354 - 1355 result = asus_input_init(); 1356 if (result) 1357 goto fail_input; 1358 - 1359 - result = asus_led_init(dev); 1360 - if (result) 1361 - goto fail_led; 1362 1363 /* Register platform stuff */ 1364 result = platform_driver_register(&asuspf_driver); ··· 1366 if (result) 1367 goto fail_sysfs; 1368 1369 return 0; 1370 1371 fail_sysfs: 1372 platform_device_del(asuspf_device); ··· 1397 platform_driver_unregister(&asuspf_driver); 1398 1399 fail_platform_driver: 1400 - asus_led_exit(); 1401 - 1402 - fail_led: 1403 asus_input_exit(); 1404 1405 fail_input: 1406 - asus_backlight_exit(); 1407 - 1408 - fail_backlight: 1409 1410 return result; 1411 }
··· 1321 1322 static int __init asus_laptop_init(void) 1323 { 1324 int result; 1325 1326 if (acpi_disabled) ··· 1343 return -ENODEV; 1344 } 1345 1346 result = asus_input_init(); 1347 if (result) 1348 goto fail_input; 1349 1350 /* Register platform stuff */ 1351 result = platform_driver_register(&asuspf_driver); ··· 1381 if (result) 1382 goto fail_sysfs; 1383 1384 + result = asus_led_init(&asuspf_device->dev); 1385 + if (result) 1386 + goto fail_led; 1387 + 1388 + if (!acpi_video_backlight_support()) { 1389 + result = asus_backlight_init(&asuspf_device->dev); 1390 + if (result) 1391 + goto fail_backlight; 1392 + } else 1393 + printk(ASUS_INFO "Brightness ignored, must be controlled by " 1394 + "ACPI video driver\n"); 1395 + 1396 return 0; 1397 + 1398 + fail_backlight: 1399 + asus_led_exit(); 1400 + 1401 + fail_led: 1402 + sysfs_remove_group(&asuspf_device->dev.kobj, 1403 + &asuspf_attribute_group); 1404 1405 fail_sysfs: 1406 platform_device_del(asuspf_device); ··· 1393 platform_driver_unregister(&asuspf_driver); 1394 1395 fail_platform_driver: 1396 asus_input_exit(); 1397 1398 fail_input: 1399 1400 return result; 1401 }