aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-31 14:57:40 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-31 14:57:40 -0500
commit456de893ea1a693dc266c5464a6d857bfed0875f (patch)
treea643801660d4e3ed1850347b7277ea5496066fdc
parent141a297bd02e8ddc5ab625cc3a1a5926b1ff929a (diff)
ACPI / scan: Clean up acpi_bus_get_parent()
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> Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/acpi/scan.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index a849d2430dff..360f1338749b 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -871,29 +871,23 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver);
871 -------------------------------------------------------------------------- */ 871 -------------------------------------------------------------------------- */
872static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) 872static struct acpi_device *acpi_bus_get_parent(acpi_handle handle)
873{ 873{
874 struct acpi_device *device = NULL;
874 acpi_status status; 875 acpi_status status;
875 int ret;
876 struct acpi_device *device;
877 876
878 /* 877 /*
879 * Fixed hardware devices do not appear in the namespace and do not 878 * Fixed hardware devices do not appear in the namespace and do not
880 * have handles, but we fabricate acpi_devices for them, so we have 879 * have handles, but we fabricate acpi_devices for them, so we have
881 * to deal with them specially. 880 * to deal with them specially.
882 */ 881 */
883 if (handle == NULL) 882 if (!handle)
884 return acpi_root; 883 return acpi_root;
885 884
886 do { 885 do {
887 status = acpi_get_parent(handle, &handle); 886 status = acpi_get_parent(handle, &handle);
888 if (status == AE_NULL_ENTRY)
889 return NULL;
890 if (ACPI_FAILURE(status)) 887 if (ACPI_FAILURE(status))
891 return acpi_root; 888 return status == AE_NULL_ENTRY ? NULL : acpi_root;
892 889 } while (acpi_bus_get_device(handle, &device));
893 ret = acpi_bus_get_device(handle, &device); 890 return device;
894 if (ret == 0)
895 return device;
896 } while (1);
897} 891}
898 892
899acpi_status 893acpi_status