Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1231378iog; Thu, 16 Jun 2022 01:46:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vIVCTBlvwG2SwI74iJqwO4uiclsCXVygbR4qcqDSJiu4Y5F5A4K5WjkrKU4jRUXyT+BO0J X-Received: by 2002:a05:6402:3681:b0:433:2b63:4866 with SMTP id ej1-20020a056402368100b004332b634866mr5008448edb.295.1655369162436; Thu, 16 Jun 2022 01:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655369162; cv=none; d=google.com; s=arc-20160816; b=sTrswwOEy7NR2qMrAv53aps0wRNQBZfP2Wo5fmodyCckp9MXSUlzutzVy+iloiEcbv 4wDAxBj9h0FQnBfCNDvZrOxZK5fB+RWCoaAPHE14BCLvArrfbUi+bl20BeG2GTtOQFsU j4MeOWkC2FprY/H4K0ib+hTBV5Oi2pODBgV00crL6wTqp+nDAxoOqsP4Tb7NcHdhBKZa 53NgMg0y+/RjMx/nbN9oEXIkjrLX+q9ZAXAhvwldciJwztzw6ylEst94mwr3uau6cFWR Mg0piSAQfQ6OfccH+zNxj8OMuaTc6P590Q9v4I2v+UfPJvZn5ClSD5LFp62ytC957Qcn AvzA== 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=PgLnITHUB62J0t+A7ROxjFgi3bKH+Gk0v4Chho7MZoE=; b=jicd3DPa2/LsdTDdUKESVtrc7vsGsV0DWUi/63JByCLawIvHCmDwqHExW6Q0f+66/Y wgqKw7mG/t59+yD9LeJPUL60DEkw0HvOdr2Im+Tlgh3PLdfuotW2WxCedkDivytrTqQS LDLNkFUmkDA2nuNUftjYpWS+qFmTwSg3zu+AlD0bzn4pByLAEFT6PjpDnHtK7Ni/wM5O c67AM9dl3lgASvzsyQLh8SdX9S3MnQbzurB+AXyYOFZM7ralYmFf5+Fa9D6HDuVD2b0k wJeOC5bcuYn49z8lmuQ/C/FjylGOE7VAL8XY/H4a0a46OAF+kvOY7aWAoygdl7nx0H5h 2EcA== 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 ji19-20020a170907981300b0070fe1f274a5si1025797ejc.279.2022.06.16.01.45.36; Thu, 16 Jun 2022 01:46:02 -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 S1359355AbiFPIXm (ORCPT + 99 others); Thu, 16 Jun 2022 04:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359738AbiFPIXf (ORCPT ); Thu, 16 Jun 2022 04:23:35 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15CB224598; Thu, 16 Jun 2022 01:23:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 5E738812F; Thu, 16 Jun 2022 08:18:46 +0000 (UTC) Date: Thu, 16 Jun 2022 11:23:32 +0300 From: Tony Lindgren To: Andy Shevchenko Cc: Greg Kroah-Hartman , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Jiri Slaby , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 * Andy Shevchenko [220615 09:12]: > On Wed, Jun 15, 2022 at 09:24:55AM +0300, Tony Lindgren wrote: > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > > --- a/drivers/tty/serial/serial_core.c > > +++ b/drivers/tty/serial/serial_core.c > > @@ -30,6 +32,25 @@ > > #include > > #include > > > > +/* > > + * Serial port device specific data for serial core. > > + * > > + * Each port device can have multiple ports with struct uart_state allocated > > + * for each port. The array of ports is kept in struct uart_driver. > > + */ > > +struct serial_controller { > > + struct device *dev; /* Serial port device */ > > Serial port device is a bit unclear for non-prepared reader. Perhaps add > the word "physical" or another to specify the nature of the device (because > to me "serial port device" sounds like a duplication of something in struct > uart_port, but I have doubts). Hmm so we could add a list of all the registered struct uart_port or uart_state to struct serial_controller. Then looking up struct device would be just looking at the first list entry. We need to take port_mutex, but that should be mostly when the device does runtime PM. We'll be needing that list anyways later on to flush pending TX on runtime PM resume for each port associated with the device. > > diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h > > --- a/include/linux/serial_core.h > > +++ b/include/linux/serial_core.h > > @@ -250,6 +250,7 @@ struct uart_port { > > unsigned char hub6; /* this should be in the 8250 driver */ > > unsigned char suspended; > > unsigned char console_reinit; > > + unsigned char supports_autosuspend; > > const char *name; /* port name */ > > struct attribute_group *attr_group; /* port specific attributes */ > > const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ > > @@ -285,6 +286,8 @@ enum uart_pm_state { > > * This is the state information which is persistent across opens. > > */ > > struct uart_state { > > + struct serial_controller *controller; > > While good looking here, I believe resource wise is better to leave @port to be > the first member. The rationale is to get rid of pointer arithmetics at compile > time (and I believe the port is used much more and in more critical places). > However, I dunno if it will get a lot of benefit, would be nice to see > bloat-o-meter output for your variant and my proposal. OK makes sense. And thanks for reviewing again :) Regards, Tony