Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6047942imm; Wed, 27 Jun 2018 01:01:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKno2uas2bUa2btAKCnwavy6IpHNtaGJzLz3x/iDCmRbZQBWsNIhvA4NlMjM6xnRkZhEawl X-Received: by 2002:a17:902:2924:: with SMTP id g33-v6mr5235668plb.26.1530086499435; Wed, 27 Jun 2018 01:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530086499; cv=none; d=google.com; s=arc-20160816; b=zLm/53GBCY4iAvtMP1dnmsKo5mXjcssk53gWB8XbaO6JiNz1P39xiJoBqSaW2yuliF yZRXH2MxBCetTOHXye7uh28yWMN/XpSEn1Mg8p3qUC6V+gSqr8xr+ulCdu4iFOaj+hwb UMuTMUNgRvRxjCP9wmWfPv0ltMTcS4xPKaJaBFrxSNAhkpauDt1o2kVlVsEhhCyBoTUf QzvSlUza4iasCyF80mNpLolzecqgH9GqrkppS86j76UkoWPTb8J0Gx21c0aCvY4/j3d6 z+nDDMaMiuy8vKf4eiBG0SjrSUGEzcE56MCymm3GouNS9TVE91UBK2i0vbsfphgmxcRL t1hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Y8NCbZQLRZIKhes2Leln1qXGmPc1uE94VXhJVKW8aKw=; b=mzTCTuM70zFJ523XdL2kCSjSL0hJw1+f6B0uXbdbeOeZVJHYHbiOKXDdR5AzaxhvnU lIplLicRvbmgTBVPYv7Q0QxOErdgjsuFGjfs6aHXASOPAYoG/KfGc8f4SBa3GvmCBcPR kk1HJgqnuNvl/x3HuO8kMJVoB1HIQ487Be8PAkegEQ3/Tqs6xhLv3h/3Bmc9VAF3JADA Fcn6YPLRqgv3hU438VAvM7O3uc9hyQ04vW1X/yDU9oC6ELK1aqHl3zvEuEq6B//YsshA rO8oktPJwscTLGUAwiG2uogBX/mnwCUmEuH92c6twmTyvKzcaFAIHeNCuISKb4zia41X 3Rtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cVwuMxqn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14-v6si3315949plr.244.2018.06.27.01.01.20; Wed, 27 Jun 2018 01:01:39 -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; dkim=pass header.i=@linaro.org header.s=google header.b=cVwuMxqn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933107AbeF0IAL (ORCPT + 99 others); Wed, 27 Jun 2018 04:00:11 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:38472 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932986AbeF0IAJ (ORCPT ); Wed, 27 Jun 2018 04:00:09 -0400 Received: by mail-it0-f67.google.com with SMTP id v83-v6so6091664itc.3 for ; Wed, 27 Jun 2018 01:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Y8NCbZQLRZIKhes2Leln1qXGmPc1uE94VXhJVKW8aKw=; b=cVwuMxqnx8odHvDT3B+Bwb0EMzW1meAb4/PvpGuePRKNnzfymcHs/qYXl1E/Nzj8FU XKx8DTBahIhFvGUrbAZTs4WldEc2mbSyEHiIxJIMTdckICchvC0YSYe1q9XNjt5zkINt Otf8hwYU6xwPRfot+6DcBfGzun1LGz+nUHyKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Y8NCbZQLRZIKhes2Leln1qXGmPc1uE94VXhJVKW8aKw=; b=g87YJgypQBDbNPPGowEbJ3eyPaP3FF8FHiqgAfOE+NfR9t2z9tFHKbavInlFyWYS+D 6aLVsnU9Z49+Gvx3/gY6JAhS+O9+uDtdyh2Z9kXWbYK1RIHz+ZzWO9CnfwoMXX47IAe5 cbSWzn8sdhf2HJSxk/CL9bDBL69zWluG9YeC2syGS9VgsqoxrVXxA/9CpZH0258tVc9D ERWUZXzK8pYZrFg6AV2vqv5MJHR+WHj8XiqbIGKMJoJ20QfWgWxUma6/LozFuUmrST75 hUOv9P69rvigeU4+9qzkIt/5sQwNEITyq+6WXHqPRTdLA9Nx0UvqktWawbh0peKM0lNS /qWg== X-Gm-Message-State: APt69E38jG+1liqdQglZHBm3j2uFOFqrBNqUS1iAURYzNra9qJNzut6r 49Bsc0jGrRnALHzEuWTXTRaD9GVK1EatQwGn3A1mkQ== X-Received: by 2002:a24:69cb:: with SMTP id e194-v6mr4386220itc.102.1530086408571; Wed, 27 Jun 2018 01:00:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:818f:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 01:00:08 -0700 (PDT) In-Reply-To: References: From: Ulf Hansson Date: Wed, 27 Jun 2018 10:00:08 +0200 Message-ID: Subject: Re: [PATCH v4 2/7] serdev: add dev_pm_domain_attach|detach() To: sean.wang@mediatek.com Cc: Rob Herring , Mark Rutland , Marcel Holtmann , Johan Hedberg , devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org, Linux ARM , linux-mediatek@lists.infradead.org, Linux Kernel Mailing List , Rob Herring , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27 June 2018 at 07:43, 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 Reviewed-by: Ulf Hansson Kind regards Uffe > --- > drivers/tty/serdev/core.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c > index df93b72..8096138 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,17 @@ 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; > > - return sdrv->probe(to_serdev_device(dev)); > + ret = dev_pm_domain_attach(dev, true); > + if (ret) > + return ret; > + > + ret = sdrv->probe(to_serdev_device(dev)); > + if (ret) > + dev_pm_domain_detach(dev, true); > + > + return ret; > } > > static int serdev_drv_remove(struct device *dev) > @@ -339,6 +349,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 >