linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eeepc-laptop: clean up control flow in *_rfkill_notifier
@ 2014-09-20 22:22 Frans Klaver
  2014-09-22 21:20 ` Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Frans Klaver @ 2014-09-20 22:22 UTC (permalink / raw)
  To: Darren Hart
  Cc: Frans Klaver, Corentin Chary, acpi4asus-user,
	platform-driver-x86, linux-kernel

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>
---
This depends on the earlier eeepc cleanup series [1] to apply cleanly.

[1] https://lkml.org/lkml/2014/9/17/654

 drivers/platform/x86/eeepc-laptop.c | 57 ++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 3f6c762..db79902 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -668,23 +668,21 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
 
 	status = acpi_get_handle(NULL, node, &handle);
 
-	if (ACPI_SUCCESS(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 {
+	if (ACPI_FAILURE(status))
 		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;
 }
 
@@ -696,20 +694,21 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc,
 
 	status = acpi_get_handle(NULL, node, &handle);
 
-	if (ACPI_SUCCESS(status)) {
-		status = acpi_remove_notify_handler(handle,
-						     ACPI_SYSTEM_NOTIFY,
-						     eeepc_rfkill_notify);
-		if (ACPI_FAILURE(status))
-			pr_err("Error removing rfkill notify handler %s\n",
-				node);
-			/*
-			 * Refresh pci hotplug in case the rfkill
-			 * state was changed after
-			 * eeepc_unregister_rfkill_notifier()
-			 */
-		eeepc_rfkill_hotplug(eeepc, handle);
-	}
+	if (ACPI_FAILURE(status))
+		return;
+
+	status = acpi_remove_notify_handler(handle,
+					     ACPI_SYSTEM_NOTIFY,
+					     eeepc_rfkill_notify);
+	if (ACPI_FAILURE(status))
+		pr_err("Error removing rfkill notify handler %s\n",
+			node);
+		/*
+		 * Refresh pci hotplug in case the rfkill
+		 * state was changed after
+		 * eeepc_unregister_rfkill_notifier()
+		 */
+	eeepc_rfkill_hotplug(eeepc, handle);
 }
 
 static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] eeepc-laptop: clean up control flow in *_rfkill_notifier
  2014-09-20 22:22 [PATCH] eeepc-laptop: clean up control flow in *_rfkill_notifier Frans Klaver
@ 2014-09-22 21:20 ` Darren Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2014-09-22 21:20 UTC (permalink / raw)
  To: Frans Klaver
  Cc: Corentin Chary, acpi4asus-user, platform-driver-x86, linux-kernel

On Sun, Sep 21, 2014 at 12:22:17AM +0200, Frans Klaver wrote:
> 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>

Queued, thanks Frans.

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-22 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-20 22:22 [PATCH] eeepc-laptop: clean up control flow in *_rfkill_notifier Frans Klaver
2014-09-22 21:20 ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).