From nobody Tue Dec 16 20:14:54 2025 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 B7AC5E732C7 for ; Thu, 28 Sep 2023 12:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232521AbjI1MmQ (ORCPT ); Thu, 28 Sep 2023 08:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231864AbjI1MmP (ORCPT ); Thu, 28 Sep 2023 08:42:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01C6419D for ; Thu, 28 Sep 2023 05:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695904885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TEs40AJ4lM3j9ffIIAlvF9xgj3FRAy6IbL4eThz+ihA=; b=VLn0JNEGRwi6K/0KGkoQnsC9JoJLBtaHbrkiJHoPR0EwIyA0sijPkvZqi93NDuf2PdvzXY 30hO+OjuXj/Y/KnVczbs6mL8kAcqqJd0MLe1cGZZWfxFkpwQ1DRAEBAenGf3EXWvJ6nRul UAfQ/XPgfj1xRV7+Sv5G6Ybnjo6VHCo= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-280-cLBlcGmxM5u1toRevJ-nSg-1; Thu, 28 Sep 2023 08:41:22 -0400 X-MC-Unique: cLBlcGmxM5u1toRevJ-nSg-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9ae0601d689so1087222666b.0 for ; Thu, 28 Sep 2023 05:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695904880; x=1696509680; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TEs40AJ4lM3j9ffIIAlvF9xgj3FRAy6IbL4eThz+ihA=; b=dPUyXaiER2Hfhvz40wtWp//+rIcV4bl3V0Y9z0DzcOELmDD5oK4aijp0z9hUSqGZr0 5tx4E3xxX3uQKBaCdMj1McMGlT9tFNmLRQbFLMpEzV6fmgz4Ad0/N/IXuxxSa7iJKfQh aFgL9Ny+6YUYckfdSIev6x5fSARE4LH3T5v7hhUhCraWJ+ldNfOqq7FuYkwIJOwjq744 ae24wHX7ZkeTBMa/e827pa1XVSXXDHX0Ffg5sA39tThnyEH68bVDQkFtYY036mMXRwiS zs3cI32iuhGEjHt77uhl0ONwm2n+TmmYvTT72/M23/lucU07oN2WF2f0hS93QJGon0mL XAdA== X-Gm-Message-State: AOJu0Yw/BSiI/b6nZYM0HQ8xyc0tlAgJ29nQFhWx6FeJObiUS8tXQvy2 TN1grmgOX/ECcgQYozGnzqIrQxwa5igXiwfyHUeh7vUgHmgn8VP3o3jwizrGzdQX6E3N54JdNzG KgQu4jhkGD46FbMmz6WJx+A1r X-Received: by 2002:a17:907:2e19:b0:9ae:1de:f4fb with SMTP id ig25-20020a1709072e1900b009ae01def4fbmr1021199ejc.46.1695904880750; Thu, 28 Sep 2023 05:41:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQrMMPDdnzZMDPC6CzY2Wn/lmJ+Y++1/fNcc2MkMjcM125ZfydcGSvD4w4OtcykeO+6t+gXA== X-Received: by 2002:a17:907:2e19:b0:9ae:1de:f4fb with SMTP id ig25-20020a1709072e1900b009ae01def4fbmr1021183ejc.46.1695904880436; Thu, 28 Sep 2023 05:41:20 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id qk8-20020a170906d9c800b009ad89697c86sm10937525ejb.144.2023.09.28.05.41.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:41:19 -0700 (PDT) Message-ID: Date: Thu, 28 Sep 2023 14:41:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 1/5] platform/x86: int3472: Add new skl_int3472_fill_gpiod_lookup() helper Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , 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 References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a new skl_int3472_fill_gpiod_lookup() helper. This is a preparation patch for removing usage of the deprecated gpiod_toggle_active_low() and acpi_get_and_request_gpiod() functions. Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/platform/x86/intel/int3472/discrete.c | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platfo= rm/x86/intel/int3472/discrete.c index e33c2d75975c..351ecf047944 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -52,21 +52,15 @@ static void skl_int3472_log_sensor_module_name(struct i= nt3472_discrete_device *i } } =20 -static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *= int3472, - struct acpi_resource_gpio *agpio, - const char *func, u32 polarity) +static int skl_int3472_fill_gpiod_lookup(struct gpiod_lookup *table_entry, + struct acpi_resource_gpio *agpio, + const char *func, u32 polarity) { char *path =3D agpio->resource_source.string_ptr; - struct gpiod_lookup *table_entry; struct acpi_device *adev; acpi_handle handle; acpi_status status; =20 - if (int3472->n_sensor_gpios >=3D INT3472_MAX_SENSOR_GPIOS) { - dev_warn(int3472->dev, "Too many GPIOs mapped\n"); - return -EINVAL; - } - status =3D acpi_get_handle(NULL, path, &handle); if (ACPI_FAILURE(status)) return -EINVAL; @@ -75,13 +69,31 @@ static int skl_int3472_map_gpio_to_sensor(struct int347= 2_discrete_device *int347 if (!adev) return -ENODEV; =20 - table_entry =3D &int3472->gpios.table[int3472->n_sensor_gpios]; table_entry->key =3D acpi_dev_name(adev); table_entry->chip_hwnum =3D agpio->pin_table[0]; table_entry->con_id =3D func; table_entry->idx =3D 0; table_entry->flags =3D polarity; =20 + return 0; +} + +static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *= int3472, + struct acpi_resource_gpio *agpio, + const char *func, u32 polarity) +{ + int ret; + + if (int3472->n_sensor_gpios >=3D INT3472_MAX_SENSOR_GPIOS) { + dev_warn(int3472->dev, "Too many GPIOs mapped\n"); + return -EINVAL; + } + + ret =3D skl_int3472_fill_gpiod_lookup(&int3472->gpios.table[int3472->n_se= nsor_gpios], + agpio, func, polarity); + if (ret) + return ret; + int3472->n_sensor_gpios++; =20 return 0; --=20 2.41.0 From nobody Tue Dec 16 20:14:54 2025 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 BDFF2E732C7 for ; Thu, 28 Sep 2023 12:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbjI1Mnt (ORCPT ); Thu, 28 Sep 2023 08:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbjI1Mnr (ORCPT ); Thu, 28 Sep 2023 08:43:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10846199 for ; Thu, 28 Sep 2023 05:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695904976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iIgaek/2vaj0JutvpQK/iD5J0G41ovSmgWF0taiXJOo=; b=ABnrU8gadb0LF5VFST68oT/RuNSM96XzrjGVavQwZAwyQuqyisMkamQbdSAvdoOBnQDdGT 97ChURdTQth5gbFu1W+zRLEXaGT52yVPaaT7DUZ4ipXvO+yUCLGIvZQOoFXyQ8fG+ASPuT u8NRBfMCVaNEP9bZqomYqCFSxiK+6XI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-Zxjyr6-RO4aPOY1GhBmHqw-1; Thu, 28 Sep 2023 08:42:54 -0400 X-MC-Unique: Zxjyr6-RO4aPOY1GhBmHqw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9f282713fso1074085066b.3 for ; Thu, 28 Sep 2023 05:42:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695904973; x=1696509773; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iIgaek/2vaj0JutvpQK/iD5J0G41ovSmgWF0taiXJOo=; b=gKUtgRse33qKzFGT5xSDByXGib9yCy2t5Bd52RrEIaGxLDblxM+MPym0rC15YjSa/M N4arZ8bn3xAWGZXoHsRKfX4ysgVZHsrN9iaQLz8mkTk6i7mpW1y0sV5ACfGYTu0E52SC nRfFKX++CXXqxfZG9y4cHXU20/wrkotXyxN1L9DYO1ob5It0/V1cXzo7ZFBgGxT0JeyK Vf74AOrcvp26xo21zkkX92fPlaoeGewTRPhnrO4Sme62s3qfQUMdqRLDvtBrgsf/ECzn IqUo5ZkMgVTfHxpsLmW1T6fE8DNwRb/2cGh8nQf8uQkgD59mbP+gXVYrJgrqNix1PfCc v/MA== X-Gm-Message-State: AOJu0Ywy3bTJ9kUfkovkPkn8vhUuTGeLCWzrsBLEa/95+r8iBVEAqwGy 5nJmkRTemC4RHKZGamOvz65NzTPc1eBHfyrU2M1BPQGNCKhVNW5SIURrQoRBkUCY1X8vgQBA0i/ iFf0S+xOy2e9rfiCpQhBrvfCa X-Received: by 2002:a17:906:209e:b0:9a5:874a:9745 with SMTP id 30-20020a170906209e00b009a5874a9745mr1015779ejq.26.1695904973509; Thu, 28 Sep 2023 05:42:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlywnIyNYShfOZQqUKF/nPnEpW/BE9ULWRGFQaKFsFKQmtPIGivvU6o7bT5pQ/APNJZdsd4A== X-Received: by 2002:a17:906:209e:b0:9a5:874a:9745 with SMTP id 30-20020a170906209e00b009a5874a9745mr1015758ejq.26.1695904973121; Thu, 28 Sep 2023 05:42:53 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id bv13-20020a170906b1cd00b00993a37aebc5sm10864511ejb.50.2023.09.28.05.42.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:42:52 -0700 (PDT) Message-ID: Date: Thu, 28 Sep 2023 14:42:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 2/5] platform/x86: int3472: Add new skl_int3472_gpiod_get_from_temp_lookup() helper Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , 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 References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a new skl_int3472_gpiod_get_from_temp_lookup() helper. This is a preparation patch for removing usage of the deprecated gpiod_toggle_active_low() and acpi_get_and_request_gpiod() functions. Signed-off-by: Bartosz Golaszewski [hdegoede@redhat.com] use the new skl_int3472_fill_gpiod_lookup() helper Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko --- drivers/platform/x86/intel/int3472/discrete.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platfo= rm/x86/intel/int3472/discrete.c index 351ecf047944..a46c3a206aa3 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -99,6 +99,32 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472= _discrete_device *int347 return 0; } =20 +/* This should *really* only be used when there's no other way... */ +static struct gpio_desc * +skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int= 3472, + struct acpi_resource_gpio *agpio, + const char *func, u32 polarity) +{ + struct gpio_desc *desc; + int ret; + + 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(int3472->dev); + ret =3D skl_int3472_fill_gpiod_lookup(&lookup->table[0], agpio, func, pol= arity); + if (ret) + return ERR_PTR(ret); + + gpiod_add_lookup_table(lookup); + desc =3D gpiod_get(int3472->dev, func, GPIOD_OUT_LOW); + gpiod_remove_lookup_table(lookup); + + return desc; +} + static void int3472_get_func_and_polarity(u8 type, const char **func, u32 = *polarity) { switch (type) { --=20 2.41.0 From nobody Tue Dec 16 20:14:54 2025 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 EA060E732CA for ; Thu, 28 Sep 2023 12:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232536AbjI1Mox (ORCPT ); Thu, 28 Sep 2023 08:44:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232527AbjI1Mov (ORCPT ); Thu, 28 Sep 2023 08:44:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA8111AC for ; Thu, 28 Sep 2023 05:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695905043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8cRziQNlPKsMBts0e+fMBLBJc4tPpGB3qzVuhcHy5Uc=; b=LmeobCqL4Jc/c1JiVxTDAe3xqNRNxlC4FDni4obcp9Z9xz7uE0QVHxrWrMJ3eCFu/oroVJ eTjADqruPRFSfmDy/USneEt/Y91xw6C+inBC4e6lYxKQe+aCQK6e+/mIQILrIfrRN3gdh2 DhAuDsRd9XeHVggB0kR4ZutJ3Q565p8= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-6NPC6pSFNTujuegbjJkw3Q-1; Thu, 28 Sep 2023 08:44:02 -0400 X-MC-Unique: 6NPC6pSFNTujuegbjJkw3Q-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9b2c1159b0aso68154466b.3 for ; Thu, 28 Sep 2023 05:44:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695905041; x=1696509841; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8cRziQNlPKsMBts0e+fMBLBJc4tPpGB3qzVuhcHy5Uc=; b=N+qy4P4im35zhNI0m1fJOPsESeBDzPkYkBT0xDxTsXriaX6Cs0znGWqiIKeCDnhKDV d25YLV6IbZPB7aOIneGIpoyzvcygyvfX73+NnJ+eTdcb7Xa5Y8qLz5HfFzBw+BHKmoHA bWmSOd1c9QhYfo8QzWZauqKSRV2eVThuBDhb1F9RGYOJajmwvwlb7mvj57KMcf8kZxsP m7qWkjfWPNPyUHXWcIiRul+vAprO6H50mifRW7+i/3IA0uxWLOIZR0RYxTPhPX8x4rKZ 5VtEJPa3/KB5glif0K7ChDyFTkpn6FMCmBkTToY1WlKPDdmOoR5aLdLtHURW5dWF7GEE b2kQ== X-Gm-Message-State: AOJu0YzJPbgKzQph4YwW3LE0GwQNI6eDTiF0MUUR74cmqNvfrD+r8Jk1 Zchfs4hyaD3R+XJKOyTKB7QbMKER4/FU1EuLPDwBVn6WCWIa/gAzSUzQdIMVZIk3TgA8N4leNMB OyLMj6NXOXkLrKdLE6kZ9lXV2 X-Received: by 2002:a17:907:2711:b0:9b2:6b4f:d5ab with SMTP id w17-20020a170907271100b009b26b4fd5abmr1171176ejk.29.1695905041266; Thu, 28 Sep 2023 05:44:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7zHVVtnXYAXKuMFhQ2h0p1jaG2SWEPqMGqXqvP8oQE1dSqZqqZ7+P9rXflTUJMO/VnuodKA== X-Received: by 2002:a17:907:2711:b0:9b2:6b4f:d5ab with SMTP id w17-20020a170907271100b009b26b4fd5abmr1171148ejk.29.1695905040862; Thu, 28 Sep 2023 05:44:00 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id g27-20020a170906349b00b0099bc0daf3d7sm10741780ejb.182.2023.09.28.05.43.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:44:00 -0700 (PDT) Message-ID: <64a5c0ff-bb63-15ac-1c06-182296e7f6dd@redhat.com> Date: Thu, 28 Sep 2023 14:43:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 3/5] platform/x86: int3472: Stop using gpiod_toggle_active_low() Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , 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 References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new skl_int3472_gpiod_get_from_temp_lookup() helper to get a gpio to pass to register_gpio_clock(), skl_int3472_register_regulator() and skl_int3472_register_pled(). This removes all use of the deprecated gpiod_toggle_active_low() and acpi_get_and_request_gpiod() functions. Suggested-by: Bartosz Golaszewski Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko --- .../x86/intel/int3472/clk_and_regulator.c | 31 ++----------- drivers/platform/x86/intel/int3472/common.h | 7 ++- drivers/platform/x86/intel/int3472/discrete.c | 43 +++++++++++++------ drivers/platform/x86/intel/int3472/led.c | 17 ++------ 4 files changed, 40 insertions(+), 58 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..459f96c04ca1 100644 --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c @@ -162,9 +162,8 @@ int skl_int3472_register_dsm_clock(struct int3472_discr= ete_device *int3472) } =20 int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int347= 2, - struct acpi_resource_gpio *agpio, u32 polarity) + struct gpio_desc *gpio) { - char *path =3D agpio->resource_source.string_ptr; struct clk_init_data init =3D { .ops =3D &skl_int3472_clock_ops, .flags =3D CLK_GET_RATE_NOCACHE, @@ -174,19 +173,7 @@ int skl_int3472_register_gpio_clock(struct int3472_dis= crete_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"); - 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"); - } - - 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); + int3472->clock.ena_gpio =3D gpio; =20 init.name =3D kasprintf(GFP_KERNEL, "%s-clk", acpi_dev_name(int3472->adev)); @@ -273,9 +260,8 @@ static const struct dmi_system_id skl_int3472_regulator= _second_sensor[] =3D { }; =20 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, - struct acpi_resource_gpio *agpio) + struct gpio_desc *gpio) { - char *path =3D agpio->resource_source.string_ptr; struct regulator_init_data init_data =3D { }; struct regulator_config cfg =3D { }; const char *second_sensor =3D NULL; @@ -314,16 +300,7 @@ int skl_int3472_register_regulator(struct int3472_disc= rete_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"); - 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"); - } - - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->regulator.gpio, 0); + int3472->regulator.gpio =3D gpio; =20 cfg.dev =3D &int3472->adev->dev; cfg.init_data =3D &init_data; diff --git a/drivers/platform/x86/intel/int3472/common.h b/drivers/platform= /x86/intel/int3472/common.h index 9f29baa13860..145dec66df64 100644 --- a/drivers/platform/x86/intel/int3472/common.h +++ b/drivers/platform/x86/intel/int3472/common.h @@ -117,16 +117,15 @@ int skl_int3472_get_sensor_adev_and_name(struct devic= e *dev, const char **name_ret); =20 int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int347= 2, - struct acpi_resource_gpio *agpio, u32 polarity); + struct gpio_desc *gpio); int skl_int3472_register_dsm_clock(struct int3472_discrete_device *int3472= ); void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472); =20 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, - struct acpi_resource_gpio *agpio); + struct gpio_desc *gpio); void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3= 472); =20 -int skl_int3472_register_pled(struct int3472_discrete_device *int3472, - struct acpi_resource_gpio *agpio, u32 polarity); +int skl_int3472_register_pled(struct int3472_discrete_device *int3472, str= uct gpio_desc *gpio); void skl_int3472_unregister_pled(struct int3472_discrete_device *int3472); =20 #endif diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platfo= rm/x86/intel/int3472/discrete.c index a46c3a206aa3..eb0cded5b92a 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -194,6 +194,7 @@ static int skl_int3472_handle_gpio_resources(struct acp= i_resource *ares, struct acpi_resource_gpio *agpio; u8 active_value, pin, type; union acpi_object *obj; + struct gpio_desc *gpio; const char *err_msg; const char *func; u32 polarity; @@ -244,22 +245,38 @@ static int skl_int3472_handle_gpio_resources(struct a= cpi_resource *ares, =20 break; case INT3472_GPIO_TYPE_CLK_ENABLE: - ret =3D skl_int3472_register_gpio_clock(int3472, agpio, polarity); - if (ret) - err_msg =3D "Failed to register clock\n"; - - break; case INT3472_GPIO_TYPE_PRIVACY_LED: - ret =3D skl_int3472_register_pled(int3472, agpio, polarity); - if (ret) - err_msg =3D "Failed to register LED\n"; - - break; case INT3472_GPIO_TYPE_POWER_ENABLE: - ret =3D skl_int3472_register_regulator(int3472, agpio); - if (ret) - err_msg =3D "Failed to map regulator to sensor\n"; + gpio =3D skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, func, po= larity); + if (IS_ERR(gpio)) { + ret =3D PTR_ERR(gpio); + err_msg =3D "Failed to get GPIO\n"; + break; + } =20 + switch (type) { + case INT3472_GPIO_TYPE_CLK_ENABLE: + ret =3D skl_int3472_register_gpio_clock(int3472, gpio); + if (ret) + err_msg =3D "Failed to register clock\n"; + + break; + case INT3472_GPIO_TYPE_PRIVACY_LED: + ret =3D skl_int3472_register_pled(int3472, gpio); + if (ret) + err_msg =3D "Failed to register LED\n"; + + break; + case INT3472_GPIO_TYPE_POWER_ENABLE: + ret =3D skl_int3472_register_regulator(int3472, gpio); + if (ret) + err_msg =3D "Failed to map regulator to sensor\n"; + + break; + default: /* Never reached */ + ret =3D -EINVAL; + break; + } break; default: dev_warn(int3472->dev, diff --git a/drivers/platform/x86/intel/int3472/led.c b/drivers/platform/x8= 6/intel/int3472/led.c index bca1ce7d0d0c..476cd637fc51 100644 --- a/drivers/platform/x86/intel/int3472/led.c +++ b/drivers/platform/x86/intel/int3472/led.c @@ -16,26 +16,15 @@ static int int3472_pled_set(struct led_classdev *led_cd= ev, return 0; } =20 -int skl_int3472_register_pled(struct int3472_discrete_device *int3472, - struct acpi_resource_gpio *agpio, u32 polarity) +int skl_int3472_register_pled(struct int3472_discrete_device *int3472, str= uct gpio_desc *gpio) { - char *p, *path =3D agpio->resource_source.string_ptr; + char *p; int ret; =20 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"); - if (IS_ERR(int3472->pled.gpio)) - return dev_err_probe(int3472->dev, PTR_ERR(int3472->pled.gpio), - "getting privacy LED GPIO\n"); - - 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); + int3472->pled.gpio =3D gpio; =20 /* Generate the name, replacing the ':' in the ACPI devname with '_' */ snprintf(int3472->pled.name, sizeof(int3472->pled.name), --=20 2.41.0 From nobody Tue Dec 16 20:14:54 2025 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 0893EE732CA for ; Thu, 28 Sep 2023 12:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232558AbjI1Mpx (ORCPT ); Thu, 28 Sep 2023 08:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbjI1Mpv (ORCPT ); Thu, 28 Sep 2023 08:45:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D41BA191 for ; Thu, 28 Sep 2023 05:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695905103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/ZJst60DtOTAcHM/+YWWARhoXyKu+0XsCA0kzc+cFAY=; b=La8hgH+wm8PNysOZie+g+sSzH/3WkhUSQd7cvjUdVBDyy/3hhMx4ib7bP2tALPh0U3B6bN fDJDNMbiyDSS4fMZ+RIOtnTIGOmFknmkzmNCLL7e3y8nUExm0aWXy8eqI+fDRrJVoLQDjF Sq4uHyl/YyjgBoyf9NNzGNjNOu+Ww3E= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-8-3pv7yzPmyhiVK7Qqxhmg-1; Thu, 28 Sep 2023 08:45:01 -0400 X-MC-Unique: 8-3pv7yzPmyhiVK7Qqxhmg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-993d7ca4607so1104811866b.1 for ; Thu, 28 Sep 2023 05:45:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695905100; x=1696509900; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/ZJst60DtOTAcHM/+YWWARhoXyKu+0XsCA0kzc+cFAY=; b=pyvXCTkjve2/0IH7zWepbYQFMWZ52aqSdv9s9R/7m+TUVdVs7lqpqiPgRVYIEN8ZDK CCP9D5zgawAsyxdOcBDdXTOJnDY38qGCx5Xc3MCwxi7GaV1TeP+Jtz785HEvJqwXbVk0 zQBvi3/aNdYZiphVvnlkvlruvM+sW+zfUNjbuHEcV16FwFXxJlJUD/9bCbUMAiJiCN99 Ma96cTxSXzH3hvYBPYbbnoFUSdaixxNO1kld7MUvpW0TiGCE2Ck05KBLxR9NKDpkKD8c UyiSz3FwHlmx4LipUSkttjMGm/2vlQ8LS7faE5f1Xah/QKdeMDE2Q+zikQAs1Dn/iCho K6mw== X-Gm-Message-State: AOJu0Yw9YdXE8qFveXMAGRoxabjXwC5wXTvzi4+U7INFt299iuvrlgtt C79DPdMiLUi5R/rVpcBp8iqGXIKaLPOvAhQojHs/W+Kz8jlKGY/c37zKBQXhZx/lkOmAHXT5eka nzGj3UgS53OtbVK4um4IWPwEZ X-Received: by 2002:a17:906:cc53:b0:9b2:8df4:c692 with SMTP id mm19-20020a170906cc5300b009b28df4c692mr1366418ejb.27.1695905100591; Thu, 28 Sep 2023 05:45:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBWHwp7nkBmFn/W7pmHIIzcfB55rotTWDT0eMe3PWuqOnoH9kN78RUdFR8Q28Hzep+vmDFMw== X-Received: by 2002:a17:906:cc53:b0:9b2:8df4:c692 with SMTP id mm19-20020a170906cc5300b009b28df4c692mr1366399ejb.27.1695905100238; Thu, 28 Sep 2023 05:45:00 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id e8-20020a170906374800b0099cf840527csm10849655ejc.153.2023.09.28.05.44.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:44:59 -0700 (PDT) Message-ID: Date: Thu, 28 Sep 2023 14:44:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 4/5] platform/x86: int3472: Switch to devm_get_gpiod() Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , 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 References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Switch to devm_get_gpiod() for discrete GPIOs for clks / regulators / LEDs and let devm do the cleanup for us. Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko --- .../x86/intel/int3472/clk_and_regulator.c | 23 ++++--------------- drivers/platform/x86/intel/int3472/discrete.c | 2 +- drivers/platform/x86/intel/int3472/led.c | 7 +----- 3 files changed, 6 insertions(+), 26 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 459f96c04ca1..16e36ac0a7b4 100644 --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c @@ -177,10 +177,8 @@ int skl_int3472_register_gpio_clock(struct int3472_dis= crete_device *int3472, =20 init.name =3D kasprintf(GFP_KERNEL, "%s-clk", acpi_dev_name(int3472->adev)); - if (!init.name) { - ret =3D -ENOMEM; - goto out_put_gpio; - } + if (!init.name) + return -ENOMEM; =20 int3472->clock.frequency =3D skl_int3472_get_clk_frequency(int3472); =20 @@ -206,8 +204,6 @@ int skl_int3472_register_gpio_clock(struct int3472_disc= rete_device *int3472, clk_unregister(int3472->clock.clk); out_free_init_name: kfree(init.name); -out_put_gpio: - gpiod_put(int3472->clock.ena_gpio); =20 return ret; } @@ -219,7 +215,6 @@ void skl_int3472_unregister_clock(struct int3472_discre= te_device *int3472) =20 clkdev_drop(int3472->clock.cl); clk_unregister(int3472->clock.clk); - gpiod_put(int3472->clock.ena_gpio); } =20 /* @@ -266,7 +261,7 @@ int skl_int3472_register_regulator(struct int3472_discr= ete_device *int3472, struct regulator_config cfg =3D { }; const char *second_sensor =3D NULL; const struct dmi_system_id *id; - int i, j, ret; + int i, j; =20 id =3D dmi_first_match(skl_int3472_regulator_second_sensor); if (id) @@ -309,21 +304,11 @@ int skl_int3472_register_regulator(struct int3472_dis= crete_device *int3472, int3472->regulator.rdev =3D regulator_register(int3472->dev, &int3472->regulator.rdesc, &cfg); - if (IS_ERR(int3472->regulator.rdev)) { - ret =3D PTR_ERR(int3472->regulator.rdev); - goto err_free_gpio; - } =20 - return 0; - -err_free_gpio: - gpiod_put(int3472->regulator.gpio); - - return ret; + return PTR_ERR_OR_ZERO(int3472->regulator.rdev); } =20 void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3= 472) { regulator_unregister(int3472->regulator.rdev); - gpiod_put(int3472->regulator.gpio); } diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platfo= rm/x86/intel/int3472/discrete.c index eb0cded5b92a..8171b16882b7 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -119,7 +119,7 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_d= iscrete_device *int3472, return ERR_PTR(ret); =20 gpiod_add_lookup_table(lookup); - desc =3D gpiod_get(int3472->dev, func, GPIOD_OUT_LOW); + desc =3D devm_gpiod_get(int3472->dev, func, GPIOD_OUT_LOW); gpiod_remove_lookup_table(lookup); =20 return desc; diff --git a/drivers/platform/x86/intel/int3472/led.c b/drivers/platform/x8= 6/intel/int3472/led.c index 476cd637fc51..9cbed694e2ca 100644 --- a/drivers/platform/x86/intel/int3472/led.c +++ b/drivers/platform/x86/intel/int3472/led.c @@ -39,7 +39,7 @@ int skl_int3472_register_pled(struct int3472_discrete_dev= ice *int3472, struct gp =20 ret =3D led_classdev_register(int3472->dev, &int3472->pled.classdev); if (ret) - goto err_free_gpio; + return ret; =20 int3472->pled.lookup.provider =3D int3472->pled.name; int3472->pled.lookup.dev_id =3D int3472->sensor_name; @@ -47,10 +47,6 @@ int skl_int3472_register_pled(struct int3472_discrete_de= vice *int3472, struct gp led_add_lookup(&int3472->pled.lookup); =20 return 0; - -err_free_gpio: - gpiod_put(int3472->pled.gpio); - return ret; } =20 void skl_int3472_unregister_pled(struct int3472_discrete_device *int3472) @@ -60,5 +56,4 @@ void skl_int3472_unregister_pled(struct int3472_discrete_= device *int3472) =20 led_remove_lookup(&int3472->pled.lookup); led_classdev_unregister(&int3472->pled.classdev); - gpiod_put(int3472->pled.gpio); } --=20 2.41.0 From nobody Tue Dec 16 20:14:54 2025 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 A77E8E732C7 for ; Thu, 28 Sep 2023 12:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbjI1Mqk (ORCPT ); Thu, 28 Sep 2023 08:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232514AbjI1Mqh (ORCPT ); Thu, 28 Sep 2023 08:46:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E002D1B0 for ; Thu, 28 Sep 2023 05:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695905157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ACdKckhs2IGUtv5AveDwU/IL9fYWvBeI2aPkdMd1dhI=; b=DSQY5BTLdfcwI5qb2dk3MHNeyooYqDVH4RTZU8vN8xeMwpDYGhkkq3WYbMYqxKn1hApip3 zycOWVWi97P/U4PpzlKtcefyTCRQJI0XXDIDjfH0Ls9OzSQSE8GqFvgXQfN89+1pLOqDbC mh6/OXbc1tzyFR8jztJrfbw1dcDKoQQ= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-wFRXiqBZP6iloEPlFgOSug-1; Thu, 28 Sep 2023 08:45:55 -0400 X-MC-Unique: wFRXiqBZP6iloEPlFgOSug-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9a9d7a801a3so1128204866b.2 for ; Thu, 28 Sep 2023 05:45:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695905154; x=1696509954; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ACdKckhs2IGUtv5AveDwU/IL9fYWvBeI2aPkdMd1dhI=; b=UErEfsWGtQMgzhCvBmSSB/MUIcxSE1bqSlAJuGM9DWRAkIfOPaXAKgH5Y9hCa44H0D rQQFNzPyxaTvrEUSTxy0ZLIsWeR4FtkaOH7Q7rpGpKdci7lq7AfSQQyfWPYXE8Wlyb6t HDtinJfPFpNz6bCPqeqpdfdmeC4J2AZxfA6IuCs6bagwAk0mXExUXYfkqVVRQSjdViOa Jf1IYJndqyvozzS3jpUeFuPAzL+DZEs7TBot+2OhWhQOqAm8uHHww1eyn9DOXG4tKFeV ecr/lgXNniD4b/eNOPggR7v9XXW0aJVNxXD0+SGpZwlzQ2hVCFGuGU/hk7WDDxncfJ8f 3dQg== X-Gm-Message-State: AOJu0Yyo7JZj2bW80Aa1dBChpAbAtW8M+l2A/KkzDgSvz5FS9qRes+uy wD+wvw2rhOJF+HrXsUqFQ9yKUbQw0NBRadtbchZg3twlwY44LmWq+wjTcrDab9gAPwocOwy3lES vcN33SulpP+KRh/Pyzr0N4bCk X-Received: by 2002:a17:906:3150:b0:9ae:696c:2c43 with SMTP id e16-20020a170906315000b009ae696c2c43mr1183240eje.28.1695905154402; Thu, 28 Sep 2023 05:45:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQnYwpJz4FRm5OEctCUqntpuOgB3RgSDa5zxu4Q3oNPpnc3WMFQcTzGCzOVBYL6EaWeUHW8A== X-Received: by 2002:a17:906:3150:b0:9ae:696c:2c43 with SMTP id e16-20020a170906315000b009ae696c2c43mr1183223eje.28.1695905154189; Thu, 28 Sep 2023 05:45:54 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id lw13-20020a170906bccd00b0098884f86e41sm10683387ejb.123.2023.09.28.05.45.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:45:53 -0700 (PDT) Message-ID: <93be52fc-fa87-423f-dde2-1b0b758ab632@redhat.com> Date: Thu, 28 Sep 2023 14:45:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 5/5] gpio: acpi: remove acpi_get_and_request_gpiod() Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , 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 References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" With no more users, we can remove acpi_get_and_request_gpiod(). Signed-off-by: Bartosz Golaszewski Link: https://lore.kernel.org/r/20230926145943.42814-5-brgl@bgdev.pl Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko --- 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 1c4385a00f88..9d1f598b8971 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -614,8 +614,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 @@ -633,12 +631,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.41.0