Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp140537pxu; Tue, 1 Dec 2020 07:55:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSj37aKzmb8cBODLzkfb9X9vwiNM4v5GzgpNPfD+mR/MmyiqQhy5z1GqNcv9m97umi4MIW X-Received: by 2002:a05:6402:3d9:: with SMTP id t25mr3609809edw.338.1606838113580; Tue, 01 Dec 2020 07:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606838113; cv=none; d=google.com; s=arc-20160816; b=qvUfckVyLN7uBcivzqDESqnTv60VrNxvg9np6hPvcDFU8OE2KBHdEiVc6MGFSEMzoL WngwrO28kuP23Wc/0fRKKWqlDrz4DCLJaPkJHrI/m9AbKroKMzKrUohzF7sWQ+7CaXWh padA4v1AMd6QYe9f4tadnj6NCjLPPh9r6lunCVnxE7HNEyc/CCczEsxTUe/YQO5QiGPn EFEO6F2ltD4RkHkK1C0iAtrrgkGGfuwTV1cu/BdoqCS3cAa+HF/RWx/yE/EoJa9JGAww dUkZ3hyc9Lhe1Y5KxqC+mUmRyAtcQ6fm8Rs2ASt/TFkYgAcmbgXKtKF1/TGpzn3WkUQS UBlg== 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=7pLlIXqniIb8lLwcUv8C5IJZPzU955Z7Fl+CrmV2OEM=; b=yTHIrNvS2Uyiy70ldTwC/mu3zpmWMMdncIUGAj+opl4TaRVMsWChMVaHqO4RDamN5f xf/ncyhJU8WHmIkYc9Qgl0xQqVqbPRm/tzFpM5kbnjOJnIYImE+27TeX7Lao3MRlXESO dy04DnZBwP8oIu6UiUqozopbz5ImvAUod3a3oqtM7JaTJgF6Rz2T8TtJSfZsgtSKhXVV SI31FCE9op3tOsaWlbXCcE+mridCoVeB9A5OkVbqd8VXglVcayJqPJWZMOaadVVRCDaH LHtI1FRVik+eNxaWh3cXZ78PKuCVpf4KZYwLLY7ADqliKY8IJF/637uOYkJBCgSRnNwB e/+g== 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 f16si181596ejt.190.2020.12.01.07.54.45; Tue, 01 Dec 2020 07:55:13 -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 S2391927AbgLAPvj (ORCPT + 99 others); Tue, 1 Dec 2020 10:51:39 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45773 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391886AbgLAPvi (ORCPT ); Tue, 1 Dec 2020 10:51:38 -0500 Received: by mail-lj1-f195.google.com with SMTP id q8so3659941ljc.12; Tue, 01 Dec 2020 07:51:21 -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=7pLlIXqniIb8lLwcUv8C5IJZPzU955Z7Fl+CrmV2OEM=; b=uYvoluBnXyroJbptCW+Ar8hQraDaB7efOpodeAryrR+f0TFXYZQTI9Ob3eotE/344U r+BNzSYfkpn3diiNfUSBk+iw7fnKXap9uKY2gN8QvsNF231+So1PLidDqHlqig8gOBsT ulkD8sIQTMrqyrtULzhKzsnYWtklZh/qISO3CkkLXWfLSxJZx6IerVLLAjZ/Li4q31GQ 1nfZm8vYaTKeGZf7hUuvT0P6aqKeaDrMo2rapYaf+FcKXkwGv7n6X3vc8+qk0DCpfbMr rDMQ1ZMVZJVRDgtDSS4ypQ2f4WHdG9xcGIRhuz+eQ9J4CR24j0al0kNoejyEedIEYMWM Dw/w== X-Gm-Message-State: AOAM533jcit9LZUEqdQx+Y68W+XbndZG5Uc/Znw4W15GkCPIoFkm06+g b4eXhcQ7TpHFq6GP23tJaYo= X-Received: by 2002:a2e:81c7:: with SMTP id s7mr1685019ljg.60.1606837855694; Tue, 01 Dec 2020 07:50:55 -0800 (PST) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id w3sm238215lfn.293.2020.12.01.07.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 07:50:54 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1kk7w5-0001qm-32; Tue, 01 Dec 2020 16:51:25 +0100 Date: Tue, 1 Dec 2020 16:51:25 +0100 From: Johan Hovold To: Linus Walleij Cc: Manivannan Sadhasivam , Johan Hovold , Greg KH , linux-usb , "linux-kernel@vger.kernel.org" , patong.mxl@gmail.com, Mauro Carvalho Chehab , angelo.dureghello@timesys.com, "open list:GPIO SUBSYSTEM" Subject: Re: [PATCH v5 2/3] usb: serial: xr_serial: Add gpiochip support Message-ID: References: <20201122170822.21715-1-mani@kernel.org> <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 Tue, Dec 01, 2020 at 03:37:38PM +0100, Linus Walleij wrote: > On Sun, Nov 22, 2020 at 6:08 PM Manivannan Sadhasivam wrote: > > > Add gpiochip support for Maxlinear/Exar USB to serial converter > > for controlling the available gpios. > One minor notice: > > > +enum gpio_pins { > > + GPIO_RI = 0, > > + GPIO_CD, > > + GPIO_DSR, > > + GPIO_DTR, > > + GPIO_CTS, > > + GPIO_RTS, > > + GPIO_MAX, > > +}; > > You know the names of the pins... > > > + port_priv->gc.ngpio = 6; > > + port_priv->gc.label = "xr_gpios"; > > + port_priv->gc.request = xr_gpio_request; > > + port_priv->gc.free = xr_gpio_free; > > + port_priv->gc.get_direction = xr_gpio_direction_get; > > + port_priv->gc.direction_input = xr_gpio_direction_input; > > + port_priv->gc.direction_output = xr_gpio_direction_output; > > + port_priv->gc.get = xr_gpio_get; > > + port_priv->gc.set = xr_gpio_set; > > + port_priv->gc.owner = THIS_MODULE; > > + port_priv->gc.parent = &port->dev; > > + port_priv->gc.base = -1; > > + port_priv->gc.can_sleep = true; > > So assign port_priv->gc.names here as well with an array > of strings with the names ("RI", "CD", ... etc). > This makes it look really nice in userspace if you do > e.g. "lsgpio". Last time we tried that gpiolib still used a flat namespace so that you can't have have more than one device using the same names. Unless that has changed this is a no-go. See https://lore.kernel.org/r/20180930122703.7115-1-johan@kernel.org for our previous discussion about this. Johan