Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp430059rwd; Sat, 13 May 2023 22:50:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DiwQEl/f4pJ/QrPKdWYKUdDeuXFTsXUGrBRPxeMfit7/Z99YSaAZcEGB9nWq5C6UMCNlm X-Received: by 2002:a17:903:11c9:b0:1ae:e84:268d with SMTP id q9-20020a17090311c900b001ae0e84268dmr1412562plh.25.1684043448898; Sat, 13 May 2023 22:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684043448; cv=none; d=google.com; s=arc-20160816; b=AJMV1/ua3E7XAmK+pVpPFONAaCmAzafxKNXqzbwWKE5XbUYznfbrqALYJmfqX34glm YowGVbgqhiV9RTuFOJ53px/KQxUe8lXp7Bg8u9gT5wt6xd0vaNEYyUohHH82TJ1x/nzM tAAKIuxEIFTidqMT7NoWvwx4x7eXJaO1vgudeUejtRLPWlcg4CKSp+W0H0I5Esz/8/iz QNuNuG6I64qq3dY9TCPszhdEtFUFM+hdcT9iF0awAHWBA33xuhgrk88D2nPcG5gxc6vx wWND909Y6cnJRoPt2xY89yrE93NztzfNsgvqSw6m6ZWPJiDbmF125+1uB5pXhozp6+j3 Rm0w== 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=SEgPJE6zrqay91ITMCB+bNIWiP9Kt5QL2tIKFD4He5M=; b=tqdnfHMT1cjiXzg6A/x3NemVsPU1XjYCrRmbp8k4FJvVVjP7ZD3mdl4zzrYJ4UFFLI 82mGiAfzDUOAY8fc55jZJOC6WyQcVIZM43mVOOpMdvqXdVbFkyM/0fQlXJ7aM7KSEtRH 2vP6QD6l6mEgw2ssYc4gS6BDthLyo6lJR0CXwlXnxX88abz9HxsBugxzcaPKs7LGCV35 34AEICzlA3XeLBab2SqYL5kOH6g2sJ4OONXR9CdjUdUyYn0Pob1857WCThs/BmZvlThc 0LOW98OTvOveSIcXXInyTGVr/VH26Dn5mle6F4w8V9aHcOOInFInDgCWApcvIYwz5e32 jeIw== 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 t12-20020a170902e84c00b001a97bf417cdsi14788366plg.571.2023.05.13.22.50.36; Sat, 13 May 2023 22:50: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 S231916AbjENFl1 (ORCPT + 99 others); Sun, 14 May 2023 01:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjENFlZ (ORCPT ); Sun, 14 May 2023 01:41:25 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 968C52129; Sat, 13 May 2023 22:41:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 634638106; Sun, 14 May 2023 05:41:23 +0000 (UTC) Date: Sun, 14 May 2023 08:41:22 +0300 From: Tony Lindgren To: Greg Kroah-Hartman Cc: Jiri Slaby , Andy Shevchenko , Dhruva Gole , 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 v11 1/1] serial: core: Start managing serial controllers to enable runtime PM Message-ID: <20230514054122.GH14287@atomide.com> References: <20230511065355.47525-1-tony@atomide.com> <2023051332-pretended-spoiler-61fc@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2023051332-pretended-spoiler-61fc@gregkh> 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 * Greg Kroah-Hartman [230513 11:10]: > On Thu, May 11, 2023 at 09:53:51AM +0300, Tony Lindgren wrote: > > We want to enable runtime PM for serial port device drivers in a generic > > way. To do this, we want to have the serial core layer manage the > > registered physical serial controller devices. > > > > To do this, let's set up a struct bus and struct device for the serial > > core controller as suggested by Greg and Jiri. The serial core controller > > devices are children of the physical serial port device. The serial core > > controller device is needed to support multiple different kind of ports > > connected to single physical serial port device. > > > > Let's also set up a struct device for the serial core port. The serial > > core port instances are children of the serial core controller device. > > > > With the serial core port device we can now flush pending TX on the > > runtime PM resume as suggested by Johan. > > Much better, thanks! > > One thing jumps out at me though, you are passing around "raw" struct > device pointers as the serial port structure, why? > > Shouldn't: > > > @@ -563,7 +564,8 @@ struct uart_port { > > unsigned int minor; > > resource_size_t mapbase; /* for ioremap */ > > resource_size_t mapsize; > > - struct device *dev; /* parent device */ > > + struct device *dev; /* serial port physical parent device */ > > + struct device *port_dev; /* serial core port device */ > > port_dev here be something like "struct serial_port" (or some better > name)? That way you enforce the type being passed around to the serial > code in this change which will help catch any type mistakes. > > Yes, this structure can just be a "wrapper" around 'struct device' but > at least it's a unique type. Good idea thanks, will change. > Or am I missing why this was done this way? No reason to keep it as struct device. Regards, Tony