From patchwork Wed Nov 21 07:37:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13028 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9DE5623FC6 for ; Wed, 21 Nov 2012 07:38:50 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 38B2FA1821F for ; Wed, 21 Nov 2012 07:38:50 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so2309204iag.11 for ; Tue, 20 Nov 2012 23:38:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=M2Fd3VqgkHXRUB3uc9flJgfnECdHpJWN85qPTIQC4Dw=; b=W8mIJ+QQWsmfWfRwIBEa1yJ82zfJrpJfjZzThDmCO2NAuorJ/odfiUB+sbxU8T/+6W nhKs8F8jNXdk/hv03z5Zhy4wwQTXTU3fZSZB6xmurrqF/sccuw7GEt0+p1d20x2PSuSz uz2sZj53mbQ1ywgJ1LQpCFxtk8CWslNRA7u4228pypKu98z6vao4YUbWQNjbMGH755iH LTvMzHykr22/e+tzAneUdPxQHKUEzTLMziRd10PBwXt2tWqjtqJBm2JaQMen5sNPMurH m6QLb+98nWVQrsdB4sc4M8u8E7bRkRMZPm2ZnKOXzI8EVz540+2uWghd0ldU/lLUSOlv Cj/w== Received: by 10.50.91.195 with SMTP id cg3mr12728427igb.57.1353483529539; Tue, 20 Nov 2012 23:38:49 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp445677igt; Tue, 20 Nov 2012 23:38:49 -0800 (PST) Received: by 10.14.0.198 with SMTP id 46mr42729818eeb.21.1353483528276; Tue, 20 Nov 2012 23:38:48 -0800 (PST) Received: from eu1sys200aog119.obsmtp.com (eu1sys200aog119.obsmtp.com [207.126.144.147]) by mx.google.com with SMTP id a9si25905163eeo.90.2012.11.20.23.38.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 23:38:48 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.147; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob119.postini.com ([207.126.147.11]) with SMTP ID DSNKUKyE+hBDL0wqbLk1Sxm//ZmK749KPfJu@postini.com; Wed, 21 Nov 2012 07:38:47 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 5394647; Wed, 21 Nov 2012 07:37:14 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 892EE58; Wed, 21 Nov 2012 02:44:15 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id B76DCA8088; Wed, 21 Nov 2012 08:37:46 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 21 Nov 2012 08:37:49 +0100 From: Linus Walleij To: , , Shiraz Hashim , Viresh Kumar Cc: Stephen Warren , Anmar Oueja , Grant Likely , Linus Walleij Subject: [PATCH] gpiolib: fix bug and clarify OF use of ranges Date: Wed, 21 Nov 2012 08:37:45 +0100 Message-ID: <1353483465-25961-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlOBcW4ZrlwbFTEdZmZige2vZjQ7oQDOXA6omLXBerrxydGFDyuu5PjCoocs26/cbbtPPhI From: Linus Walleij In commit c905165f5946f56dca195871641bd4e488eca24a "gpiolib: let gpiochip_add_pin_range() specify offset" I forgot to update the OF use of the function gpiochip_add_pin_range(). It turns out that this reveal a weakness in the OF range mappings: ranges cannot currently be sparse. So put in a comment so we can fix this later. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a40cd84..d542a14 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -238,8 +238,20 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) if (!pctldev) break; + /* + * This assumes that the n GPIO pins are consecutive in the + * GPIO number space, and that the pins are also consecutive + * in their local number space. Currently it is not possible + * to add different ranges for one and the same GPIO chip, + * as the code assumes that we have one consecutive range + * on both, mapping 1-to-1. + * + * TODO: make the OF bindings handle multiple sparse ranges + * on the same GPIO chip. + */ ret = gpiochip_add_pin_range(chip, pinctrl_dev_get_name(pctldev), + 0, /* offset in gpiochip */ pinspec.args[0], pinspec.args[1]);