Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2437460pxu; Mon, 14 Dec 2020 02:15:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaQQISkBBLwVvU70o405fouBes+JOhlR9CHWTcvUmTNMOmCZGhGSZFSSUSfnayIKkWb/AM X-Received: by 2002:a17:906:9605:: with SMTP id s5mr8109798ejx.179.1607940928948; Mon, 14 Dec 2020 02:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607940928; cv=none; d=google.com; s=arc-20160816; b=H1gLa5xlu052bMFUx6waQmH5RWs8r1kzOuOfBQ99QWUdsbWI/+Qp/o0rNhVx1Fbj77 3lrUam9kE/ro/rrBXzbJGO8ZETjhEk9xJnBKq7RNngg7b81HYsW68ET44PbXjp5I1XOg 60lwP/RWEAmiYb0tf0wTw9T+/7EaszwDHjuSjln1Y6M1eyTIAxQFlo/CeC0ImQYphIq3 rmtwh+tGLCwB60GVcKpaJPxzp/kKeIzuXhP1cnwqpOgix6CxIoWLW+xajR59dUG/JJpH +EsSnSiGybljDviVVCJnULWp3/5OO6i8Wxb53aBVM0YOopntH3Us9YKUtbNDo0nchBc3 Cc3w== 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; bh=Lr5XsBxGYGsi86hSbsch7/IRMB+x1iKvkn7GZc67tW8=; b=mo3ToI9bfoHFiRkSor/rv53E9Cpk7eoXvEJj35KsJ+5x2fi4adrusu8KQcomVc7rqz oqloUgsgljgh93aNRMaNw4j/Fxq0HjXuq26J7Qm0WkMhycjK9qotDf9v3uqUjVbHkNqw Nh68Nb6/HSFkTw9yXUzXTbdrIDTGgYAphMNwDkPJgG0eCA7JQGQPwvRskGKzssdj3z/e PpCST+/hSjk/TjTao6k81UUi7wTPNzDJS07lGw4NfyURlCGEEBVHCmpKAPq2Vaiqgwzh 1spc+Lkqg825i3q7HO7Fjy0hPSzUPzNr0/9A0ub9VMIZjS1oxQseWzR5SmPnM1cUUe/G XGsA== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si12198687edp.102.2020.12.14.02.15.05; Mon, 14 Dec 2020 02:15:28 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728536AbgLNI7t (ORCPT + 99 others); Mon, 14 Dec 2020 03:59:49 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:46415 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439472AbgLNI73 (ORCPT ); Mon, 14 Dec 2020 03:59:29 -0500 Received: by mail-lf1-f68.google.com with SMTP id y19so28145310lfa.13; Mon, 14 Dec 2020 00:59:11 -0800 (PST) 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=Lr5XsBxGYGsi86hSbsch7/IRMB+x1iKvkn7GZc67tW8=; b=O/lrdeQ/4pcwmhj+AhhM8qbzeJWbHRGr8mqP5WbAEis9xFgBAqKF3VIRdW5pc+a8v4 BcYdqsA1b/Bbf03Nm+DXdzAHkcovpL71i/fSwe7e8OFAG6dtQYsXXdX+dUfTU/Ol68Xf LMctO9IStHOS0Q5202GB1jThJ1KNz38ZkTag07aduWu3EZo768vo9qCylMJ1Rape2HqM PuOeOC8Zxp10Hjzh0Y6gpwYgozrXL/KyiaUGd8GwoE5ewsOjflnHOL2/x7lZa0mboWfw VaSp0/RavASspoFAzn7t6CFDGH0z/SkbKhbak1cK91cgR5zfB3SwnoCcx7NweAyE78DA QeZg== X-Gm-Message-State: AOAM532Z35Y9cKGvBUQ2JuJ22DMlYFp1vC45p6khnZg9Vcz0gAboRAZ8 k0ou/snzgqmeLZx1zx/Q84A= X-Received: by 2002:a19:cb05:: with SMTP id b5mr8699978lfg.61.1607936326079; Mon, 14 Dec 2020 00:58:46 -0800 (PST) Received: from xi.terra (c-b3cbe455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.203.179]) by smtp.gmail.com with ESMTPSA id e1sm1700092lfs.279.2020.12.14.00.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 00:58:44 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1kojgm-0006Sj-9M; Mon, 14 Dec 2020 09:58:40 +0100 Date: Mon, 14 Dec 2020 09:58:40 +0100 From: Johan Hovold To: Linus Walleij Cc: Johan Hovold , Bartosz Golaszewski , Geert Uytterhoeven , Manivannan Sadhasivam , Greg KH , linux-usb , "linux-kernel@vger.kernel.org" , patong.mxl@gmail.com, Mauro Carvalho Chehab , Angelo Dureghello , "open list:GPIO SUBSYSTEM" Subject: Re: [PATCH v5 2/3] usb: serial: xr_serial: Add gpiochip support Message-ID: References: <20201122170822.21715-3-mani@kernel.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 Sat, Dec 12, 2020 at 01:03:32AM +0100, Linus Walleij wrote: > On Thu, Dec 10, 2020 at 9:53 AM Johan Hovold wrote: > > On Wed, Dec 09, 2020 at 05:25:32PM +0100, Linus Walleij wrote: > > > I just replied to that thread, but to summarize, you can't rely on > > having the sysfs code detect collisions since that will trigger a bunch > > of nasty warnings and backtraces. We also don't want the sysfs interface > > for a specific USB device to depend on probe order (only the first one > > plugged in gets to use the line names). And adding line names now could > > in fact be what breaks currently working scripts. > > Yes the sysfs ABI is very volatile and easy to break. > > As pointed out in the other reply, sysfs base GPIO number is all > wibbly-wobbly on anything hot-pluggable so in a way I feel it > is the right thing to disallow sysfs altogether on hotpluggable > devices. No, the gpio numbers will of course vary, but since gpiolib exports the base number for the chip, a scripts can easily determine the right gpio number as base + offset. Having probe order break that by sometimes exporting the line using it's name is what would be a problem. > > Just did a super quick check and it seems libgpiod still assumes a flat > > name space. For example, gpiod_chip_find_line() returns only the first > > line found that matches a name. Shouldn't be impossible to extend, but > > just want to make sure this flat namespace assumption hasn't been to > > heavily relied upon. > > The unique way to identify a GPIO is gpiochip instance (with > topology from sysfs) and then a line number on that chip. > This is done e.g. in the example tool > tools/gpio/gpio-hammer.c > > As you can see the tool doesn't use these line names. > > The line names are really like symbolic links or something. > But they are indeed in a flat namespace so we should try to > at least make them unique if it turns out people love to use > these. Not necessarily, they could be unique per chip as we're discussing here with respect to hotpluggable controllers. We just can't have it both ways. > As it is now system designers mostly use device tree to assign > line names and they try to make these unique because they don't > like the nasty warnings from gpiolib. > > If I google for the phrase "Detected name collision for GPIO name" > I just find the code, our discussions and some USB serial devices > warning about this so far. > > Maybe we should just make a patch to disallow it? That would make it impossible to provide name lines on hotpluggable controllers, which would be nice to support. Johan