Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp57225lqn; Thu, 11 Apr 2024 13:46:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsm/AN8gtfw3yIKUPwRimx+Rn+QFxt0GtnFvWqq6DOhGOkkS7xAVlc+hKPzVPjMMDQ346uwEsJsFnxnIcl5feldaTj+WYjpbBztXpprA== X-Google-Smtp-Source: AGHT+IF/kCnDfs9GR8/JEL8f2u+iI1gymHxGk9h4fxFcd4w8VGSHCJBaEplcl8Y9ytUjQOLfHqTZ X-Received: by 2002:a05:6512:4012:b0:516:a6ff:2467 with SMTP id br18-20020a056512401200b00516a6ff2467mr540272lfb.0.1712868380799; Thu, 11 Apr 2024 13:46:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712868380; cv=pass; d=google.com; s=arc-20160816; b=VoHd1oeg6il2b+yYtALNPfd60uXAg5KaznxtNV6k3IiLJ3XvRroTSxnLmr75aACwG9 uDZVmFDq/IAAOJ01oz0b6bxhknCFVEtf3JDeyre10gxx7c2GOfOkosQGJ4lx4Qo+LiDj j32gCPKSI9PMU5FIkQu55TcpwxLvHG+UxutfvspjBOkxNXyAklFvrE+HO2lBg3G2NQKn HFxBgIt9/+V1xai6NZTzqJAspP1ifiuSu0Z5wRLcgy0YF2pEoFkUB2fW2hR2ySJ6KXu3 71rarjNyOSpwUgVSdaF6TMJrENdkLpBz2pM7BLor4mQ/dx2sSn4iN4okXJiCTNF6pZXV vWtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=N9m8ca044ZzE/l4b73VV827bdS2zTamBS93bJRB0xjs=; fh=gPfXeT2MND+Ait7ryvC22ezDaTuJ6oE6n6UJopvsHf4=; b=CldpdH0Qw31Zc3nInYwU5/tOsxzAtDYevDMgNiXhhKH8OH1SmJ1OsEUs44U37nGQ6h AJnJIadV1cf+yiFrXrQGw/qLEUs1fZEQjGWWKZhcuup0XENUiqT7IRFk6mzHaG9I49NC 152v00WkqPqdPQstOoDRGymqJVsxXlmBeDjm4ZA2SOk6nRS0gd5Ke3C8pODYpJqaBrs9 m/Q83Pww0RVRmi4qnOgO/r5hE/E4ShpovizrRvS9/Q3zV9X/rQYYaNbeNFAekdZnu1Cw wCnzaloh2J+dGbOYeM5OJs56GGki4tDQku/0Ufv5HUXNotCZeEgnZljgIVw0KiCXJ5oV qUZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lXUpBEwj; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-141398-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141398-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d6-20020a50cd46000000b0056fc14efdaasi1050785edj.36.2024.04.11.13.46.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 13:46:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141398-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lXUpBEwj; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-141398-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141398-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 88B1D1F24CD3 for ; Thu, 11 Apr 2024 18:17:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E5E253E0D; Thu, 11 Apr 2024 17:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lXUpBEwj" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D968D2BB1C; Thu, 11 Apr 2024 17:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712856403; cv=none; b=fsKFYvI/BHuXPKbBLRMSj9GSkuHYl6RKBM9Sln7YJsmw3DZkc8kqUzNPcEuId2GyDf/rZFtUNVy36p0BMOciptXXIR7PR+UyD2oEIPueMd+L29ZnK1AONWV94Mpsl6Niq9er8SyNj40tW6+80v6rn6ga51C6ePGV9itN1pGpIoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712856403; c=relaxed/simple; bh=GCmd6EWyeSI61/ahtWxVMlmLMfAP5vYzOKp2NSFA8/I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mJRwNbflxCE4pfb2GRrrk8MsaCD8fQJCMRYFTVoO+BVdCSk0U3gmgqcupmYu4vfdcGWxkSdtRmKp1F6momeKD4X7X6lCUPkttTQs70qsrrAxZJhfFiW9URW21FCUFrLAjy0pZaLH2ZEJgI0QNvjTZI8T6OnSWQzJqGYz4XIH1Ms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lXUpBEwj; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712856402; x=1744392402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GCmd6EWyeSI61/ahtWxVMlmLMfAP5vYzOKp2NSFA8/I=; b=lXUpBEwju9hHwDYAjqGVNgAjmo0NkZOY1QhOmqvKWy6+UB4UqtjAIW67 AQdBo5iuUslUnKqawseAgZuhR+fQSLosCw0tLyVRfcMx6haf3KF0K4xBi x7D+wDCIQkTrvfYYYO1p8C8a76/MEhNg7tJi4sD3hBq81rkOZ9waJysEn w9ZSfkXMcGxN5AocoWMOVM1mYJHABf2vpdhXf0a16FjdyLg5l7nElXrzV r7D6q7lgYeckKGaKoOiU4r8MI//+82NKbK+HVeUj9J1nJSBqdW31nF+i/ HazS+1inMFLuE2YUiyaN9CFBi865HOAMvU3gfg3Jjfk8J0tTNj6ilfKta w==; X-CSE-ConnectionGUID: FNuNgM5kReSxgswtEStJpQ== X-CSE-MsgGUID: APbE3zVKSHmKWiPsliT4tQ== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="18844992" X-IronPort-AV: E=Sophos;i="6.07,193,1708416000"; d="scan'208";a="18844992" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 10:26:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="937097271" X-IronPort-AV: E=Sophos;i="6.07,193,1708416000"; d="scan'208";a="937097271" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 11 Apr 2024 10:26:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0AE03161; Thu, 11 Apr 2024 20:26:33 +0300 (EEST) From: Andy Shevchenko To: Bartosz Golaszewski , Andy Shevchenko , David Thompson , Linus Walleij , Patrick Rudolph , "Rafael J. Wysocki" , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org Cc: Bartosz Golaszewski , Mika Westerberg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Rafael J. Wysocki" , Len Brown Subject: [PATCH v1 1/4] gpiolib: acpi: Extract __acpi_find_gpio() helper Date: Thu, 11 Apr 2024 20:22:29 +0300 Message-ID: <20240411172540.4122581-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240411172540.4122581-2-andriy.shevchenko@linux.intel.com> References: <20240411172540.4122581-2-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit We want to reuse it later on in the code. In particular, it helps to clean up the users of acpi_dev_gpio_irq_wake_get_by(). Signed-off-by: Andy Shevchenko --- drivers/gpio/gpiolib-acpi.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index c2a33beeec50..d47b22ac3ecb 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -945,14 +945,11 @@ static bool acpi_can_fallback_to_crs(struct acpi_device *adev, return con_id == NULL; } -struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, - const char *con_id, - unsigned int idx, - enum gpiod_flags *dflags, - unsigned long *lookupflags) +static struct gpio_desc * +__acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int idx, + struct acpi_gpio_info *info) { struct acpi_device *adev = to_acpi_device_node(fwnode); - struct acpi_gpio_info info; struct gpio_desc *desc; char propname[32]; int i; @@ -969,10 +966,10 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, if (adev) desc = acpi_get_gpiod_by_index(adev, - propname, idx, &info); + propname, idx, info); else desc = acpi_get_gpiod_from_data(fwnode, - propname, idx, &info); + propname, idx, info); if (PTR_ERR(desc) == -EPROBE_DEFER) return ERR_CAST(desc); @@ -985,11 +982,28 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, if (!adev || !acpi_can_fallback_to_crs(adev, con_id)) return ERR_PTR(-ENOENT); - desc = acpi_get_gpiod_by_index(adev, NULL, idx, &info); + desc = acpi_get_gpiod_by_index(adev, NULL, idx, info); if (IS_ERR(desc)) return desc; } + return desc; +} + +struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, + const char *con_id, + unsigned int idx, + enum gpiod_flags *dflags, + unsigned long *lookupflags) +{ + struct acpi_device *adev = to_acpi_device_node(fwnode); + struct acpi_gpio_info info; + struct gpio_desc *desc; + + desc = __acpi_find_gpio(fwnode, con_id, idx, &info); + if (IS_ERR(desc)) + return desc; + if (info.gpioint && (*dflags == GPIOD_OUT_LOW || *dflags == GPIOD_OUT_HIGH)) { dev_dbg(&adev->dev, "refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n"); -- 2.43.0.rc1.1336.g36b5255a03ac