Unverified Commit 4f52c972 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Ilpo Järvinen
Browse files

platform/x86: asus-wireless: Register ACPI notify handler directly



To facilitate subsequent conversion of the driver to a platform one,
make it install an ACPI notify handler directly instead of using
a .notify() callback in struct acpi_driver.

No intentional functional impact.

Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarDenis Benato <denis.benato@linux.dev>
Link: https://patch.msgid.link/1949745.tdWV9SEqCh@rafael.j.wysocki


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent ba19eb10
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -108,9 +108,10 @@ static void led_state_set(struct led_classdev *led, enum led_brightness value)
	queue_work(data->wq, &data->led_work);
}

static void asus_wireless_notify(struct acpi_device *adev, u32 event)
static void asus_wireless_notify(acpi_handle handle, u32 event, void *context)
{
	struct asus_wireless_data *data = acpi_driver_data(adev);
	struct asus_wireless_data *data = context;
	struct acpi_device *adev = data->adev;

	dev_dbg(&adev->dev, "event=%#x\n", event);
	if (event != 0x88) {
@@ -166,8 +167,18 @@ static int asus_wireless_add(struct acpi_device *adev)
	data->led.default_trigger = "rfkill-none";
	err = devm_led_classdev_register(&adev->dev, &data->led);
	if (err)
		destroy_workqueue(data->wq);
		goto err;

	err = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
					      asus_wireless_notify, data);
	if (err) {
		devm_led_classdev_unregister(&adev->dev, &data->led);
		goto err;
	}
	return 0;

err:
	destroy_workqueue(data->wq);
	return err;
}

@@ -175,6 +186,8 @@ static void asus_wireless_remove(struct acpi_device *adev)
{
	struct asus_wireless_data *data = acpi_driver_data(adev);

	acpi_dev_remove_notify_handler(adev, ACPI_DEVICE_NOTIFY,
				       asus_wireless_notify);
	if (data->wq) {
		devm_led_classdev_unregister(&adev->dev, &data->led);
		destroy_workqueue(data->wq);
@@ -188,7 +201,6 @@ static struct acpi_driver asus_wireless_driver = {
	.ops = {
		.add = asus_wireless_add,
		.remove = asus_wireless_remove,
		.notify = asus_wireless_notify,
	},
};
module_acpi_driver(asus_wireless_driver);