public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Yinghai Lu <yinghai@kernel.org>, Toshi Kani <toshi.kani@hp.com>
Subject: [PATCH 2/2] ACPI / scan: Clean up acpi_bus_get_parent()
Date: Wed, 30 Jan 2013 23:04:03 +0100	[thread overview]
Message-ID: <7667918.svVNymu9rt@vostro.rjw.lan> (raw)
In-Reply-To: <1451967.YMyGeCCNtu@vostro.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Make acpi_bus_get_parent() more straightforward and remove an
unnecessary local variable ret from it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/scan.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

Index: test/drivers/acpi/scan.c
===================================================================
--- test.orig/drivers/acpi/scan.c
+++ test/drivers/acpi/scan.c
@@ -871,29 +871,23 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver
    -------------------------------------------------------------------------- */
 static struct acpi_device *acpi_bus_get_parent(acpi_handle handle)
 {
+	struct acpi_device *device = NULL;
 	acpi_status status;
-	int ret;
-	struct acpi_device *device;
 
 	/*
 	 * Fixed hardware devices do not appear in the namespace and do not
 	 * have handles, but we fabricate acpi_devices for them, so we have
 	 * to deal with them specially.
 	 */
-	if (handle == NULL)
+	if (!handle)
 		return acpi_root;
 
 	do {
 		status = acpi_get_parent(handle, &handle);
-		if (status == AE_NULL_ENTRY)
-			return NULL;
 		if (ACPI_FAILURE(status))
-			return acpi_root;
-
-		ret = acpi_bus_get_device(handle, &device);
-		if (ret == 0)
-			return device;
-	} while (1);
+			return status == AE_NULL_ENTRY ? NULL : acpi_root;
+	} while (acpi_bus_get_device(handle, &device));
+	return device;
 }
 
 acpi_status


  parent reply	other threads:[~2013-01-30 21:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 22:02 [PATCH 0/2] ACPI / scan: Fix and cleanup related to acpi_bus_get_device() Rafael J. Wysocki
2013-01-30 22:03 ` [PATCH 1/2] ACPI / scan: Fix acpi_bus_get_device() check in acpi_match_device() Rafael J. Wysocki
2013-01-31  3:04   ` Yasuaki Ishimatsu
2013-01-31  3:12   ` [PATCH 0/4] Fix acpi_bus_get_device() check Yasuaki Ishimatsu
2013-01-31  3:14     ` Yasuaki Ishimatsu
2013-01-31  3:22       ` [RESEND PATCH 1/4] ACPI/PM: Fix acpi_bus_get_device() check in drivers/acpi/device_pm.c Yasuaki Ishimatsu
2013-01-31 20:21         ` Rafael J. Wysocki
2013-01-31 23:43           ` Yasuaki Ishimatsu
2013-02-01 22:30             ` Rafael J. Wysocki
2013-01-31  3:15     ` [PATCH 0/4] Fix acpi_bus_get_device() check Yasuaki Ishimatsu
2013-01-31  3:23       ` [RESEND PATCH 2/4] ACPI/dock: Fix acpi_bus_get_device() check in drivers/acpi/ddock.c Yasuaki Ishimatsu
2013-01-31  3:16     ` [PATCH 0/4] Fix acpi_bus_get_device() check Yasuaki Ishimatsu
2013-01-31  3:26       ` [RESEND PATCH 3/4] PNPACPI: Fix acpi_bus_get_device() check in drivers/pnp/pnpacpi/core.c Yasuaki Ishimatsu
2013-01-31  3:19     ` [PATCH 0/4] Fix acpi_bus_get_device() check Yasuaki Ishimatsu
2013-01-31  3:27       ` [RESEND PATCH 4/4] GPU/i915: Fix acpi_bus_get_device() check in drivers/gpu/drm/i915/intel_opregion.c Yasuaki Ishimatsu
2013-01-31 10:03         ` Daniel Vetter
2013-02-01  0:50           ` [UPDATE][PATCH " Yasuaki Ishimatsu
2013-02-01  0:53             ` Yasuaki Ishimatsu
2013-02-01  1:14               ` Yasuaki Ishimatsu
2013-02-01 10:03                 ` Daniel Vetter
2013-01-31  8:45   ` [PATCH 1/2] ACPI / scan: Fix acpi_bus_get_device() check in acpi_match_device() Mika Westerberg
2013-01-31 18:38   ` Yinghai Lu
2013-01-30 22:04 ` Rafael J. Wysocki [this message]
2013-01-31  3:41   ` [PATCH 2/2] ACPI / scan: Clean up acpi_bus_get_parent() Yasuaki Ishimatsu
2013-01-31  8:46   ` Mika Westerberg
2013-01-31 18:43   ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7667918.svVNymu9rt@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox