Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3573521pxu; Tue, 15 Dec 2020 10:03:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzb0IUKPksboctpUJpR2xRUpvZn1yZgOXUbfgAccTa0W8jfrOxO3a/tiJY8OSFDTKA+DLBd X-Received: by 2002:a05:6402:45:: with SMTP id f5mr26895068edu.273.1608055427959; Tue, 15 Dec 2020 10:03:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608055427; cv=none; d=google.com; s=arc-20160816; b=hMHr+hIPPc0Uo7cV9I+xqgcY1N59TbO0AZ01W6fjKSufnuaMxO9/qa9UJwHmS2Jy4a QA0PiuVqlU6mwmQfJ1pI8XKpSXZiWt0962h05oCeB+U73pTbQfj4muVsxZ2qXDMcUDPq oV8dek6VnuPSaT47SnWAq/P5t4AX/dPP04WD34yIoE8hUxniNKasbOg3Vk/KO09j7Ylj 7kzivk7WN0ZC7VJNqGf9C17Ix4m9UFJ8+DOLZ5/RbsE8jUETq5XLylD/qtCD6F6Jhil5 WOyZ3hbCi34U5Tn7TDj58OZTBOJl6NOPrLC8LkTBxyRc6bm2APajVU2vymMSoPXP1QHE P+fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5MPpRk8V3g6PWN9LNQ99IKoF0RLFmkUnchrMF5LPWbo=; b=XICVGmI8/eqewbkSVB/cSY0fNluPMaYLTe/IiMWMOPA5q2I54ke63p6akYyB9QARVR JqC+LTlJ5WOVuG3qwChII5wg6PYDJz9D6SZ8iD4lqPlOr6mP1mJ47dSfwTFgLxFHfQiG EbJOwzUkcvuH4uOpGkwafl0i8SYMNARsqCbsW1OrLUXazTfF84VJi6CiDM7HY0eZQah4 BBq+u0NygwpA0hytaaQg6YOak0YYKZTYWlCM1F6wvxgt//J+Rv+RdSRtts84nsvixmUF pg+TFLq3PaC8Nlwa/qrQkP73cRpgaI62609cCsEiU1TcxClPMmmkpAav0KXJifhr/89D +BDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Eas/6BiU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id p17si1268970ejw.23.2020.12.15.10.03.22; Tue, 15 Dec 2020 10:03:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Eas/6BiU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1731025AbgLOSAM (ORCPT + 99 others); Tue, 15 Dec 2020 13:00:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730726AbgLOSAM (ORCPT ); Tue, 15 Dec 2020 13:00:12 -0500 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A39C0617A7 for ; Tue, 15 Dec 2020 09:59:32 -0800 (PST) Received: by mail-oi1-x244.google.com with SMTP id q25so24265882oij.10 for ; Tue, 15 Dec 2020 09:59:32 -0800 (PST) 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:in-reply-to; bh=5MPpRk8V3g6PWN9LNQ99IKoF0RLFmkUnchrMF5LPWbo=; b=Eas/6BiUtdkrhL31amEw8ijnAI4oee8wsNUo7jn8A75pk6Yq5m5jj2tVBH9o+OlLAc eXuvKCiMkTVNMLo+EuseRRGOABLWbahzG9r+91blEKtO58y0htpOwsD+ylK+hHmh5TDV zqYfTr4AKyfgcR6gD+nX789LQGDPoWsVjnpISf+8cVu2WwpMChVfLUNHH5fUWmI3QnwW Iqc9N3M2F0/JE9g0Lda9u36EA/FOS3TF9kt5pPf26lshyfQQ+1Yq5R1clWqUf0lVc6bR Pm1axbJALfeTLFBpwKVXaiIcOjyk39B/AVPCKjYSZnsmwPVPzKA+w27/hfxLqTuWtqKk ctzA== 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:in-reply-to; bh=5MPpRk8V3g6PWN9LNQ99IKoF0RLFmkUnchrMF5LPWbo=; b=IvnNJcrZHJm0c8bio9ENNYVHF6jjWXD1cDjVy4KWFpaBZK52EyIiApJg4S3dSklhd3 9vtjFj2pN7+8SMZtlu6KoRQ/2x+0TVRa+APizZyebWHAUgjczOQ2ISGgsu88z+yp2NnO IWybmdTEFbkX1OFmwYDQzlzU1ixE0SSKxIMTPBNwVRK0/RGh/2slVM50tX0kysLdYg8A 1Qujc9z98kAU8sVUQ6W9VD9jC+C/2ZfpHL9E35AqMhNn5cneFxORXPtOwYyLNzVto/c+ f3KYwvZYSktg3DKDGpAg9WMM/MT7SXkhqptbPB4en/v3DPy7d2DjEMVITU7USntaYYaR Ef5g== X-Gm-Message-State: AOAM531fNonn3rMg74NEnpvYhKEi9TC3zZ1KJrFouJm33GTkQ4ZtpJH/ ughxpZUfaUp4r9funeIsu7O5tg== X-Received: by 2002:a05:6808:1c1:: with SMTP id x1mr38015oic.126.1608055171539; Tue, 15 Dec 2020 09:59:31 -0800 (PST) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id d124sm1018978oib.54.2020.12.15.09.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 09:59:30 -0800 (PST) Date: Tue, 15 Dec 2020 11:59:29 -0600 From: Bjorn Andersson To: Bartosz Golaszewski Cc: Linus Walleij , linux-gpio , LKML , linux-arm-msm@vger.kernel.org Subject: Re: [PATCH] gpiolib: Allow name duplicates of "" and "NC" Message-ID: References: <20201215170308.2037624-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 15 Dec 11:42 CST 2020, Bartosz Golaszewski wrote: > On Tue, Dec 15, 2020 at 6:02 PM Bjorn Andersson > wrote: > > > > Not all GPIO pins are exposed to the world and this is typically > > described by not giving these lines particular names, commonly "" or > > "NC". > > > > With the recent introduction of '2cd64ae98f35 ("gpiolib: Disallow > > identical line names in the same chip")' any gpiochip with multiple such > > pins will refuse to probe. > > > > Fix this by treating "" and "NC" as "no name specified" in > > gpio_name_to_desc() > > > > Fixes: 2cd64ae98f35 ("gpiolib: Disallow identical line names in the same chip") > > Signed-off-by: Bjorn Andersson > > --- > > > > The introduction of 2cd64ae98f35 breaks pretty much all Qualcomm boards and > > grepping the DT tree indicates that other vendors will have the same problem. > > > > In addition to this the am335x-* boards will also needs "[NC]", "[ethernet]", > > "[emmc"], "[i2c0]", "[SYSBOOT]" and "[JTAG]" added to this list to allow > > booting v5.11 with the past and present dtb/dts files. > > > > drivers/gpio/gpiolib.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > > index b3340ba68471..407ba79ae571 100644 > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -302,7 +302,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name) > > struct gpio_device *gdev; > > unsigned long flags; > > > > - if (!name) > > + if (!name || !strcmp(name, "") || !strcmp(name, "NC")) > > return NULL; > > > > spin_lock_irqsave(&gpio_lock, flags); > > -- > > 2.29.2 > > > > I have a bad feeling about this. This opens the door for all kinds of > exceptions: "N/A", "none" etc. Depending on whose boards are getting > broken. > > If non-uniqueness of names is needed then let's better revert 2cd64ae98f35. > I like the intent of 2cd64ae98f35, but even if we decide what the "unconnected" name should be we have a slew of boards that won't boot v5.11-rc1 (or with any pre-v5.11 DTBs). As such I think we need to revert the "return -EEXIST" part of the patch. Looking forward perhaps we should define "" to be the "not a gpio"-name, revise my patch and fix up the DTs accordingly? And keep the dev_err() as it currently is? Regards, Bjorn