Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp9096254rwb; Thu, 24 Nov 2022 08:03:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5K4QKrUfuFKBiZSy/2LP5yv46uFLhT5+Qrnyf/P3lVC/K3FjRGIcHG+7hDv1z7T7PNJC/v X-Received: by 2002:a05:6402:656:b0:469:f6e2:58de with SMTP id u22-20020a056402065600b00469f6e258demr11055827edx.308.1669305792089; Thu, 24 Nov 2022 08:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669305792; cv=none; d=google.com; s=arc-20160816; b=IUn4oTT5WxwyYUoniXnxj+vrs72BXrMD9EXqZKRs1oK8Fgcu+cG56GNGxOeLKnXRj0 wp1IOJOpHkXDjAK7KAn99+v/uLQwrK28A16I8oJ9P+HgkF389l3V8nHbVmmUk/u1PRtf hkpBYa4+vIzfNOehzNROgdzhePjcesO8LDCW2D7t08XoO3g2C0izSw+EEOdiY4zGZWad KNWx/eQjWOh/1W4/tyyyg1biwhTJiV5LobLLx3oANHukqtrj0ooA0+aQqI87uItW8Yrw yBDHZim4SbdUR4qXyz0VHwQrF0i1zBnZB0kf1hA7TC7wpf1/vSEypOEu7hsmnJDYAZ05 Q1lw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=IrlajaMxHXZcAUAtOS48FSqfw5O+vM9RYANBhkGSqe0=; b=m3omvL0+9drq6U1NZqhSlTyn5VO6AAadx8Q1ZV11CmNSJaAIjEbrlM2VPDwEWq18t3 DT6NjNWeRCdMYvW2Oe5+2iUDhIpeUdCxfuC2QiEcvHfl0TwFYv8uzXRhjnHAF/Pj8zOv FEUGmM5yjXzfAqLyms5gghya1Cr+3aGP4dti0PTZyE5bP7rSaslOw//9cPbUaIYbPHex P7wH8goO2DbmiiIjgEraXhhGOAAQ3X3WpJEDoklTCUoZSjtCSS1AE7QhdMlGhmMKT58j ZiDhYL3jUHTTghvLz6Tu/7j5b5DVfKtSo3bmKAxWS/QWoek+kkzkFbUNmc/03bMUkH5t GmFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb29-20020a1709076d9d00b0078d9f1f72bcsi504442ejc.726.2022.11.24.08.02.49; Thu, 24 Nov 2022 08:03:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbiKXPhN (ORCPT + 86 others); Thu, 24 Nov 2022 10:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbiKXPhM (ORCPT ); Thu, 24 Nov 2022 10:37:12 -0500 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B9481113FF6; Thu, 24 Nov 2022 07:37:09 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id C667A80AF; Thu, 24 Nov 2022 15:37:08 +0000 (UTC) Date: Thu, 24 Nov 2022 17:37:07 +0200 From: Tony Lindgren To: Jiri Slaby Cc: Greg Kroah-Hartman , Andy Shevchenko , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] serial: core: Start managing serial controllers to enable runtime PM Message-ID: References: <20220615062455.15490-1-tony@atomide.com> <562c1505-d3bc-6422-9598-15c399e6fbba@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <562c1505-d3bc-6422-9598-15c399e6fbba@kernel.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, * Jiri Slaby [221124 06:53]: > Hi, > > I am returning to v2, as I managed to read only v3 and only now. But here > was already the point below. > > On 27. 06. 22, 15:48, Tony Lindgren wrote: > > > > Considering the above, let's improve the serial core layer so we can > > > > manage the serial port controllers better. Let's register the controllers > > > > with the serial core layer in addition to the serial ports. > > > > > > Why can't controllers be a device as well? > > > > The controllers are devices already probed by the serial port drivers. > > What's missing is mapping the ports (as devices based on the comments > > above) to the controller devices. I don't think we need another struct > > device for the serial controller in addition to the serial port driver > > device and it's child port devices. > > To be honest, I don't like the patch (even v3). We have uart_state which I > already hate and now we have another structure holding *some* other info > about a serial device (apart from uart_port). It's mess already and hard to > follow, esp. to newcomers. Yup the serial code sure is hard to follow.. > AFAIU, what Greg suggests would be: > > PCI/platform/acpi/whatever struct dev > -> serial controller 1 struct dev > -> serial port 1 struct dev (tty_port instance exists for this) > -> serial port 2 struct dev (tty_port instance exists for this) > -> ... > -> serial controller 2 struct dev > -> serial port 1 struct dev (tty_port instance exists for this) > -> serial port 2 struct dev (tty_port instance exists for this) > -> ... Oh you want the serial controller struct device as a child of the hardware controller struct device. Yeah that makes sense to put it there. I was kind of thinking we want the port devices be direct children of the hardware struct device, but I guess there is no such need. > And you are objecting that mostly (or in all cases?), there will never be > "serial controller 2"? I'm was not aware of the need for multiple serial port controllers connected to a single hardware controller struct device. Is there an example for that somewhere? Not that multiple serial controller struct devices matters with your suggestion, just wondering. > But given your description, I believe you need it anyway -- side note: does > really the PM layer/or you need it or would you be fine with "serial port N" > dev children? But provided you don't have the controller, you work around it > by struct serial_controller. So what's actually the point of the workaround > instead of sticking to proper driver model? With the workaround you seem you > have to implement all the binding, lookup and such yourself anyway. And that > renders the serial even worse :P. Let's do the reverse instead. To me it seems your suggestion actually makes things easier for runtime PM :) We can just enable runtime PM for the serial controller struct device without tinkering with the parent hardware controller struct device. > The only thing I am not sure about, whether tty_port should be struct dev > too -- and if it should have serial port 1 as a parent. But likely so. And > then with pure tty (i.e. tty_driver's, not uart_driver's), it would have > PCI/platform/acpi/whatever as a parent directly. That seems like a separate set of patches, no? Or is there some need right now to have some child struct device as a direct child of the hardware controller struct device? > In sum, the above structure makes perfect sense to me. There has only been > noone to do the real work yet. And having tty_port was a hard prerequisite > for this to happen. And that happened long time ago. All this would need a > lot of work initially¹⁾, but it paid off a lot in long term. > > ¹⁾I know what I am writing about -- I converted HID. After all, the core was > only 1000 lines patch (cf 85cdaf524b7d) + patches to convert all the drivers > incrementally (like 8c19a51591). Cool, thanks for your suggestions. Regards, Tony