Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 116bf2e0 authored by Corentin Chary's avatar Corentin Chary Committed by Len Brown
Browse files

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: default avatarCorentin Chary <corentincj@iksaif.net>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent cede2cb6
Loading
Loading
Loading
Loading
+19 −21
Original line number Original line Diff line number Diff line
@@ -1321,7 +1321,6 @@ static int asus_led_init(struct device *dev)


static int __init asus_laptop_init(void)
static int __init asus_laptop_init(void)
{
{
	struct device *dev;
	int result;
	int result;


	if (acpi_disabled)
	if (acpi_disabled)
@@ -1343,24 +1342,10 @@ static int __init asus_laptop_init(void)
		return -ENODEV;
		return -ENODEV;
	}
	}


	dev = acpi_get_physical_device(hotk->device->handle);

	if (!acpi_video_backlight_support()) {
		result = asus_backlight_init(dev);
		if (result)
			goto fail_backlight;
	} else
		printk(ASUS_INFO "Brightness ignored, must be controlled by "
		       "ACPI video driver\n");

	result = asus_input_init();
	result = asus_input_init();
	if (result)
	if (result)
		goto fail_input;
		goto fail_input;


	result = asus_led_init(dev);
	if (result)
		goto fail_led;

	/* Register platform stuff */
	/* Register platform stuff */
	result = platform_driver_register(&asuspf_driver);
	result = platform_driver_register(&asuspf_driver);
	if (result)
	if (result)
@@ -1381,8 +1366,27 @@ static int __init asus_laptop_init(void)
	if (result)
	if (result)
		goto fail_sysfs;
		goto fail_sysfs;


	result = asus_led_init(&asuspf_device->dev);
	if (result)
		goto fail_led;

	if (!acpi_video_backlight_support()) {
		result = asus_backlight_init(&asuspf_device->dev);
		if (result)
			goto fail_backlight;
	} else
		printk(ASUS_INFO "Brightness ignored, must be controlled by "
		       "ACPI video driver\n");

	return 0;
	return 0;


fail_backlight:
       asus_led_exit();

fail_led:
       sysfs_remove_group(&asuspf_device->dev.kobj,
			  &asuspf_attribute_group);

fail_sysfs:
fail_sysfs:
	platform_device_del(asuspf_device);
	platform_device_del(asuspf_device);


@@ -1393,15 +1397,9 @@ static int __init asus_laptop_init(void)
	platform_driver_unregister(&asuspf_driver);
	platform_driver_unregister(&asuspf_driver);


fail_platform_driver:
fail_platform_driver:
	asus_led_exit();

fail_led:
	asus_input_exit();
	asus_input_exit();


fail_input:
fail_input:
	asus_backlight_exit();

fail_backlight:


	return result;
	return result;
}
}