Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp821848imm; Thu, 31 May 2018 09:58:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ9zTU/MD/z4+MqKIugOa47arvHXSD4S9JZa+MFSFiGgnngolvFGWTBrg83WcXmP8D8sKac X-Received: by 2002:a17:902:5959:: with SMTP id e25-v6mr7788726plj.351.1527785928968; Thu, 31 May 2018 09:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527785928; cv=none; d=google.com; s=arc-20160816; b=aEkqlkg/nAp3bOwdfxOZQZI1HWHQrsk/C40VolUZio88ZkDvWuT2xsaA7dFyAiR0zn YY/vx90dLpy/0ygqjsqIr7uKQol3w91HidaTYZvCnw4Qw3+5gGynffuZ5Y81KpsIhIWy YyW5MAmmg/vRwkNV8Do9hQDi2sJqv949ZY3b7EOa9DNSsJK4Pfq1lDBG4yZy/0GU7mMe wXoe/hlMLs+I1HHxyx/F8aEQq2xwVPM72GFffiYKh+LjSf7iOAQVWWRWMV9QZlPGUrXb wasgwySenrBk8J6vFAyHBdD5MnJq76KpHL9zucUKC2+SE/D9+wc12oD6hHO46TPUJsKz S1QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=R/hDgr0L5X85pmh1HR5iGqivQ1NKJMXgI4j+sCodGnA=; b=KPf8zTv9h4tiqMzQ4owpzrNCRUiJFXglipoLSqYauAnVLIR8EbMPTpBb6ABtuihaR7 j1HCaIoxkKYJm5hfr83rqxCp577NsXHNonvhBnt3XqLDlGGWm9kasd3V731YJZ/dSboO kjYA1LbiLbDeuIIMZbg2TcIaBc+/Y3FEZ1NV0/htjekGKzem3IoriIEfix6Z+X+0L94u 4n10PObxvWa92cNR+XMddL1DMKLFAuG4cI95ISl2JJ919i7RnFIzJ+UTZbqcCwjnjXjx o7euF6Bh1ZTQ5n+IueR47W7Cq2Uv/wNnhIzDVQSUES4SkGS0A2dGLsEYT6XtTr7BwSJf XcrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BIM8CvNh; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si3599805pge.684.2018.05.31.09.58.34; Thu, 31 May 2018 09:58: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; dkim=pass header.i=@linaro.org header.s=google header.b=BIM8CvNh; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755702AbeEaQ6E (ORCPT + 99 others); Thu, 31 May 2018 12:58:04 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:41934 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755556AbeEaQ6C (ORCPT ); Thu, 31 May 2018 12:58:02 -0400 Received: by mail-pg0-f67.google.com with SMTP id d14-v6so9980675pgv.8 for ; Thu, 31 May 2018 09:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=R/hDgr0L5X85pmh1HR5iGqivQ1NKJMXgI4j+sCodGnA=; b=BIM8CvNhOhZBH5divi4T9mCvPQ1wZ1qhc2senrmQpZFnTD9Z8L2j1nxPw+PcXZoAX2 /qjZoDW/grsF6zt3YBiDq7firVhCLKg+v+cyo2dgfSGctbhOVcvmBVUkgM6pwv7k0BFH 6hEZo1gnL5lKCo9yKSER7PEtf7/uLVog5iZnE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=R/hDgr0L5X85pmh1HR5iGqivQ1NKJMXgI4j+sCodGnA=; b=ugqpZzicIq9JgFYlAcI1mcHOpOESApsG4aBVpFx5wFQZo3NfnGgpMVlRf7IdedNPkR Bp5dxGZz+WZeRyxJlw9xUXcsF0zETxo4SjYlQvwhRnqOKVWekU8x5jQQY9MDWE96fc4/ W0fdbODGGA7MTkKOxF8hX968kqTlQhu8bguAi2yrdeYzSZH0AigjlqggCvcMVZAA/exl rmGksID4MYEA+MrUhJwFGlM7MG0bCGXMKk6307d0cXRtQwJQcrk2gJxsbqVgAUQRJ1IJ 6m9rRm3B+JuZXFHFEEwCi/ilqKsKadnAj67lInuhIpGMTjusxar0/z4uwvB/5yb8UAW7 29Pg== X-Gm-Message-State: ALKqPwdospMsU0rBgGUakur70DKzElE+x+ZntRCIoQGH4nxuZaywJXWl XhXCn77PwpLhbZV8uAH0StZKpA== X-Received: by 2002:a62:2f44:: with SMTP id v65-v6mr7510665pfv.83.1527785882153; Thu, 31 May 2018 09:58:02 -0700 (PDT) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id t131-v6sm52719638pgc.34.2018.05.31.09.58.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 09:58:01 -0700 (PDT) Date: Thu, 31 May 2018 09:57:59 -0700 From: Bjorn Andersson To: Greg Kroah-Hartman , Linus Walleij Cc: Sebastian Gottschall , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Timur Tabi , Sasha Levin Subject: Re: [PATCH 4.16 269/272] pinctrl: msm: Use dynamic GPIO numbering Message-ID: <20180531165759.GJ14924@minitux> References: <20180528100240.256525891@linuxfoundation.org> <20180528100302.722883806@linuxfoundation.org> <7c34ccef-2fa8-8b53-2677-29f6fbe71a04@dd-wrt.com> <20180531114553.GB11598@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180531114553.GB11598@kroah.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 31 May 04:45 PDT 2018, Greg Kroah-Hartman wrote: > On Thu, May 31, 2018 at 01:21:56PM +0200, Sebastian Gottschall wrote: > > Am 28.05.2018 um 12:05 schrieb Greg Kroah-Hartman: > > > 4.16-stable review patch. If anyone has any objections, please let me know. > > > > > > ------------------ > > > > > > From: Bjorn Andersson > > > > > > [ Upstream commit a7aa75a2a7dba32594291a71c3704000a2fd7089 ] > > > > > > The base of the TLMM gpiochip should not be statically defined as 0, fix > > > this to not artificially restrict the existence of multiple pinctrl-msm > > > devices. > > > > > > Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver") > > > Reported-by: Timur Tabi > > > Signed-off-by: Bjorn Andersson > > > Signed-off-by: Linus Walleij > > > Signed-off-by: Sasha Levin > > > Signed-off-by: Greg Kroah-Hartman > > > --- > > > drivers/pinctrl/qcom/pinctrl-msm.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > --- a/drivers/pinctrl/qcom/pinctrl-msm.c > > > +++ b/drivers/pinctrl/qcom/pinctrl-msm.c > > > @@ -818,7 +818,7 @@ static int msm_gpio_init(struct msm_pinc > > > return -EINVAL; > > > chip = &pctrl->chip; > > > - chip->base = 0; > > > + chip->base = -1; > > > chip->ngpio = ngpio; > > > chip->label = dev_name(pctrl->dev); > > > chip->parent = pctrl->dev; > > > > this patch creates a regression for me. on ipq8064 the systems gpios now > > start somewhere in the sky > > > > new layout > > > > lrwxrwxrwx??? 1 root???? root???????????? 0 Jan? 1 00:00 gpiochip373 -> ../../devices/platform/soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0/gpio/gpiochip373 > > lrwxrwxrwx??? 1 root???? root???????????? 0 Jan? 1 00:00 gpiochip408 -> ../../devices/platform/soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/gpio/gpiochip408 > > lrwxrwxrwx??? 1 root???? root???????????? 0 Jan? 1 00:00 gpiochip443 -> > > ../../devices/platform/soc/800000.pinmux/gpio/gpiochip443 > > > > > > before the patch > > > > lrwxrwxrwx??? 1 root???? root???????????? 0 Jan? 1? 1970 gpiochip0 -> > > ../../devices/platform/soc/800000.pinmux/gpio/gpiochip0 > > lrwxrwxrwx??? 1 root???? root???????????? 0 May 31 13:13 gpiochip442 -> ../../devices/platform/soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0/gpio/gpiochip442 > > lrwxrwxrwx??? 1 root???? root???????????? 0 May 31 13:13 gpiochip477 -> ../../devices/platform/soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/gpio/gpiochip477 > > > > > > this broke my userspace gpio handling. i can override this, but still it > > doesnt look correct since there is a hole at the beginng likelly reserved by > > unused arm gpios > > So does this mean that 4.17-rc is also broken for you? If so, this > needs to be reverted there as well. > > Bjorn, any ideas? > The Qualcomm TLMM (pinctrl) driver was introduced long after it was decided that the kernel should not rely on global/static gpio numbering. But due to a mistake on my part the dynamic gpio base for this gpiochip was always 0, which the offending patch corrects. So writing user space code relying on the gpio numbering for this chip has always been incorrect, just as it is for the other two gpiochips listed above. The original objection for backporting this patch was a touchscreen driver stopped working on 4.4, but the driver clearly doesn't depend on global or static numbering of gpios. I don't think this was ever root caused. I guess the pragmatic approach would be to come up with something like Timur's suggested fix that makes the first instance of this driver use base = 0 and then use dynamic numbering for the rest, to maintain support for this incorrect usage of the gpio sysfs interface. (Although that would probably break if Timur's customers move their user space to the new platform as "the first instance" isn't deterministic). Regards, Bjorn