From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbbCKIne (ORCPT ); Wed, 11 Mar 2015 04:43:34 -0400 Received: from mga11.intel.com ([192.55.52.93]:42566 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752061AbbCKIn1 (ORCPT ); Wed, 11 Mar 2015 04:43:27 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,380,1422950400"; d="scan'208";a="678374011" Date: Wed, 11 Mar 2015 10:43:24 +0200 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Linus Walleij , Alexandre Courbot , linux-gpio@vger.kernel.org, Linux Kernel Mailing List , ACPI Devel Maling List Subject: Re: [PATCH 1/2] gpio / ACPI: Avoid unnecessary checks in __gpiod_get_index() Message-ID: <20150311084324.GD1563@lahna.fi.intel.com> References: <4032246.STUT1iRmIk@vostro.rjw.lan> <1829371.gDPkhnsp25@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1829371.gDPkhnsp25@vostro.rjw.lan> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2015 at 11:08:57PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > If dev is NULL in __gpiod_get_index() and both ACPI and OF are > enabled, it will be checked twice before the code decides to give > up with DT/ACPI lookup, so avoid that. > > Also use the observation that ACPI_COMPANION() is much more efficient > than ACPI_HANDLE(), because the latter uses the former and carries out > a check and a pointer dereference on top of it, so replace the > ACPI_HANDLE() check with an ACPI_COMPANION() one which does not > require the additional IS_ENABLED(CONFIG_ACPI) check too. > > Signed-off-by: Rafael J. Wysocki Acked-by: Mika Westerberg