Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5081950imm; Tue, 7 Aug 2018 12:20:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdlOtedxxMMhKy10gaAvXrvT0wX9RxTj0ToYR3ouTW/KEKMq6Q+rhamzEsJ7G2JxB9skWVs X-Received: by 2002:a62:591a:: with SMTP id n26-v6mr23157916pfb.94.1533669618549; Tue, 07 Aug 2018 12:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533669618; cv=none; d=google.com; s=arc-20160816; b=OWNpNR5RrqifVpSfLd9n8vAisMaZAaKMwHV1khChum1fwdjolCQo1+XuITHBjpk1uJ i0Fh4tFU7gYDfEbTK9e0+l+f29KbI7lVYKFV23Y9eLL71j10LHOJHYctOlHdk/aiWMG7 CpWA3NtP+4Bs6scOzWQ4tSvESCGSjst4IGGdrngdrSc2vrNr4Xv5bWhDSv33DnqgoUuk 7E8zHNkMBDGTncATt/yLDcuDfoWhGY0rydT7CXu1n1IQJk+UHf9K3yxdsdO8464Y5YoM O51+6IRjZCRfVmyp4IkU1V2MZPie/q+DyUryz3vzNXMuwqnWl9WTJkrwg57veycNEAdJ 7Wbg== 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:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=1+Db8TaKs+BhtQSpksdvvOhIqZRZ+v0flkYV64y5N9M=; b=qMuw2lsPsYuvHbuJSzulgDk8JiSTIQKIlzHh/NTSmGSIQrrNJ+qMyU9fBJKxj9vF5u gdZMY6fgooxrV0ldFFUHrJ2YCQ2pOEao2Af7j483hMZzFPWsRfOBNnsMaLT1z6nbcriE QnzwU/w/AHmwLm5Tdljoe5fCvZS2XgzwVUqmfsD7eFSzf7RO+tVrZBgcLYM2tfeIAZef JZCVKWen8BsmTPjpsmB6/FmAoSYh1VtlA39HaQnN7p3COqFk8SKn4Wyyr7Jw0jX9jN2j 4qXwdiP3pNR11zMZKPz2uw1bMzohA7rAncghqO/XTVW7SCSrWxsgJbNNlWESobbabqt7 jzzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="oQjRxik/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4-v6si1559840plo.235.2018.08.07.12.20.03; Tue, 07 Aug 2018 12:20:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="oQjRxik/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389227AbeHGTEg (ORCPT + 99 others); Tue, 7 Aug 2018 15:04:36 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34236 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389136AbeHGTEg (ORCPT ); Tue, 7 Aug 2018 15:04:36 -0400 Received: by mail-lj1-f196.google.com with SMTP id f8-v6so13999482ljk.1; Tue, 07 Aug 2018 09:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1+Db8TaKs+BhtQSpksdvvOhIqZRZ+v0flkYV64y5N9M=; b=oQjRxik/wv9X/yRtQPw4gK4O9SQGQ/SyzwYJcekYnkzE4/oqfaE+hgV0GnadjPR96a Jx1rfPO+tt/JZj/lHUsBOgjWCfPvx+7n/BeTfjyRsNy7T7UPXsW9LmmJUKYhBUnRL5RX /tFX8DUIViG87BqOomgTTpvMljOVFe5sbW18gvTYcJcAPAIzr1gQQ/CFcVLHReCB4yaY jlFstgK8rn3yj5gpzv2bT2prOUL+DAk9vYCeFXmNHO+AJziRX8g2MNF+Lkut5KDPjT0/ ZiRon6w+pDT1pq2kzmXbqcfuu00crh5PFCb2vjhl8WPCJIgs346UPha0cmXlvBIg+AVE RyRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1+Db8TaKs+BhtQSpksdvvOhIqZRZ+v0flkYV64y5N9M=; b=Z0YeLNd6KcfwFC38DytVdaayOY7RuwbRa8djpxHigtZHHgJXhnZ2cbEAMfX4rq4eCB 47Wv5UPPoc71k+OTAi0glZ5KZQS9uujT+oDFf57/xwpfrGJHK7KQekDzw3fg85Vj4PgN xoNWRtQlQXpBpF6+thK00HYvKj/45nyh0t+otEMeU6l0t/cUdNRLczWs4yA2s8xWLdrf 5WKmBoNNGKurNfrujR5srghnATi+EI9FLWbwogDJ/I1naLn+vij2fvyDBW7qwoMhd0PZ aHIFaYkHIHUnqKk2tq9J+Swe7r3oSnEvc/lPvd/5z3Gy+26koA5ehmoQajH4lOiz5D6K depQ== X-Gm-Message-State: AOUpUlEvIJ99K3vj5qTsT62bjkpJ2KFNDvjUfsJAu94r31j1Rg8rPegu I03YC0A3q/nqB7jcVk8GJxc= X-Received: by 2002:a2e:2096:: with SMTP id g22-v6mr15858660lji.37.1533660563644; Tue, 07 Aug 2018 09:49:23 -0700 (PDT) Received: from z50.localnet (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id q16-v6sm314115ljj.68.2018.08.07.09.49.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 09:49:22 -0700 (PDT) From: Janusz Krzysztofik To: Linus Walleij Cc: Boris Brezillon , Jonathan Corbet , =?ISO-8859-1?Q?Miqu=E8l?= Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Mark Vasut , ext Tony Lindgren , Aaro Koskinen , Linux ARM , Linux-OMAP , linux-mtd@lists.infradead.org, linux-doc@vger.kernel.org, "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Janusz Krzysztofik Subject: Re: [RFC PATCH v2 09/12] gpiolib: Identify GPIO descriptor arrays with direct mapping Date: Tue, 07 Aug 2018 18:50:22 +0200 Message-ID: <1793769.2WP40jSPqy@z50> In-Reply-To: References: <20180718235710.18242-1-jmkrzyszt@gmail.com> <20180806222918.12644-10-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On Tuesday, August 7, 2018 1:29:43 AM CEST Linus Walleij wrote: > Hi Janusz! > > On Tue, Aug 7, 2018 at 12:29 AM 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 > (...) > > 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; > > This must be motivated: if the only purpose is to indicate to the consumer that > all GPIOs are on the same chip, why not just have a > > bool all_on_same_chip; > > That you set to true if these are all on the same chip? My approach would probably save one or two instructions per get/set call, but I'm not stuck to it and will be happy to find a better solution. How about folding the chip descriptor inside an additional structure, private to drivers, with internals not revealed to consumers? Thanks, Janusz