Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3249549rdh; Thu, 28 Sep 2023 06:54:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0kusopp/iNdLoQ+p85o2tQOJRv/qVoG6yNkBNOQkl6ovfg7RS/5ehScJWX9i9vqcEAdO3 X-Received: by 2002:a0d:d587:0:b0:59c:a78:201 with SMTP id x129-20020a0dd587000000b0059c0a780201mr1182813ywd.7.1695909242069; Thu, 28 Sep 2023 06:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695909242; cv=none; d=google.com; s=arc-20160816; b=jYIkjEhWIFvsXTADLBL+6reMRTDjYOsmk6a0O29Z7yf440/JIpyglBRjPX/DpCThUj aialgu9a6Cfcd2GP8XpjjNsxQmN/hbvnzY0Sn0fRX+tDuUneEr1AqyuFgwlMNx0e6VKa F9OOOtM2Z9aYvMz1c3NSsoTpc4+kEqbbuYqvfC/EPyL+mxDjXWZfLWfyeWQeaM050eky WJ/8EjOHp2GL3A5wS0X5yB0WK4I8BcN20NTV/54Ehl3U5wpboWLS+mSW6rI/Y4ou2PV4 ivKqxUGyS63R/dS/qSjqW5Tk7RuRn91p2QHi2zD29QVQigRFuKXFO2PR1kTdxd3S7/wd pjUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=TEs40AJ4lM3j9ffIIAlvF9xgj3FRAy6IbL4eThz+ihA=; fh=+J1tU8mYRS0tAzYCer2u4MwX4DmdoEjH6cAcxs8XMyc=; b=e/UCZkwu5LEZDqgkCqWbQw7xuwkT5lkw18Y/AwBo6Mzqtf05JwBdMo5Uae3eTFXdDq rp+a0S5msV+Dnxy23guh7hE9hh6YSfe3tA1t4VJ3jQ7omCn3qCGp0Otyovs/0fQkWQES UYKOcqPGRsO03UmpXioc8MknivRoJpcGSxoefC4Cz8u0OwstYOX+UE2oiiJEOK24s84N ZcM8OU9Hr1MaaThdf8s68hFAhmS4khBhvQ6/FEPO9+SlNbOmy7TwJviZjyPaKZyhILNn PU4U+eLepmZK8ZzCOAIfl2Xo5gA81CSqxLuVtA3E9P7YiMnHJRyDVODZxPGUmz3Y8/7k 4C0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VLn0JNEG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id o24-20020a639218000000b005641ddd0309si6619624pgd.599.2023.09.28.06.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 06:54:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VLn0JNEG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 29C7D8374AF8; Thu, 28 Sep 2023 05:42:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232490AbjI1MmP (ORCPT + 99 others); Thu, 28 Sep 2023 08:42:15 -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-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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 05:42:35 -0700 (PDT) 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 --- 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/platform/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 int3472_discrete_device *i } } -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 = agpio->resource_source.string_ptr; - struct gpiod_lookup *table_entry; struct acpi_device *adev; acpi_handle handle; acpi_status status; - if (int3472->n_sensor_gpios >= INT3472_MAX_SENSOR_GPIOS) { - dev_warn(int3472->dev, "Too many GPIOs mapped\n"); - return -EINVAL; - } - status = 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 int3472_discrete_device *int347 if (!adev) return -ENODEV; - table_entry = &int3472->gpios.table[int3472->n_sensor_gpios]; table_entry->key = acpi_dev_name(adev); table_entry->chip_hwnum = agpio->pin_table[0]; table_entry->con_id = func; table_entry->idx = 0; table_entry->flags = polarity; + 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 >= INT3472_MAX_SENSOR_GPIOS) { + dev_warn(int3472->dev, "Too many GPIOs mapped\n"); + return -EINVAL; + } + + ret = skl_int3472_fill_gpiod_lookup(&int3472->gpios.table[int3472->n_sensor_gpios], + agpio, func, polarity); + if (ret) + return ret; + int3472->n_sensor_gpios++; return 0; -- 2.41.0