Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp250096imm; Thu, 14 Jun 2018 19:30:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIi0B/Q3y4GYl+FYcpW0C52TNmff9+5PqrEvn/ZOWAA5ryumPq+QVrhIBzE2TiaIo3P6xsF X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr5850814pln.114.1529029857064; Thu, 14 Jun 2018 19:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529029857; cv=none; d=google.com; s=arc-20160816; b=0aM3tMbanf6eLf/Dtbbi8ufFiPqRqizW9Uoc8mQceRAOJoIrBy44yYsa8d1vnZsd+i 9c50wIZGFVJTb99AfswGv1cMiq6NS6b5Vrzo5VvL3EVT236BpKOVJ6DeraMi/ia7VZa6 WITl9rbZ5kwLWpOxYqE8XewgHbiIgQnC6+9f4xYvIMscJvdG+qZgm8FPMm8dXt5NPEIz NUMYyzNKgU8Y3BMuA02svC3haZLm+APEFKEpzR86Z0PONlM87wnkHJltc9OBWj+BiZhG CWaUdMDYHg5FEcWXRGvEM1OSnNvi7ipqAitSyU7CyjuPOtvI/RSbhlQL6ejP4v7JVFoL yTkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=/rJwJFs63KDKg/9PvExQiVGW/giTkUjGFVl8LofL2YI=; b=skc8wUzamVCKl8DLnVIENGTw2peP1pXdHXgYl+0yAci/y7Z2642G5DV6iXT71TqMf3 419muCA3pLbYOHKf6NGIaTAOe1fMXrPNkzQ1SnQHm3UJnU+hTeM4whWY2f+OyOq7mRVu KmE6YwsVsd9T1nr1gmxFIHc05BnzEB9jv2EWuX/Nu4NYWCmmwR/6ymERsFRLQCqEJC55 sNJmrLzUWWoVN6rR0j6Sg7vmqh6NN0NXZ27OkQyDPV9esYUPTiV3y8gfIemWoIy6YBG0 1C7kMT7e/x6SFbA05g8rpYvWC4Wkxs4v4J0/ZjFTN4HQ+XMspt1Tx6xp9HMXKId6b3CZ +a5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si6690394plt.374.2018.06.14.19.30.42; Thu, 14 Jun 2018 19:30:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965174AbeFOCaT (ORCPT + 99 others); Thu, 14 Jun 2018 22:30:19 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:18279 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S936073AbeFOCaR (ORCPT ); Thu, 14 Jun 2018 22:30:17 -0400 X-UUID: 0bbd59609b514db19c7e31038fa8a231-20180615 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 79324028; Fri, 15 Jun 2018 10:30:12 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 15 Jun 2018 10:30:05 +0800 Received: from [172.21.77.33] (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 15 Jun 2018 10:30:05 +0800 Message-ID: <1529029805.29697.27.camel@mtkswgap22> Subject: Re: [PATCH v3 2/7] serdev: add dev_pm_domain_attach|detach() From: Sean Wang To: Ulf Hansson CC: Rob Herring , Mark Rutland , Marcel Holtmann , Johan Hedberg , , , Linux ARM , , Linux Kernel Mailing List , Rob Herring , Greg Kroah-Hartman , "Jiri Slaby" , Date: Fri, 15 Jun 2018 10:30:05 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-06-14 at 10:58 +0200, Ulf Hansson wrote: > On Thu, 14 Jun 2018 at 09:14, wrote: > > > > From: Sean Wang > > > > In order to open up the required power gate before any operation can be > > effectively performed over the serial bus between CPU and serdev, it's > > clearly essential to add common attach functions for PM domains to serdev > > at the probe phase. > > > > Similarly, the relevant dettach function for the PM domains should be > > properly and reversely added at the remove phase. > > > > Signed-off-by: Sean Wang > > Cc: Rob Herring > > Cc: Ulf Hansson > > Cc: Greg Kroah-Hartman > > Cc: Jiri Slaby > > Cc: linux-serial@vger.kernel.org > > --- > > drivers/tty/serdev/core.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c > > index df93b72..c93d8ee 100644 > > --- a/drivers/tty/serdev/core.c > > +++ b/drivers/tty/serdev/core.c > > @@ -13,6 +13,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > > > @@ -330,8 +331,16 @@ EXPORT_SYMBOL_GPL(serdev_device_set_tiocm); > > static int serdev_drv_probe(struct device *dev) > > { > > const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver); > > + int ret; > > + > > + ret = dev_pm_domain_attach(dev, true); > > + if (ret != -EPROBE_DEFER) { > > From 4.18 rc1 via commit 919b7308fcc4, dev_pm_domain_attach() will > return better error codes. > > I suggest to change the above error path to: > if (ret) > return ret; > > Then continue with the probing below. Thanks for sharing me the information. I'll happily respin using the patch because it makes the most sense. > > > + ret = sdrv->probe(to_serdev_device(dev)); > > + if (ret) > > + dev_pm_domain_detach(dev, true); > > + } > > > > - return sdrv->probe(to_serdev_device(dev)); > > + return ret; > > } > > > > static int serdev_drv_remove(struct device *dev) > > @@ -339,6 +348,9 @@ static int serdev_drv_remove(struct device *dev) > > const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver); > > if (sdrv->remove) > > sdrv->remove(to_serdev_device(dev)); > > + > > + dev_pm_domain_detach(dev, true); > > + > > return 0; > > } > > > > -- > > 2.7.4 > > > > Otherwise, this makes sense to me! > really thanks for your review! > Kind regards > Uffe