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

Commit c33f4c04 authored by Michał Kępień's avatar Michał Kępień Committed by Darren Hart (VMware)
Browse files

platform/x86: fujitsu-laptop: only register platform device if FUJ02E3 is present



The platform device registered by fujitsu-laptop is registered
unconditionally while sysfs attributes attached to it depend on the
FUJ02E3 ACPI device being present.  Fix this by moving platform device
creation and removal to acpi_fujitsu_laptop_add() and
acpi_fujitsu_laptop_remove(), respectively.

Signed-off-by: default avatarMichał Kępień <kernel@kempniu.pl>
Tested-by: default avatarJonathan Woithe <jwoithe@just42.net>
Reviewed-by: default avatarJonathan Woithe <jwoithe@just42.net>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent d811b511
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -903,6 +903,10 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)
			fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK;
	}

	error = fujitsu_laptop_platform_add();
	if (error)
		goto err_unregister_input_dev;

#if IS_ENABLED(CONFIG_LEDS_CLASS)
	if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
		result = led_classdev_register(&fujitsu_bl->pf_device->dev,
@@ -994,6 +998,8 @@ static int acpi_fujitsu_laptop_remove(struct acpi_device *device)
		led_classdev_unregister(&eco_led);
#endif

	fujitsu_laptop_platform_remove();

	input_unregister_device(input);

	kfifo_free(&fujitsu_laptop->fifo);
@@ -1180,13 +1186,9 @@ static int __init fujitsu_init(void)

	/* Register platform stuff */

	ret = fujitsu_laptop_platform_add();
	if (ret)
		goto err_unregister_acpi;

	ret = platform_driver_register(&fujitsu_pf_driver);
	if (ret)
		goto err_remove_platform_device;
		goto err_unregister_acpi;

	/* Register laptop driver */

@@ -1208,8 +1210,6 @@ static int __init fujitsu_init(void)
	kfree(fujitsu_laptop);
err_unregister_platform_driver:
	platform_driver_unregister(&fujitsu_pf_driver);
err_remove_platform_device:
	fujitsu_laptop_platform_remove();
err_unregister_acpi:
	acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
err_free_fujitsu_bl:
@@ -1226,8 +1226,6 @@ static void __exit fujitsu_cleanup(void)

	platform_driver_unregister(&fujitsu_pf_driver);

	fujitsu_laptop_platform_remove();

	acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);

	kfree(fujitsu_bl);