Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp412076pxu; Tue, 1 Dec 2020 14:38:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxf+85En733mv5elJ4ZQS7Lo/q0niMMMHcUVrSyb3K2KiXF2zQBTf3bjOjhZL97QV6jli7x X-Received: by 2002:a05:6402:1ad1:: with SMTP id ba17mr5345831edb.51.1606862312943; Tue, 01 Dec 2020 14:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606862312; cv=none; d=google.com; s=arc-20160816; b=dGZzm/6AThx7XkOT+LfJrkxyx/xW7/urwJd/4/inf/SIeofGez8fbN9v1UBdas+RKX Q3SnCNmn83f62IZN2UDgv7QIlQw0jiw1YPp6MzfyM41tLLaNu953b/NL0Pg8HFjKYf2g Pj0kAtL5zQheqsEpHvH6MuX+Q9G9PfrtL7gQLaXy7TJSa0OcmO3avtq8f6AGXpUcx04h 3q9zKS/y/yiYBH3eDKKVNUXXkGtC84uMcakhViMx/ZDpyo5SXw3RmMyuSdsRPep6l2An I2WUNQW6++XUgwmOxr7wLSLpEGJ4WZ7MbrpejwnhyOvYq2B6cGcem4ZjeIaSeJGiMOrc QQkA== 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=XoGnzm+dSK+UuYCUrUYGCRMBVQp7fm/Mmp5/QupoTww=; b=tXXksZYT3X9YqtE1L+ZzLLdByY7T/9XK2NORLuFePJQ+PZVNCAQK17/RtDRD+syEtB z5P3/w+tdJeuoJmFZU2W4VTs/sSj8ykt5XF1Yd16xu7Yj55cL5DQrO4D8jmYadP+eWYN VoicsWTEJ6EBpLfiiAwlkndItQ2HiLa+qmYdOz0AM5Y+YaBTLpijYPXvEOs/UMGHvhF4 Yh6i1RwflB6U4V9rW/jg+XqXpqgCk7fGXvKbXZ389XvmdtVBOiZfKIzVqfIIkz9GBF1i Jk6G9nocvCEecG+YWqgbrWpQQy5PC80CSyqufX9qEZegoaWlm5YUNI4Vxho7KmBMDXI2 ttKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J5WZtdv3; 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 g16si818011ejf.167.2020.12.01.14.38.10; Tue, 01 Dec 2020 14:38:32 -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=@kernel.org header.s=default header.b=J5WZtdv3; 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 S2404185AbgLASBL (ORCPT + 99 others); Tue, 1 Dec 2020 13:01:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:56586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbgLASBK (ORCPT ); Tue, 1 Dec 2020 13:01:10 -0500 Received: from thinkpad (unknown [103.59.133.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3DE22067D; Tue, 1 Dec 2020 18:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606845629; bh=1A3M3IZxhjNTlfEppcuI+Cqimzqb6oCIf9GcfsYOUKM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J5WZtdv37182NGhggCUz9MRj8u1nbxav9WG15ogkm2dyuGlWVViKlVpjS+MZqOBqf J9AOe4N4t295jj418sTQ/oC075XhWgmeRt+INQ2XLr78uexYAxusHmPl47Q34UcULb 0IG3Zrt5bvDVvQ8n/78uTwLfkqQArrSuWBc87VCs= Date: Tue, 1 Dec 2020 23:30:18 +0530 From: Manivannan Sadhasivam To: Linus Walleij Cc: 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: <20201201180018.GA78529@thinkpad> 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 Hi Linus, 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. > > > > Inspired from cp210x usb to serial converter driver. > > > > Cc: Linus Walleij > > Cc: linux-gpio@vger.kernel.org > > Signed-off-by: Manivannan Sadhasivam > > This looks good to me overall, provided that it plays well with the > serial port. > > 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". > As Johan stated, this doesn't work with multiple devices attached to the system. That's the reason for not adding the line names. This gives me the motivation to get my hands dirty with gpiolib (but I fear of breaking the ABI)... > With that: > Reviewed-by: Linus Walleij > Thanks for the review! Regards, Mani > Yours, > Linus Walleij