From patchwork Sat Feb 2 16:29:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 2084371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 815443FCA4 for ; Sat, 2 Feb 2013 16:31:30 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U1fwY-0001nZ-Bd; Sat, 02 Feb 2013 16:27:54 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U1fwB-0001jA-3e for linux-arm-kernel@lists.infradead.org; Sat, 02 Feb 2013 16:27:32 +0000 Received: by mail-pa0-f48.google.com with SMTP id fa1so2691653pad.35 for ; Sat, 02 Feb 2013 08:27:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=+WFkb2j8y7BHx/t6TCqc7FoVpCkOjZm4rQK6zgG9REw=; b=M7NZMEkzH90bEATCL9Mxawr23LbAKp5GEuUHmcj4L8ferlLB9MYdSUw2HdkrhLENqx 0M8vQKdnUD8v1BCp6EJ0062B5Bp9uX5InhxvulGZb+ePhB/m4nVkNr78KEkdBGGkbEwh 5v29VdJ7BVv7J4mGPHfJNHI9hnW/m990i/WZ+/JFGHWu7mX/E4fj15tgPKYio33VEzy+ lLqgjL52J/x8ki0JpgaMMLGRbM8z9ZWxAXaL+zk/sRp+zETQGamyaYFU9gzGmKnurZu+ po32Kf2+AgByx4fTMnBiz0OhrIkW3JINGpL4NQifzCUev7EaywC8HCMXkoAX2+wGtYNR RjsQ== X-Received: by 10.69.0.199 with SMTP id ba7mr41523807pbd.165.1359822448690; Sat, 02 Feb 2013 08:27:28 -0800 (PST) Received: from localhost.localdomain (softbank126010191003.bbtec.net. [126.10.191.3]) by mx.google.com with ESMTPS id vn2sm12100769pbc.31.2013.02.02.08.27.26 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Feb 2013 08:27:28 -0800 (PST) From: Alexandre Courbot To: Grant Likely , Linus Walleij , Arnd Bergmann Subject: [PATCH 2/9] gpiolib: use gpio_chips list in gpiolib_sysfs_init Date: Sun, 3 Feb 2013 01:29:25 +0900 Message-Id: <1359822572-26009-4-git-send-email-acourbot@nvidia.com> X-Mailer: git-send-email 1.8.1.1 In-Reply-To: <1359822572-26009-1-git-send-email-acourbot@nvidia.com> References: <1359822572-26009-1-git-send-email-acourbot@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130202_112731_275414_88A69F30 X-CRM114-Status: GOOD ( 11.00 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.48 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (gnurou[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-arch@vger.kernel.org, gnurou@gmail.com, Alexandre Courbot , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use the small list of GPIO chips instead of parsing the whole GPIO number space. Signed-off-by: Alexandre Courbot Reviewed-by: Linus Walleij --- drivers/gpio/gpiolib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0050766..4ceb4a7 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -973,7 +973,7 @@ static int __init gpiolib_sysfs_init(void) { int status; unsigned long flags; - unsigned gpio; + struct gpio_chip *chip; status = class_register(&gpio_class); if (status < 0) @@ -986,10 +986,7 @@ static int __init gpiolib_sysfs_init(void) * registered, and so arch_initcall() can always gpio_export(). */ spin_lock_irqsave(&gpio_lock, flags); - for (gpio = 0; gpio < ARCH_NR_GPIOS; gpio++) { - struct gpio_chip *chip; - - chip = gpio_desc[gpio].chip; + list_for_each_entry(chip, &gpio_chips, list) { if (!chip || chip->exported) continue;