From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33167C433B4 for ; Fri, 21 May 2021 12:08:31 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9ACF613D6 for ; Fri, 21 May 2021 12:08:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9ACF613D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ie8lOcOlxdInxbDnXBrY9QWzpjfOxbOq+ftWELWyJdw=; b=JrzkrimGsbFahqlEJLeDnGrmRg bygkCO88RFWzr/Dso/tKGMrYMBrniG3x82AVCXm/a6sSs5p4RwJ5HziHtoagIx4+s7jUkT6pCxg4m M1I8LZGGRrYwkSAQ3JPEDdlgoOdJ8ZwmnhgxgayMqDP6rOu/2md/Dxlwlp23rsFdl2i/yp0NoFejs gNp1c0249flZ/Ar1SUzJRXbufnJ+pdfosebyn28is5RH7OaKsL3E9+0AeKbaguN8dWt0UVEX5+BqM uRBlGcHe6vMZYU9DhrASsoZe+ieVmG9iBsV2qMqIM1L572gK5njUOtaWZb1nAh3aboDz99Scukeiu o0r6Atxw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk3uZ-005GK7-Vm; Fri, 21 May 2021 12:05:52 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk3uW-005GJi-BW for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 12:05:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XURLRJlEgoxUDbsLTjwEevkIiCMROFD2WQNVJIIDblA=; b=Rl002G6Pl8IHPAu+VyxsTyJHNY MiBfvOXaO2jUIFmdxGunM9oVFyahK0URiO44BRPkb1wuGD3S6ZBQIUQkj7svAcFH1jzXzgC2ck09V Q8LukpqG0hhd1OZmxZ28KJURZ9rgNnH3nCcElwHvtqA5N1423+pFDvc3sQfSMBevGqEhfzuJ3vcSp fL6+sUnNetag+iwG30MiJ6LPB2hwkwVZQxwhUEwjqbrxHhJZCFzekRyMK5NXteUWR7JW6Hc2cpTSt 85Pj2yo1xcZw55cjELDeKdkdPCIbpMr0OEmmSR2MD0ijHpnv3rx+y4Jmsf+Ju6cr3pvc4cydQ+n6V m0LK86vA==; Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lk3uT-00H5R0-Qt for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 12:05:47 +0000 IronPort-SDR: hqGrG1RnHyJO2m9gK059Bd1+e3Dg4oCCgVdGwT9pHQmy5rWavfoTmK0cF9crYDgGk8E2W782yc t6f1eeFPypbg== X-IronPort-AV: E=McAfee;i="6200,9189,9990"; a="181079799" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="181079799" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2021 05:05:44 -0700 IronPort-SDR: skltu30wB3m4YBEmmxugcZS/7efbrFzfmy7vEJWDiA5Ulgds4Dh/57hl0FKBNHSYjOP8j45TdU cNmQBuSDYeMA== X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="545366534" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2021 05:05:39 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lk3uJ-00Dhdw-St; Fri, 21 May 2021 15:05:35 +0300 Date: Fri, 21 May 2021 15:05:35 +0300 From: Andy Shevchenko To: Daniel Scally Cc: "Rafael J . Wysocki" , Wolfram Sang , Lee Jones , Hans de Goede , Maximilian Luz , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, platform-driver-x86@vger.kernel.org, devel@acpica.org, Len Brown , Mika Westerberg , Russell King , Linus Walleij , Bartosz Golaszewski , Mark Gross , Robert Moore , Erik Kaneda , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: Re: [PATCH v4 6/8] gpiolib: acpi: Add acpi_gpio_get_io_resource() Message-ID: References: <20210520140928.3252671-1-djrscally@gmail.com> <20210520140928.3252671-7-djrscally@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210520140928.3252671-7-djrscally@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_050545_910135_9F58BF40 X-CRM114-Status: GOOD ( 19.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 20, 2021 at 03:09:26PM +0100, Daniel Scally wrote: > Add a function to verify that a given acpi_resource represents an IO > type GPIO resource, and return it if so. Reviewed-by: Andy Shevchenko > Signed-off-by: Daniel Scally > --- > Changes since v3: > - Patch introduced > > drivers/gpio/gpiolib-acpi.c | 23 +++++++++++++++++++++++ > include/linux/acpi.h | 7 +++++++ > 2 files changed, 30 insertions(+) > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > index 684ddb35d83b..9887bb684575 100644 > --- a/drivers/gpio/gpiolib-acpi.c > +++ b/drivers/gpio/gpiolib-acpi.c > @@ -196,6 +196,29 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, > } > EXPORT_SYMBOL_GPL(acpi_gpio_get_irq_resource); > > +/** > + * acpi_gpio_get_io_resource - Fetch details of an ACPI resource if it is a GPIO > + * I/O resource or return False if not. > + * @ares: Pointer to the ACPI resource to fetch > + * @agpio: Pointer to a &struct acpi_resource_gpio to store the output pointer > + */ > +bool acpi_gpio_get_io_resource(struct acpi_resource *ares, > + struct acpi_resource_gpio **agpio) > +{ > + struct acpi_resource_gpio *gpio; > + > + if (ares->type != ACPI_RESOURCE_TYPE_GPIO) > + return false; > + > + gpio = &ares->data.gpio; > + if (gpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_IO) > + return false; > + > + *agpio = gpio; > + return true; > +} > +EXPORT_SYMBOL_GPL(acpi_gpio_get_io_resource); > + > static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio, > struct acpi_gpio_event *event) > { > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 170b9bebdb2b..e8ba7063c000 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -1098,6 +1098,8 @@ void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const c > #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) > bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, > struct acpi_resource_gpio **agpio); > +bool acpi_gpio_get_io_resource(struct acpi_resource *ares, > + struct acpi_resource_gpio **agpio); > int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index); > #else > static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, > @@ -1105,6 +1107,11 @@ static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, > { > return false; > } > +static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares, > + struct acpi_resource_gpio **agpio) > +{ > + return false; > +} > static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, > const char *name, int index) > { > -- > 2.25.1 > -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel