Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5016281imm; Tue, 7 Aug 2018 11:07:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpda98qie6+kUWZomoAbx8V4/brxjWTWKFjyl1uF0K84dISvUQHVPRzDHRJTlCBzxESYjACM X-Received: by 2002:a17:902:a987:: with SMTP id bh7-v6mr8680311plb.182.1533665268398; Tue, 07 Aug 2018 11:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533665268; cv=none; d=google.com; s=arc-20160816; b=bb2LyEypL7/7IozJqpQ+1Dqs4WEcLT3dnA4bRyWT/RrklKrYMbsU1cURSNspK5d80T NfjRGEksuJy2eYD7wdTftpbht1ZgL7h/qCceouon2tzqfXGwv84Hz+kK1WT/1pdyXA1F NeDobUXkLEYjd24V/T+Zo2BW6cPh8qAU5ygHQqB+vaR7wLgP0NM7SjMoa1Gmpf1TOi05 5rjigI1H/hUEv3DQU8ga8g5M0Ts6oU5rGxJrZ0W6whYQlXEvY0j88V2PV31piglmLfhd +7KtVusd6bE3ONQ4IckE7+mo8/sxEsHsSBNmZwPPg7LxWJWa2KeCNhsIkstNssPObro+ zwhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Xz+t3nhEW6GYF9Xg0chBFv32OjgECdgSsjXBjmCG5xk=; b=QuiuXtubMMRXYMhthmhnUgiA3V04muMO2uOJHqu35AxomEnZbxZiRRpLcINZT2aGrq BSSgjHzU55ZeFOp4/KXsVvDZS0SrHx4opSw1gh3U1t+fXHhxUQyzF3cJCrZ2nlupdFEI vfAojsnP67ip8Fq54K/+7nrXtS0GsF9KO4V/Kte2d60762sDj3VWr0M+bpkbN1L6G2tR 2u/Q3sy+Dgbu1bxnJln/zKM2u7So6Qv9+j8RtznopNprmQgkl6tnqFzKamp3swa4yMZ1 XJ4GikAX9RT+iDvcGGWAQpQLc3AJTNicRUNs+Ytymx774G1HNZfw0OvcSTDgVX84Ain4 S5gA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si1496528plg.260.2018.08.07.11.07.32; Tue, 07 Aug 2018 11:07:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390144AbeHGTaA (ORCPT + 99 others); Tue, 7 Aug 2018 15:30:00 -0400 Received: from mail.bootlin.com ([62.4.15.54]:37061 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390121AbeHGTaA (ORCPT ); Tue, 7 Aug 2018 15:30:00 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 080D5209D9; Tue, 7 Aug 2018 19:14:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id C5A4E20799; Tue, 7 Aug 2018 19:14:19 +0200 (CEST) Date: Tue, 7 Aug 2018 19:14:20 +0200 From: Boris Brezillon To: Janusz Krzysztofik Cc: Linus Walleij , Jonathan Corbet , Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Tony Lindgren , Aaro Koskinen , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-doc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 09/12] gpiolib: Identify GPIO descriptor arrays with direct mapping Message-ID: <20180807191420.04431e8e@bbrezillon> In-Reply-To: <20180806222918.12644-10-jmkrzyszt@gmail.com> References: <20180718235710.18242-1-jmkrzyszt@gmail.com> <20180806222918.12644-1-jmkrzyszt@gmail.com> <20180806222918.12644-10-jmkrzyszt@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Aug 2018 00:29:15 +0200 Janusz Krzysztofik wrote: > Certain GPIO array lookup results may map directly to GPIO pins of a > single GPIO chip in hardware order. If that condition is recognized > and handled efficiently, significant performance gain of get/set array > functions may be possible. > > While processing a request for an array of GPIO descriptors, verify if > the descriptors just collected represent consecutive pins of a single > GPIO chip. Pass that information with the array to the caller so it > can benefit from enhanced performance as soon as bitmap based get/set > array functions which can make efficient use of that are available. > > Signed-off-by: Janusz Krzysztofik > --- > Documentation/driver-api/gpio/consumer.rst | 4 +++- > drivers/gpio/gpiolib.c | 14 ++++++++++++++ > include/linux/gpio/consumer.h | 1 + > 3 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/driver-api/gpio/consumer.rst b/Documentation/driver-api/gpio/consumer.rst > index aa03f389d41d..38a990b5f3b6 100644 > --- a/Documentation/driver-api/gpio/consumer.rst > +++ b/Documentation/driver-api/gpio/consumer.rst > @@ -109,11 +109,13 @@ For a function using multiple GPIOs all of those can be obtained with one call:: > enum gpiod_flags flags) > > This function returns a struct gpio_descs which contains an array of > -descriptors:: > +descriptors. It may also contain a valid descriptor of a single GPIO chip in > +case the array strictly matches pin hardware layout of the chip:: > > struct gpio_descs { > unsigned int ndescs; > struct gpio_desc *desc[]; > + struct gpio_chip *chip; chip is placed at the beginning of the struct in the real code, which is expected since putting it at the end won't work because of the desc[] declaration. ... > diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h > index 21ddbe440030..862ee027a02f 100644 > --- a/include/linux/gpio/consumer.h > +++ b/include/linux/gpio/consumer.h > @@ -22,6 +22,7 @@ struct gpio_desc; > * gpiod_get_array(). > */ > struct gpio_descs { > + struct gpio_chip *chip; > unsigned int ndescs; > struct gpio_desc *desc[]; > };