Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1540240pxa; Thu, 6 Aug 2020 09:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzioIcmQ3T+rrJcTIFZ5IVoTnPO2VP4UsUYSNs+5Yss4bEhVhtPnZ27UCcenLp7mB9YUs4r X-Received: by 2002:a50:fb94:: with SMTP id e20mr4932341edq.103.1596732567441; Thu, 06 Aug 2020 09:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596732567; cv=none; d=google.com; s=arc-20160816; b=K0onWUKYwOKClkIs3Nt2pqmnEqAZKuzNu8zrUsXhEcCoPqc+5bI98LlTYfjTuz7icT +FqyvJBxPa2ERpSXsQfp8dGCMbofbgdw26W2uVUTv8aokukq7v7Ime/LprlLqrc7Y2wV bFtk+tlFWjz1W8Hjg9jEFjgT2wf+IVRi7P47a6uTAz1uL/QQdGw1pQkPsOksnkZFQZVl UF7jymUQnA4TQiMyobz5kWDKN18EExk5q8l6eY3yiinbua2j0w+DZTXYVCJSLfFVlqp2 m9ohtm8IKepvGN5O3FBtzpbkwT7MkV8Yk5GAGwZbn1Lcm+NGbPIV5Zu+/GBeNfcDiyhB 9GSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=O7b6zzBbEswhT1r045fM/qsaYWnifcvdI3BJNWUghN0=; b=SVWJK91UcY5YpUNyFc8Md+YHh5vfTxe7awa/cT3BSPUq5UmwYsjmv2FCicrW1ndf0A j6zvTX6WpFQ57o3DayfEXy3/ndJ48vM0A2I5mK/KOU3ICW9p10YKGqmfjLwiVbMr1Y2g NihLTWI36jUqMFzezeXP+NsDudV6oxSy53Zq4CJCmwwP0AtoCQ5MwSKC//QcUvWq4MSr P6NDj4jbDX/GW+1SoJf05g40pcql87OGle3zla33duW2gXoo/W8yMb99+xRnvMzZuJzA A2U7gJ9lL5jQEKoq8IXf5xGzhBi5Ffcj9DU/YFBg02Lxz7r89huYhV8lFAov+K3IAP4t 1MLw== 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 p3si3586441edr.352.2020.08.06.09.49.05; Thu, 06 Aug 2020 09:49:27 -0700 (PDT) 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 S1729516AbgHFQsP (ORCPT + 99 others); Thu, 6 Aug 2020 12:48:15 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43481 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729009AbgHFQmt (ORCPT ); Thu, 6 Aug 2020 12:42:49 -0400 Received: by mail-ed1-f66.google.com with SMTP id b18so4487958edv.10; Thu, 06 Aug 2020 09:42:07 -0700 (PDT) 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=O7b6zzBbEswhT1r045fM/qsaYWnifcvdI3BJNWUghN0=; b=dPs2Jf9mdsFOSfeP4RUxvVmNpO9ZC6St6BomLKCPcZiRclaDf7jZybK2NP+tjv8TdX 0xDi5O+UJIIk7CMl4g4WzT+b9BJli7e37ijstJo/E1GDs+xtMvbjJAZvHJ9UFiITNOZS 5zHqT+Vny61OrrUX24RQPyUJ0qVEY5nbMrfkkcn+RRRUExRev+B+Xqe+MPfoyOF7+xxC cWiGIrpUs2peC+OieaEUQR9KbzyWN6TQB0FtVQXxcCB5LSOrCds4B+1k/DOmEYHdI/z+ Xfa2+7KD9OlT1Jpb/QTX4T/RJHnjisgB4rv9BmZIp69dNwxEOURZEWGCuJqwLWzy5z70 ymow== X-Gm-Message-State: AOAM530G/8vm2/bR+rIiC+oVpApKlXg9ut+u7HeZ0UxxQbr0GxBulMmj UKCY0/OZopQB11o5Kr/JXIIIRs0vPUY= X-Received: by 2002:ac2:4d4f:: with SMTP id 15mr3791625lfp.163.1596717213497; Thu, 06 Aug 2020 05:33:33 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id o23sm2658274lfr.67.2020.08.06.05.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 05:33:32 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1k3f5T-0003Cq-KO; Thu, 06 Aug 2020 14:33:36 +0200 Date: Thu, 6 Aug 2020 14:33:35 +0200 From: Johan Hovold To: Manivannan Sadhasivam Cc: Johan Hovold , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, patong.mxl@gmail.com, linus.walleij@linaro.org, mchehab+huawei@kernel.org Subject: Re: [RESEND PATCH v4 1/3] usb: serial: Add MaxLinear/Exar USB to Serial driver Message-ID: <20200806123335.GS3634@localhost> References: <20200607162350.21297-1-mani@kernel.org> <20200607162350.21297-2-mani@kernel.org> <20200701103433.GC3334@localhost> <20200726154928.GA12036@Mani-XPS-13-9360> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200726154928.GA12036@Mani-XPS-13-9360> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 26, 2020 at 09:19:28PM +0530, Manivannan Sadhasivam wrote: > Hi, > > Sorry for the late reply! No worries at all. > On Wed, Jul 01, 2020 at 12:34:33PM +0200, Johan Hovold wrote: > > On Sun, Jun 07, 2020 at 09:53:48PM +0530, Manivannan Sadhasivam wrote: > > > Add support for MaxLinear/Exar USB to Serial converters. This driver > > > only supports XR21V141X series but it can be extended to other series > > > from Exar as well in future. > > > > > > This driver is inspired from the initial one submitted by Patong Yang: > > > > > > https://patchwork.kernel.org/patch/10543261/ > > > > You've also copied code from that driver so you need to maintain its > > copyright as well. > > > > Probably better you link to lore than patchwork. Do that in the file > > header as well. > > > > > While the initial driver was a custom tty USB driver exposing whole > > > new serial interface ttyXRUSBn, this version is completely based on USB > > > serial core thus exposing the interfaces as ttyUSBn. This will avoid > > > the overhead of exposing a new USB serial interface which the userspace > > > tools are unaware of. > > > > > > Reviewed-by: Greg Kroah-Hartman > > > Tested-by: Mauro Carvalho Chehab > > > Signed-off-by: Manivannan Sadhasivam > > > --- > > > drivers/usb/serial/Kconfig | 9 + > > > drivers/usb/serial/Makefile | 1 + > > > drivers/usb/serial/xr_serial.c | 650 +++++++++++++++++++++++++++++++++ > > > 3 files changed, 660 insertions(+) > > > create mode 100644 drivers/usb/serial/xr_serial.c > > > +#define XR21V141X_CLOCK_DIVISOR_0 0x4 > > > +#define XR21V141X_CLOCK_DIVISOR_1 0x5 > > > +#define XR21V141X_CLOCK_DIVISOR_2 0x6 > > > +#define XR21V141X_TX_CLOCK_MASK_0 0x7 > > > +#define XR21V141X_TX_CLOCK_MASK_1 0x8 > > > +#define XR21V141X_RX_CLOCK_MASK_0 0x9 > > > +#define XR21V141X_RX_CLOCK_MASK_1 0xa > > > > Please 0-pad these are they are registers. > > You mean adding 0 after 0x? Yes, exactly. > > > +static int xr_attach(struct usb_serial *serial) > > > +{ > > > + /* Do not register tty device for the control interface */ > > > + if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 0) > > > + return 1; > > > > Ok, so you went for my first suggestion here instead of explicitly > > claiming the sibling interface. > > > > I still think you should bind to the data interface and then explicitly > > claim the control interface instead, since that better reflects that > > these interfaces are used together (and allows for unbinding through > > sysfs etc). > > How about something like below? > > static int xr_probe(struct usb_serial *serial, const struct usb_device_id *id) > { > struct usb_device *usb_dev = interface_to_usbdev(serial->interface); > struct usb_driver *driver = serial->type->usb_driver; > struct usb_interface *control_interface; > > /* Don't bind to control interface */ > if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 0) > return -ENODEV; > > /* But claim the control interface during data interface probe */ > control_interface = usb_ifnum_to_if(usb_dev, 0); > if (usb_driver_claim_interface(driver, control_interface, NULL) != 0) > dev_err(serial->interface->dev, "Can't claim control interface"); > > return 0; > } Yes, something like that, but with error handling and a '\n' added to the error message. ;) Johan