Received: by 10.213.65.68 with SMTP id h4csp3355753imn; Tue, 3 Apr 2018 03:32:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Aj0/dSsOB+44JC5i+yuJOdbRZKti87fFf+1VUU5jBZ4c+8SE/LBe/PLsqRx5xSO6V9DGg X-Received: by 2002:a17:902:76cb:: with SMTP id j11-v6mr12265193plt.117.1522751554383; Tue, 03 Apr 2018 03:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522751554; cv=none; d=google.com; s=arc-20160816; b=uSzZ3zycbNsXZo4/fKJZtgZGuExNIlm2UhNmUVLqUFyHFQGfrsH7UwlQgXma8Pt8sa pfHiFAYhtjBC6Y+o0Dz3h6y4gM3iVW0H0c6VBR6GTLxR3JKUF/cYsZx7rvjZFrNK1T9V Du21Y83bNA/xY1pbrQe3HutXbS8LPEXw1k6+26qzMMawSmqp2hN5WYO0nQBakhrjVClU EIGhMWPnyRqU53IjsUdFS4pe5eObUpumXwtCAIrEUPSU5zR9odaPqfsu1gcZZdSFaYYo BvqL/If7n+vncU0BBWGK5x/kVrlINWDhEZrLEX67eR0XLBXltyAkCQPQlFQNG0GdG9VO sDbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=EYzCrEuD0BIVZxgMr6A+5hC/VQ95yvJrfAriQdrRU4M=; b=TeGHuEYWi666ixURfDoQfch33CR8qv+BrLbWsp3pbskxcJCN/D7gGWAt29SJ2FjJ8n khrRqhmXiM9zJ1J1cHvXzr6IboXZF8E4sNgeyPRoYGSJIHnQbe+d1rOxDG0VE9PpBleC as3dX13iMryQoQnDMv4IPwXwBSoCQjdlomCkqRjlfiPpeo+axtQYQEEotlhJx1HW4xOs BAy94uSGM/V85YV48xLuUst5RtCDwyIRpRojUYgprbGjsFHO0SxmDih3p5CDmfE6I+tb ggZmjUlxWgDq02Ogz7FkpIsYURUmXN/4bW/QwRaiOIy89dBVYom0gnBdSV3V/nv3mmEZ zGmw== 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 l85si1943365pfb.231.2018.04.03.03.32.20; Tue, 03 Apr 2018 03:32:34 -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 S1755258AbeDCK3f convert rfc822-to-8bit (ORCPT + 99 others); Tue, 3 Apr 2018 06:29:35 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:35788 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755098AbeDCK3d (ORCPT ); Tue, 3 Apr 2018 06:29:33 -0400 Received: from marcel-macpro.fritz.box (p4FF9F87B.dip0.t-ipconnect.de [79.249.248.123]) by mail.holtmann.org (Postfix) with ESMTPSA id 725B5CF358; Tue, 3 Apr 2018 12:35:51 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH v1 2/7] serdev: add dev_pm_domain_attach|detach() From: Marcel Holtmann In-Reply-To: Date: Tue, 3 Apr 2018 12:29:31 +0200 Cc: Rob Herring , Mark Rutland , Johan Hedberg , devicetree , Bluez mailing list , linux-arm-kernel , linux-mediatek@lists.infradead.org, LKML , Rob Herring , Ulf Hansson , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: To: sean.wang@mediatek.com X-Mailer: Apple Mail (2.3445.6.18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sean, > 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) { > + ret = sdrv->probe(to_serdev_device(dev)); > + if (ret) > + dev_pm_domain_detach(dev, true); > + } so if this is deferred, when does the serdev device gets probed? > > - 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; > } Regards Marcel