Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CED24EB64D9 for ; Thu, 15 Jun 2023 11:13:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 9152AC433CD; Thu, 15 Jun 2023 11:13:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0DE6C433C8; Thu, 15 Jun 2023 11:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686827603; bh=fOx19Xs8RRUiDAplQcveGDW2O/smHP7iwC6gKnSlQUU=; h=Date:From:To:List-Id:Cc:Subject:References:In-Reply-To:From; b=TlA7J7GWAx2LR8ThmQSpTPZOQT8KMDHtB4+P6w8Fu4uWxnemS+Jc1SRb8euUDjmHX hAWr5+/aRCc6kYOg9lbUT9kGUxw4/ChpjkK6JB6/isYNwDq24k2iYwJSKWCZubxal4 Pbj2/j5n8QmFYKQxTpzQdoIMtrvTndBbnEuVKO5w= Date: Thu, 15 Jun 2023 13:11:34 +0200 From: Greg Kroah-Hartman To: Jacky Huang List-Id: Cc: Arnd Bergmann , Rob Herring , krzysztof.kozlowski+dt@linaro.org, Lee Jones , Michael Turquette , Stephen Boyd , Philipp Zabel , Jiri Slaby , Tomer Maimon , Catalin Marinas , Will Deacon , devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, soc@kernel.org, schung@nuvoton.com, mjchen@nuvoton.com, Jacky Huang Subject: Re: [PATCH v14 1/1] tty: serial: Add Nuvoton ma35d1 serial driver support Message-ID: <2023061527-visitor-edging-2614@gregkh> References: <20230612025355.547871-1-ychuang570808@gmail.com> <20230612025355.547871-2-ychuang570808@gmail.com> <2023061338-lunchbox-snorkel-e6a9@gregkh> <2023061356-matchbook-footwear-d142@gregkh> <35e768ad-7f15-48a4-9c38-09570026cf71@app.fastmail.com> <2023061555-enlighten-worshiper-c92d@gregkh> <4fd20e8d-49fd-be07-e4e5-0860fdb07125@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4fd20e8d-49fd-be07-e4e5-0860fdb07125@gmail.com> On Thu, Jun 15, 2023 at 06:46:01PM +0800, Jacky Huang wrote: > > > On 2023/6/15 下午 06:19, Greg Kroah-Hartman wrote: > > On Tue, Jun 13, 2023 at 05:44:23PM +0200, Arnd Bergmann wrote: > > > On Tue, Jun 13, 2023, at 16:49, Greg KH wrote: > > > > On Tue, Jun 13, 2023 at 06:58:32PM +0800, Jacky Huang wrote: > > > > > On 2023/6/13 下午 06:28, Greg KH wrote: > > > > > > On Mon, Jun 12, 2023 at 02:53:55AM +0000, Jacky Huang wrote: > > > > > > > From: Jacky Huang > > > > > > > > > > > > > > This adds UART and console driver for Nuvoton ma35d1 Soc. > > > > > > > It supports full-duplex communication, FIFO control, and > > > > > > > hardware flow control. > > > > > > You get a full 72 columns for your changelog :) > > > > > > > > > > > > > --- a/include/uapi/linux/serial_core.h > > > > > > > +++ b/include/uapi/linux/serial_core.h > > > > > > > @@ -279,4 +279,7 @@ > > > > > > > /* Sunplus UART */ > > > > > > > #define PORT_SUNPLUS 123 > > > > > > > +/* Nuvoton MA35 SoC */ > > > > > > > +#define PORT_MA35 124 > > > > > > > + > > > > > > Why is this change needed? What userspace code is going to rely on it? > > > > > > > > > > > > thanks, > > > > > > > > > > > > greg k-h > > > > > Because the serial driver requires a port->type, and almost all serial > > > > > drivers defined their port type here. We follow the practice of most serial > > > > > drivers here. > > > > > If we don't do it this way, we would have to directly assign a value to > > > > > port->type. However, such modifications were questioned in the past, > > > > > which is why we changed it back to defining the port type in serial_core.h. > > > > I really really want to get rid of this list, as it's a UAPI that no one > > > > uses. So please don't use it, it doesn't help anything, and while the > > > > serial driver might require it, it doesn't actually do anything with > > > > that field, right? So why don't we just set all of the values to the > > > > same one? > > > I don't see how Jacky can come up with a patch to do this correctly > > > without more specific guidance to what exactly you are looking for, > > > after the last 123 people that added support for a new port got > > > that merged. > > I keep complaining about this, when I notice it. Just use the "default" > > port type in the serial driver and don't add a new type here and it > > should just work, right? > > > > > I checked debian codesearch and found only three obscure packages that > > > accidentally include this header instead of including linux/serial.h, > > > a couple of lists of all kernel headers, and none that include it on > > > purpose. I agree that this header should really not exist in uapi, > > > but the question is what exactly to do about it. > > > > > > Possible changes would be: > > > > > > - add a special value PORT_* constant other than PORT_UNKNOWN that > > > can be used by serial drivers instead of a unique value, and > > > ensure that the serial core can handle drivers using it. > > Why do we need a special constant? > > > > > - move all values used by the 8250 driver from serial_core.h > > > to serial.h, as this driver actually uses the constants. > > Makes sense. > > > > > - Move the remaining contents of uapi/linux/serial.h into the > > > non-uapi version. > > > > > > - Change all drivers that only reference a single PORT_* > > > value to use the generic one. > > I think this is the best thing to do. > > > > thanks, > > > > greg k-h > > I will remove the definition of PORT_MA35 without modifying serial_core.h. > > However, we still need to assign a value to port->type. So, can we follow > the approach used in the LiteUART driver and directly assign port->type = 1? Works for me, thanks. greg k-h