Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp381438rwl; Wed, 29 Mar 2023 03:20:48 -0700 (PDT) X-Google-Smtp-Source: AKy350bxY+MhbyiNUCOlUfYFqHa2rko47/PKPzDdM1WVtkk5LVigELmhx2cFW/1U0sE1i1ATJKsc X-Received: by 2002:a17:906:6b8b:b0:93f:9b68:a0f4 with SMTP id l11-20020a1709066b8b00b0093f9b68a0f4mr1896610ejr.26.1680085248122; Wed, 29 Mar 2023 03:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680085248; cv=none; d=google.com; s=arc-20160816; b=FJFpm6x/Gt5YRMnEyN7VDiZI7PJ3KipN+71tcdPio+Aylz+jntPEImOaoh6O3jPpX2 FbPAKXX8FIicq/EXpkg3q/ftlqd4u5oOLbXv22UR30wOlHjk5j2VZB0FKRLes23V9meQ 2sfMVjpt1jCUNM1lJP6ArxZVmt8ziRWamkSBbzebzLyGR1KKtWckFB5YmKPkzPDBJH2f bmr2kc70YGqlQU4uzENIbDmRqziET898sW2hz1aYtLGMl6C0jx+N+9WjulQhJGG10IYW T8Yzpg6wH6O95o82jbkF/Sh2/IIE0eOlZCtwyNQJi5BR8TCcLwi6OP2fyeOwYWmht6hN TkHw== 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=HQmvGtMMLTdjqbMEv2XZmFV6DaX9boTDT1asxHgN0Wk=; b=y4QmVWb2nYBY1IGjjMfloA6yQRyKIir1Hg2l9ex0LaCQhrZDWsN1xYsq2LeG/NjCRv Zd4mdy2qpjYxW9eZuZhr+mISiChzIJ9gF8uS3BRAiRTMqSGfFPP2Ioq1oEAcJpEO2fZR M79jL0ZrXeIZTry6I8S9qJ2jLu1t78r7AQbrGD7BERFOS/8r3xz/uUq4Pch6WRW5hYMx cjwJVnwk2qKlEewEue+tQtFYhfrzJPLEf4wT/ZobdXukbtEW4Fegbzig8NsUqxyy14YP PfcoPJmiALhlUUX7PBvs+kRxo+QadjP2uQ/xR1B93LOpDKmsJm+Z4enYEeNPVjj1R9u5 f1IQ== 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 hs42-20020a1709073eaa00b00939f49a843fsi23695950ejc.176.2023.03.29.03.20.23; Wed, 29 Mar 2023 03:20:48 -0700 (PDT) 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 S231217AbjC2KOK (ORCPT + 99 others); Wed, 29 Mar 2023 06:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbjC2KOJ (ORCPT ); Wed, 29 Mar 2023 06:14:09 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A1B1B40F1; Wed, 29 Mar 2023 03:14:07 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 945FD8107; Wed, 29 Mar 2023 10:14:06 +0000 (UTC) Date: Wed, 29 Mar 2023 13:14:05 +0300 From: Tony Lindgren To: Greg Kroah-Hartman Cc: Jiri Slaby , Andy Shevchenko , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-omap@vger.kernel.org, Andy Shevchenko , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v9 1/1] serial: core: Start managing serial controllers to enable runtime PM Message-ID: <20230329101405.GQ7501@atomide.com> References: <20230323071051.2184-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 * Greg Kroah-Hartman [230329 09:19]: > On Thu, Mar 23, 2023 at 09:10:47AM +0200, Tony Lindgren wrote: > > -obj-$(CONFIG_SERIAL_CORE) += serial_core.o > > +obj-$(CONFIG_SERIAL_CORE) += serial_base.o serial_core.o serial_ctrl.o serial_port.o > > Why is this 3 new modules and not just all go into serial_base? What's > going to auto-load the other modules you created here? Feels like this > should all end up in the same .ko as they all depend on each other, > right? OK sure, I'll build them into serial_base. We now have uart_add_one_port() and uart_remove_one_port() exported in serial_port so that ends up loading the serial_base related modules. > > +struct uart_port *serial_base_get_port(struct device *dev) > > +{ > > + struct serial_base_device *sbd; > > + > > + if (!dev) > > + return NULL; > > + > > + sbd = to_serial_base_device(dev); > > + > > + /* Check in case serial_core_add_one_port() happened to fail */ > > + if (!sbd->port->state) { > > This is odd, how can it fail and then this function be called after that > failure? On uart_add_one_port(), runtime PM resume function in serial_port gets called before the port registration has completed. Sounds like I need to recheck this, maybe we can just enable runtime PM for serial_port after registration has completed. > > +/* > > + * Find a registered serial core controller device if one exists. Returns > > + * the first device matching the ctrl_id. Caller must hold port_mutex. > > + */ > > +static struct device *serial_core_ctrl_find(struct uart_driver *drv, > > + struct device *phys_dev, > > + int ctrl_id) > > +{ > > + struct uart_state *state; > > + int i; > > + > > + if (ctrl_id < 0) > > + return NULL; > > Why is a negative number special here? I think this can go, will check. > > + dev = serial_base_device_add(port, "port", ctrl_dev); > > magic strings again :) > > Do you really just want two different "types" of devices on this bus, > controllers and ports? If so, just do that, don't make the name magic > here. > > Then you can have: > serial_base_port_add() > serial_base_ctrl_add() > > and one cleanup function will still work. Yes two different types should do here, I'll take a look. > Otherwise this looks good to me, thanks for doing all of this work. OK great thanks, Tony