From nobody Fri Feb 13 09:48:56 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B5D4E7E652 for ; Tue, 26 Sep 2023 15:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235016AbjIZPAF (ORCPT ); Tue, 26 Sep 2023 11:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233699AbjIZPAA (ORCPT ); Tue, 26 Sep 2023 11:00:00 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8F0A120 for ; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31f71b25a99so8908186f8f.2 for ; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740392; x=1696345192; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9JlgJB8QI0EX98WcT+eE7uEPjq//nnV5NSDnPP83OC4=; b=QOEf7hjuT0l4WBz4752PrDciv1tUKsPuy3vsqzwR9P3r+SvYiiQdiyqoxcOBCU2nEz oCqKbDgvbwDt1BPuIRea7SAXZIOk5ArBt+X+BZi9X710A+OXLUblvhMY+QKvB4dzBgED 5TJ8MmN/L17oHo3FAk+xHPw+2OVXrxopLQPHKblC3uKs2clOEGDnJCUUvk3fCPxYYGoz fGGgYnO8bzNMbkjkReuRg5uJrmQrDFV/z1qB0UrHb9PWBns9UaH0yN8MZsh1zMloJNjH W1i9N0eZ+t60v3O97ArAgo/5gryTKaWbM9f8S47DyV7NtPKLOibDBO974ENjIyFBmPIL sdaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740392; x=1696345192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9JlgJB8QI0EX98WcT+eE7uEPjq//nnV5NSDnPP83OC4=; b=EBNssfZnjzFMgSfpyQyn//8jw7HSQvo7lQveGqzts8P8Nb8L7vAJWGJBHcULQ7JS9j xHtLRU+cauTLXzARzNKb4V+OoR0vjOjdeWlp3sdT24bHezij7riCdokw3VkgYz/IPngi tdTaVScdxyjTlXvQU2v4Ac6e4AMSyJASYV7XODU0JnUZCtyVmQAA0fVxLz+eGXGfkihJ y10YThpUY39Etj8tCAhni0CdnBvj7s/0L2w8aVvHvtiskfTEsa2dpVgvRljPCNByeMj6 uYgdrNa2/Fsn3jiGjyv2/7KybK+fnRmhzKIwcTRvMFuCPgNFqgexnne6Uo9uXVq5Czx/ 43nQ== X-Gm-Message-State: AOJu0Yxt+q1YdXfUgYmWnW3Hasc6XyNo39KoHZGX32/iypwP0WuPExQp UHZWTmknO4Nsz7tBSp1axYBZHw== X-Google-Smtp-Source: AGHT+IEry51pvRXcR/Bg3Ovg+pDmNC+cZF8nAceS0yECUnNz+7mE5ZPaS3ORz3jPT6CvosswbIBsEA== X-Received: by 2002:a5d:658b:0:b0:321:708d:3374 with SMTP id q11-20020a5d658b000000b00321708d3374mr8387415wru.3.1695740392138; Tue, 26 Sep 2023 07:59:52 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:51 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 1/4] platform/x86: int3472: provide a helper for getting GPIOs from lookups Date: Tue, 26 Sep 2023 16:59:40 +0200 Message-Id: <20230926145943.42814-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski gpiod_toggle_active_low() should have never existed in the first place and once it was added, it should have never been used outside the MMC slot code. Stop using it in the int3472 driver and use temporary lookup tables instead. First: add a helper wrapping the common code in one function. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/platform/x86/intel/int3472/common.c | 29 +++++++++++++++++++++ drivers/platform/x86/intel/int3472/common.h | 9 +++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/common.c b/drivers/platform= /x86/intel/int3472/common.c index 9db2bb0bbba4..61a8240ed6db 100644 --- a/drivers/platform/x86/intel/int3472/common.c +++ b/drivers/platform/x86/intel/int3472/common.c @@ -2,6 +2,10 @@ /* Author: Dan Scally */ =20 #include +#include +#include +#include +#include #include =20 #include "common.h" @@ -80,3 +84,28 @@ int skl_int3472_get_sensor_adev_and_name(struct device *= dev, =20 return ret; } + +/* This should *really* only be used when there's no other way... */ +struct gpio_desc * +skl_int3472_gpiod_get_from_temp_lookup(struct device *dev, + const char *chip_label, u16 hwnum, + const char *con_id, + enum gpio_lookup_flags lflags, + enum gpiod_flags rflags) +{ + struct gpio_desc *desc; + + struct gpiod_lookup_table *lookup __free(kfree) =3D + kzalloc(struct_size(lookup, table, 1), GFP_KERNEL); + if (!lookup) + return ERR_PTR(-ENOMEM); + + lookup->dev_id =3D dev_name(dev); + lookup->table[0] =3D GPIO_LOOKUP(chip_label, hwnum, con_id, lflags); + + gpiod_add_lookup_table(lookup); + + desc =3D gpiod_get(dev, con_id, rflags); + gpiod_remove_lookup_table(lookup); + return desc; +} diff --git a/drivers/platform/x86/intel/int3472/common.h b/drivers/platform= /x86/intel/int3472/common.h index 9f29baa13860..85ef9b630044 100644 --- a/drivers/platform/x86/intel/int3472/common.h +++ b/drivers/platform/x86/intel/int3472/common.h @@ -5,6 +5,8 @@ #define _INTEL_SKL_INT3472_H =20 #include +#include +#include #include #include #include @@ -129,4 +131,11 @@ int skl_int3472_register_pled(struct int3472_discrete_= device *int3472, struct acpi_resource_gpio *agpio, u32 polarity); void skl_int3472_unregister_pled(struct int3472_discrete_device *int3472); =20 +struct gpio_desc * +skl_int3472_gpiod_get_from_temp_lookup(struct device *dev, + const char *chip_label, u16 hwnum, + const char *con_id, + enum gpio_lookup_flags lflags, + enum gpiod_flags rflags); + #endif --=20 2.39.2 From nobody Fri Feb 13 09:48:56 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C57ADE7E651 for ; Tue, 26 Sep 2023 15:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235019AbjIZPAH (ORCPT ); Tue, 26 Sep 2023 11:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234996AbjIZPAB (ORCPT ); Tue, 26 Sep 2023 11:00:01 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8C7127 for ; Tue, 26 Sep 2023 07:59:54 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-32336a30d18so1508785f8f.2 for ; Tue, 26 Sep 2023 07:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740393; x=1696345193; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LOR2X/AoUnTx42nPhZDbyArkpmdX3bsMYj2lZRsFUms=; b=zOZwMSAXHjeLQGWcL2Uhltnz2hlI7XNV9ewI0AYTJIyufx2fw5+odUKZX3SF3OdVo2 UlQEE0zam+rMuUY+dmj78myXlrMmWSkfn37NQb+yQn2yRzuAYt1mHQeX69fRpj3LWgoq DnRkDh1CFa3VtNEjAJi12cVCeQPSzMIuLFEBnrWlbPdaoXkN0akjsISOdCiNgMPoHRLF r7kNO0MescDjiY5P31lLEnDKROy/OtDt6ZI8ox9V10HkOMJPo00rSnEjLYDdN9ij1f9G l36r3oZGDy/tqplSiP6d6VejCSKVhHopDn8QC2mOJlzpGtJlbgtq+H3NJEoLoy5x/ooi jU0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740393; x=1696345193; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LOR2X/AoUnTx42nPhZDbyArkpmdX3bsMYj2lZRsFUms=; b=GDKlnZjSkY7mE15XLtRf76hlWCNPpmAe9M1h415Lfhxhd4S0hf1hoZ7j0H+uG+6/k7 vryjlOfuK8aKJI/hZ5+8b0NLJunyIXRIISC7IHbose6ZVsULC+nmpZGphhIshAVyf2Gf TLTu+vcTDqntwsxwJUpbQGLE+9fnu5/u0dYCkDYltE2hjmVtcJkCuekX8YdAiHtKB0CF AVRjZmJFXGYxgDnr7s5KlQcdz4xbmxXbM0sztWiE4Ip9SSWPbZKP+Mtf5jdrUf56A6iL wY3c1LZbzjdghlsaJwF8NrP5Tq00jJup2YPcS2XGc8R4/KE3zItUjanW24OaeiQ2KPyI 1UqA== X-Gm-Message-State: AOJu0YwRP19T/N0Oo22/IwgJknmpmpfspHwc79OwW0H26baDUhNy7J+/ 875+Zv5e46xm6n4j3Oa3uKRfLw== X-Google-Smtp-Source: AGHT+IFvuYKk7b6vwmISUaGLDlo/gV93nTCl+wOrw03xkUp5qRrel4E8uHLcxNK3RPdoDpL8HMIuqw== X-Received: by 2002:adf:f044:0:b0:319:7134:a3cf with SMTP id t4-20020adff044000000b003197134a3cfmr9483453wro.31.1695740393042; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:52 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 2/4] platform/x86: int3472: led: don't use gpiod_toggle_active_low() Date: Tue, 26 Sep 2023 16:59:41 +0200 Message-Id: <20230926145943.42814-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Instead of acpi_get_and_request_gpiod() + gpiod_toggle_active_low(), use temporary lookup tables with appropriate lookup flags. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/platform/x86/intel/int3472/led.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/led.c b/drivers/platform/x8= 6/intel/int3472/led.c index bca1ce7d0d0c..62e0cd5207a7 100644 --- a/drivers/platform/x86/intel/int3472/led.c +++ b/drivers/platform/x86/intel/int3472/led.c @@ -25,18 +25,14 @@ int skl_int3472_register_pled(struct int3472_discrete_d= evice *int3472, if (int3472->pled.classdev.dev) return -EBUSY; =20 - int3472->pled.gpio =3D acpi_get_and_request_gpiod(path, agpio->pin_table[= 0], - "int3472,privacy-led"); + int3472->pled.gpio =3D skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,privacy-led", polarity, + GPIOD_OUT_LOW); if (IS_ERR(int3472->pled.gpio)) return dev_err_probe(int3472->dev, PTR_ERR(int3472->pled.gpio), "getting privacy LED GPIO\n"); =20 - if (polarity =3D=3D GPIO_ACTIVE_LOW) - gpiod_toggle_active_low(int3472->pled.gpio); - - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->pled.gpio, 0); - /* Generate the name, replacing the ':' in the ACPI devname with '_' */ snprintf(int3472->pled.name, sizeof(int3472->pled.name), "%s::privacy_led", acpi_dev_name(int3472->sensor)); --=20 2.39.2 From nobody Fri Feb 13 09:48:56 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96D6CE7E64A for ; Tue, 26 Sep 2023 15:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235022AbjIZPAJ (ORCPT ); Tue, 26 Sep 2023 11:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234999AbjIZPAC (ORCPT ); Tue, 26 Sep 2023 11:00:02 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812BB13A for ; Tue, 26 Sep 2023 07:59:55 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-405497850dbso70908355e9.0 for ; Tue, 26 Sep 2023 07:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740394; x=1696345194; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; b=w4ZxVzxqVCw4qjgnYaUWgjZiZ016hC+aZ3J5ft8os76UZ3+SpjZEUYYUqJx8S/PUm1 hJzpz3PkJcRFX+7IvPfutngdq56J/H+jMnPhaoPysmc4Cb/1teL4yi0biPWA3yom6LD2 IgsPVS9ps/GpLPkMU7AQMOj/xyKC79ID7av5cJCzt5K7X1qMqpUIHxX7EqpBAUi1Sm7L I2kM6WB2rlsfA/z7Cim9HzJon3X4w67OMGmaRPfHeinzXvThbOXmLDVZETuokriRt0nd FBLj3mIXozbwELB/6XvMziXDc+rh3mMIadt/4pmE7o6gYoarfc7aWNHDE6ivrzbEoLgy 37Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740394; x=1696345194; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; b=ljEjTLHeXpYnJLiSbWNZmZcF42/YjCJstz2d+zAlXX71g3x9fy65Be9tQvr6s4x9tX Q03QNKjWnFLoxQMizZgsICI7N9c6iLxDmAjw0wO8e2aJnBQw1xdAW+NggeXIX4BJxLlo Wl0ys3PhYhETcTF4OFMtYR9LcKHhjPBAstHXLaYPEPokbFu8QTiPgP/f5rCgzCUwESBG l4hJBXBLAHbXX9TSS6NT9x3WWcyMHc910rOKqH7XY0T4JMepc9iEciCbVz4uwZQRwrNh 7DKrm8mTGYKjMai717ZWFURfZ2cWcwrrQyVttpuG3BUf5p+43zLhiXI3CG9uCFu9JOX6 twLw== X-Gm-Message-State: AOJu0YwY2i/P/Oj0KO7pjw27Il9GUyhfubKFkYwANf4V/2FWWpPkNPAD xtRVUFuePyRR2F0AJEvZOzWwUA== X-Google-Smtp-Source: AGHT+IHI0VIKUHq7lfQylc1Bgqtnm9G/0hKS8DqAmHAu9aN6x76YmqNYZiupYJpDJhSqidCGXyqjpA== X-Received: by 2002:adf:ff8c:0:b0:317:ef76:b773 with SMTP id j12-20020adfff8c000000b00317ef76b773mr8594149wrr.45.1695740393987; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:53 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 3/4] platform/x86: int3472: clk_and_regulator: use GPIO lookup tables Date: Tue, 26 Sep 2023 16:59:42 +0200 Message-Id: <20230926145943.42814-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Instead of acpi_get_and_request_gpiod() + gpiod_toggle_active_low(), use temporary lookup tables with appropriate lookup flags. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- .../x86/intel/int3472/clk_and_regulator.c | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drive= rs/platform/x86/intel/int3472/clk_and_regulator.c index ef4b3141efcd..ec4c4848a2c4 100644 --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c @@ -174,20 +174,16 @@ int skl_int3472_register_gpio_clock(struct int3472_di= screte_device *int3472, if (int3472->clock.cl) return -EBUSY; =20 - int3472->clock.ena_gpio =3D acpi_get_and_request_gpiod(path, agpio->pin_t= able[0], - "int3472,clk-enable"); + int3472->clock.ena_gpio =3D skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,clk-enable", polarity, + GPIOD_OUT_LOW); if (IS_ERR(int3472->clock.ena_gpio)) { ret =3D PTR_ERR(int3472->clock.ena_gpio); int3472->clock.ena_gpio =3D NULL; return dev_err_probe(int3472->dev, ret, "getting clk-enable GPIO\n"); } =20 - if (polarity =3D=3D GPIO_ACTIVE_LOW) - gpiod_toggle_active_low(int3472->clock.ena_gpio); - - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->clock.ena_gpio, 0); - init.name =3D kasprintf(GFP_KERNEL, "%s-clk", acpi_dev_name(int3472->adev)); if (!init.name) { @@ -314,17 +310,17 @@ int skl_int3472_register_regulator(struct int3472_dis= crete_device *int3472, int3472->regulator.supply_name, &int3472_gpio_regulator_ops); =20 - int3472->regulator.gpio =3D acpi_get_and_request_gpiod(path, agpio->pin_t= able[0], - "int3472,regulator"); + /* Ensure the pin is in output mode and non-active state */ + int3472->regulator.gpio =3D skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,regulator", GPIO_ACTIVE_HIGH, + GPIOD_OUT_LOW); if (IS_ERR(int3472->regulator.gpio)) { ret =3D PTR_ERR(int3472->regulator.gpio); int3472->regulator.gpio =3D NULL; return dev_err_probe(int3472->dev, ret, "getting regulator GPIO\n"); } =20 - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->regulator.gpio, 0); - cfg.dev =3D &int3472->adev->dev; cfg.init_data =3D &init_data; cfg.ena_gpiod =3D int3472->regulator.gpio; --=20 2.39.2 From nobody Fri Feb 13 09:48:56 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88D66E7E648 for ; Tue, 26 Sep 2023 15:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235028AbjIZPAL (ORCPT ); Tue, 26 Sep 2023 11:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235005AbjIZPAD (ORCPT ); Tue, 26 Sep 2023 11:00:03 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F2810E for ; Tue, 26 Sep 2023 07:59:56 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-405417465aaso80297125e9.1 for ; Tue, 26 Sep 2023 07:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740395; x=1696345195; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HNGK0v08+zzpQuwoBoXMljpypDBn+BJlECyJC5l0N4Y=; b=y8aV3sl/654U3FoYohmH++rkk2HdgHwQxSCApQc7CvTvnkS7DXX0+VG009UypeeXBH o98O++bbLGXSezK6Ttg/lCCchVVejqj1azQZZoPYvSyhTPBsSSS7IFhnR9xUr9F9vf5g klVnOgQVovYOeECWZmMiJMhrmZDR6qu8+/HDcWCKWZ6pX0fo4hSHlVFI8Xh15nMh9sYg M8FWJlNs2cw5DsdnQoEIEnVSvpjrHmR/H7OzAUY2cJ7Sq23O4mxPrvxKa8A4fkIw69nT v/348kPXJ8HF4ePd7C1Jk+oHRGpDo0LKFEhqbsOHA4Aekr0X4bu3DHLtyso3u2T7vVdS ULQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740395; x=1696345195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HNGK0v08+zzpQuwoBoXMljpypDBn+BJlECyJC5l0N4Y=; b=rpCYQla6k5e/gMdvIozPNTzQP7nfH3blqFbXstliUzEJVizAJ7711qBPPnaOFe8xWm Mn1Y0Me5AzLYvfRNmfkXhNELnQJmcPUK4qEUa1yORT/giNV4CNu5a85QEcTKp1Q0PpdJ kOJLn+L8rbDzr8nIHg8agdhpbTdEhghl0SvdLs7pVuUaqI7hwL1tmfZGoG+bNJ/Mm69b Al5yyYHzLi/tvXlvGwm2hMErE7g5okUl2/elWN0C35Bwpe6xcTs1e6mxZq+CZCeBJXjt 7mW6vn/fm41w5t2hejF57NxmAdia0gTlIXmlLDURp/VMksYNUFCgJ2Odf6JoAJLUZgX2 Cn3A== X-Gm-Message-State: AOJu0YwtLoGqqkW6Rw1028C8t9G+2D1VSHFECcASTuhenP2HnPeVXOO7 whDEnitVNFdOqv0CsZXTdz+Y6w== X-Google-Smtp-Source: AGHT+IEOH4p3qhvyQQt5ZYpZ/mQ1vxTnsYtUtTM2fHWFYi8sXoPXL21yjgXMCK7N2nHUIBl2/l7VVw== X-Received: by 2002:a05:600c:216:b0:401:b2c7:34a8 with SMTP id 22-20020a05600c021600b00401b2c734a8mr8423804wmi.7.1695740394843; Tue, 26 Sep 2023 07:59:54 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:54 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 4/4] gpio: acpi: remove acpi_get_and_request_gpiod() Date: Tue, 26 Sep 2023 16:59:43 +0200 Message-Id: <20230926145943.42814-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski With no more users, we can remove acpi_get_and_request_gpiod(). Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: From: Andy Shevchenko Reviewed-by: Mika Westerberg --- drivers/gpio/gpiolib-acpi.c | 28 ---------------------------- include/linux/gpio/consumer.h | 8 -------- 2 files changed, 36 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 17a86bdd9609..89ff93f3b579 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -158,34 +158,6 @@ static struct gpio_desc *acpi_get_gpiod(char *path, un= signed int pin) return gpiochip_get_desc(chip, pin); } =20 -/** - * acpi_get_and_request_gpiod - Translate ACPI GPIO pin to GPIO descriptor= and - * hold a refcount to the GPIO device. - * @path: ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1") - * @pin: ACPI GPIO pin number (0-based, controller-relative) - * @label: Label to pass to gpiod_request() - * - * This function is a simple pass-through to acpi_get_gpiod(), except that - * as it is intended for use outside of the GPIO layer (in a similar fashi= on to - * gpiod_get_index() for example) it also holds a reference to the GPIO de= vice. - */ -struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin,= char *label) -{ - struct gpio_desc *gpio; - int ret; - - gpio =3D acpi_get_gpiod(path, pin); - if (IS_ERR(gpio)) - return gpio; - - ret =3D gpiod_request(gpio, label); - if (ret) - return ERR_PTR(ret); - - return gpio; -} -EXPORT_SYMBOL_GPL(acpi_get_and_request_gpiod); - static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) { struct acpi_gpio_event *event =3D data; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 6cc345440a5b..db2dfbae8edb 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -606,8 +606,6 @@ void acpi_dev_remove_driver_gpios(struct acpi_device *a= dev); int devm_acpi_dev_add_driver_gpios(struct device *dev, const struct acpi_gpio_mapping *gpios); =20 -struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin,= char *label); - #else /* CONFIG_GPIOLIB && CONFIG_ACPI */ =20 #include @@ -625,12 +623,6 @@ static inline int devm_acpi_dev_add_driver_gpios(struc= t device *dev, return -ENXIO; } =20 -static inline struct gpio_desc *acpi_get_and_request_gpiod(char *path, uns= igned int pin, - char *label) -{ - return ERR_PTR(-ENOSYS); -} - #endif /* CONFIG_GPIOLIB && CONFIG_ACPI */ =20 =20 --=20 2.39.2