From patchwork Wed Sep 12 20:30:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toshi Kani X-Patchwork-Id: 1446581 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A0E033FCFC for ; Wed, 12 Sep 2012 20:37:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753186Ab2ILUh0 (ORCPT ); Wed, 12 Sep 2012 16:37:26 -0400 Received: from g5t0008.atlanta.hp.com ([15.192.0.45]:24051 "EHLO g5t0008.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751699Ab2ILUhZ (ORCPT ); Wed, 12 Sep 2012 16:37:25 -0400 Received: from g5t0030.atlanta.hp.com (g5t0030.atlanta.hp.com [16.228.8.142]) by g5t0008.atlanta.hp.com (Postfix) with ESMTP id DBE482427B; Wed, 12 Sep 2012 20:37:24 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.71.12.41]) by g5t0030.atlanta.hp.com (Postfix) with ESMTP id 52736142AE; Wed, 12 Sep 2012 20:37:24 +0000 (UTC) From: Toshi Kani To: linux-acpi@vger.kernel.org, lenb@kernel.org Cc: linux-kernel@vger.kernel.org, shli@fusionio.com, Toshi Kani Subject: [PATCH] ACPI: dock: Remove redundant ACPI NS walk Date: Wed, 12 Sep 2012 14:30:49 -0600 Message-Id: <1347481849-17973-1-git-send-email-toshi.kani@hp.com> X-Mailer: git-send-email 1.7.7.6 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Combined two ACPI namespace walks, which look for dock stations and then bays separately, into a single walk. Signed-off-by: Toshi Kani Reviewed-by: Yasuaki Ishimatsu --- drivers/acpi/dock.c | 26 +++++++------------------- 1 files changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 88eb143..ae4ebf2 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -1016,44 +1016,32 @@ static int dock_remove(struct dock_station *ds) } /** - * find_dock - look for a dock station + * find_dock_and_bay - look for dock stations and bays * @handle: acpi handle of a device * @lvl: unused - * @context: counter of dock stations found + * @context: unused * @rv: unused * - * This is called by acpi_walk_namespace to look for dock stations. + * This is called by acpi_walk_namespace to look for dock stations and bays. */ static __init acpi_status -find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) +find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv) { - if (is_dock(handle)) + if (is_dock(handle) || is_ejectable_bay(handle)) dock_add(handle); return AE_OK; } -static __init acpi_status -find_bay(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - /* If bay is a dock, it's already handled */ - if (is_ejectable_bay(handle) && !is_dock(handle)) - dock_add(handle); - return AE_OK; -} - static int __init dock_init(void) { if (acpi_disabled) return 0; - /* look for a dock station */ + /* look for dock stations and bays */ acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, find_dock, NULL, NULL, NULL); + ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL); - /* look for bay */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, find_bay, NULL, NULL, NULL); if (!dock_station_count) { printk(KERN_INFO PREFIX "No dock devices found.\n"); return 0;