eeepc-laptop: clean up control flow in *_rfkill_notifier
Handle errors immediately in eeepc_register_rfkill_notifier and eeepc_unregister_rfkill_notifier. This clears up the control flow for the reader. It also removes unnecessary indentation. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
This commit is contained in:
parent
d48690383f
commit
557b454971
@ -668,23 +668,21 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
|
|||||||
|
|
||||||
status = acpi_get_handle(NULL, node, &handle);
|
status = acpi_get_handle(NULL, node, &handle);
|
||||||
|
|
||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_FAILURE(status))
|
||||||
status = acpi_install_notify_handler(handle,
|
|
||||||
ACPI_SYSTEM_NOTIFY,
|
|
||||||
eeepc_rfkill_notify,
|
|
||||||
eeepc);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
pr_warn("Failed to register notify on %s\n", node);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Refresh pci hotplug in case the rfkill state was
|
|
||||||
* changed during setup.
|
|
||||||
*/
|
|
||||||
eeepc_rfkill_hotplug(eeepc, handle);
|
|
||||||
} else {
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
|
|
||||||
|
status = acpi_install_notify_handler(handle,
|
||||||
|
ACPI_SYSTEM_NOTIFY,
|
||||||
|
eeepc_rfkill_notify,
|
||||||
|
eeepc);
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
|
pr_warn("Failed to register notify on %s\n", node);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Refresh pci hotplug in case the rfkill state was
|
||||||
|
* changed during setup.
|
||||||
|
*/
|
||||||
|
eeepc_rfkill_hotplug(eeepc, handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,20 +694,21 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc,
|
|||||||
|
|
||||||
status = acpi_get_handle(NULL, node, &handle);
|
status = acpi_get_handle(NULL, node, &handle);
|
||||||
|
|
||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_FAILURE(status))
|
||||||
status = acpi_remove_notify_handler(handle,
|
return;
|
||||||
ACPI_SYSTEM_NOTIFY,
|
|
||||||
eeepc_rfkill_notify);
|
status = acpi_remove_notify_handler(handle,
|
||||||
if (ACPI_FAILURE(status))
|
ACPI_SYSTEM_NOTIFY,
|
||||||
pr_err("Error removing rfkill notify handler %s\n",
|
eeepc_rfkill_notify);
|
||||||
node);
|
if (ACPI_FAILURE(status))
|
||||||
/*
|
pr_err("Error removing rfkill notify handler %s\n",
|
||||||
* Refresh pci hotplug in case the rfkill
|
node);
|
||||||
* state was changed after
|
/*
|
||||||
* eeepc_unregister_rfkill_notifier()
|
* Refresh pci hotplug in case the rfkill
|
||||||
*/
|
* state was changed after
|
||||||
eeepc_rfkill_hotplug(eeepc, handle);
|
* eeepc_unregister_rfkill_notifier()
|
||||||
}
|
*/
|
||||||
|
eeepc_rfkill_hotplug(eeepc, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
|
static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user