Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3523113imb; Tue, 5 Mar 2019 11:33:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyuKkhaOhx2owvqAW+EqRp8yXxsydzM4GWayX7eyC0tR1R7/zCgf/ot51gr2Pc+UpxvdJU3 X-Received: by 2002:a17:902:7c98:: with SMTP id y24mr2901116pll.191.1551814398128; Tue, 05 Mar 2019 11:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551814398; cv=none; d=google.com; s=arc-20160816; b=PLe1rN2f4uViiyrJtGSqsMmWHg773Vs4CRX0rOad9k1XRBUWFsXEZlX30dXuX8HJgV 5aPppmhAD9eTStffDgtqdCF7Jur8R39oYMouNKk2C7KrqzUWln6G2yZuyieib9EQ9hOw gjSnmG9zWiu1Yh9KX0GhQSKw3DuqXTTuqV23Ss+g+Z2kH73655f2Hpr0tv+eXYIQZZhW JxSVH2UynkVj1hV9svL7yq4Enod8EkaI5kfXDCKDHoZTuVwPdzFrcgqCotaKxLg5/nnj zhsjM9U5dO4vtpItblWoh6Z0uPf7C07RIfUtEfwQj92XlxWapV1nif9G0j0Ys9mSDjOs PmEQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=9eV+w1rVq47KEm/c+5FT1lKhow3a5EjOUVBdcY7lcDw=; b=aJdLd1EP7uGrGVqctNAU/LwJPPWpOoa0gLfZSzhP9rTLHRKRS6mqT5rlpfrSStpZ66 3iCgfO/HgcxhxX66IYgSk04nryUokr/0nQnAzgumxw3NYTm/Sy+T4BHWYA5iZ0wVlc4d 8u1pv3/rEcT3Pg+UlTob0hxJ3TgDiLaiijF52CVP7Bhgvg8oYzjfjMfACdTbrDY6vq1w E/b8oHD9s+oiBbLCnnqsBBr0SV0Cn78ZBm3NGtC8dVWCwxgsCW7awP9Qgw6mjknMcfUI /QYTIIfoR3EQrOTmuo5EsXtkHjX46Au8GSAAbcnQErMIpQ06uGVmP/XHhsIIQhHYECWu degw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HkL4i1Mk; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u185si8190085pgd.79.2019.03.05.11.33.03; Tue, 05 Mar 2019 11:33:18 -0800 (PST) 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=@chromium.org header.s=google header.b=HkL4i1Mk; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727741AbfCETDj (ORCPT + 99 others); Tue, 5 Mar 2019 14:03:39 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42647 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727216AbfCETDi (ORCPT ); Tue, 5 Mar 2019 14:03:38 -0500 Received: by mail-lf1-f68.google.com with SMTP id p1so6989800lfk.9 for ; Tue, 05 Mar 2019 11:03:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9eV+w1rVq47KEm/c+5FT1lKhow3a5EjOUVBdcY7lcDw=; b=HkL4i1MkL55mfllBwyKBifkM7QxVHKETERcfYHMqrhCEB9Vkjtn5cF4QhK20H03m/w NB89+Fz9hnc4+SoUycQdBxlFbClHwxiIZ9T2JUgXFiZCtCkNvcwVvi93WQ/c0l5IW+nG Vtp6MGDQWfdBTOmcWzmRxp9k4deVneQyxckXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9eV+w1rVq47KEm/c+5FT1lKhow3a5EjOUVBdcY7lcDw=; b=JYg6Fr34eUfHOFmJgDG4bkHFKKpvkYGdLqEOG/DAG8A7wWo7oHC4jCKaybPhNr0dKN tWMVQE1JxkYYTLil6PIwgpQtujGoCZzR63ztBr6iwYv6H7ihwDaFuWaHhK5RrzUrIhwg fNpdU0QqPhMEquSNa9vAnn9Z3YF1aEAS0HKFht+mpMksDdpCFXIuPbHJhAILWNk6ko5e EpyBkZNVEPvXVA/1czEMOGrrVs71O2qFGXAZMd4Ls03kn7R/Y6cQbqyjuJeRrxLLPaBR ke+WHTE9VDgBkArlWGcMQvjYusVBaM7veWMJ7vDUGw4uEFdJ9SEpPg212rMX9TmGf6gl 5puQ== X-Gm-Message-State: APjAAAX5Lk0sro/XiLdHpsAvRhwqVsdgfxQlJpF35C6wtzmTGf756d13 44rBIzEXO38xF9OXYDXRaaQdQ/Pal48= X-Received: by 2002:a19:d502:: with SMTP id m2mr1631533lfg.128.1551812615974; Tue, 05 Mar 2019 11:03:35 -0800 (PST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id a5sm2309621lfk.12.2019.03.05.11.03.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 11:03:35 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id z7so8581716lji.0 for ; Tue, 05 Mar 2019 11:03:34 -0800 (PST) X-Received: by 2002:a2e:9ad1:: with SMTP id p17mr118058ljj.30.1551812614556; Tue, 05 Mar 2019 11:03:34 -0800 (PST) MIME-Version: 1.0 References: <1546318276-18993-1-git-send-email-yong.wu@mediatek.com> <1546318276-18993-6-git-send-email-yong.wu@mediatek.com> <1551277985.17917.48.camel@mhfsdcap03> In-Reply-To: <1551277985.17917.48.camel@mhfsdcap03> From: Evan Green Date: Tue, 5 Mar 2019 11:02:58 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 05/13] memory: mtk-smi: Add device-link between smi-larb and smi-common To: Yong Wu Cc: Joerg Roedel , Greg Kroah-Hartman , Matthias Brugger , Rob Herring , Robin Murphy , Tomasz Figa , Will Deacon , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, Arnd Bergmann , yingjoe.chen@mediatek.com, youlin.pei@mediatek.com, Nicolas Boichat 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 Wed, Feb 27, 2019 at 6:33 AM Yong Wu wrote: > > On Mon, 2019-02-25 at 15:54 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > > > > > Normally, If the smi-larb HW need work, we should enable the smi-common > > > HW power and clock firstly. > > > This patch adds device-link between the smi-larb dev and the smi-common > > > dev. then If pm_runtime_get_sync(smi-larb-dev), the pm_runtime_get_sync > > > (smi-common-dev) will be called automatically. > > > > > > Since smi is built-in driver like IOMMU and never unbound, > > > DL_FLAG_AUTOREMOVE_* is not needed. > > > > > > CC: Matthias Brugger > > > Suggested-by: Tomasz Figa > > > Signed-off-by: Yong Wu > > > --- > > > drivers/memory/mtk-smi.c | 16 +++++++--------- > > > 1 file changed, 7 insertions(+), 9 deletions(-) > > > > > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c > > > index 9688341..30930e4 100644 > > > --- a/drivers/memory/mtk-smi.c > > > +++ b/drivers/memory/mtk-smi.c > > > @@ -271,6 +271,7 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) > > > struct device *dev = &pdev->dev; > > > struct device_node *smi_node; > > > struct platform_device *smi_pdev; > > > + struct device_link *link; > > > > > > larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL); > > > if (!larb) > > > @@ -310,6 +311,12 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) > > > if (!platform_get_drvdata(smi_pdev)) > > > return -EPROBE_DEFER; > > > larb->smi_common_dev = &smi_pdev->dev; > > > + link = device_link_add(dev, larb->smi_common_dev, > > > + DL_FLAG_PM_RUNTIME); > > > > Doesn't this need to be torn down in remove()? You mention that it's > > built-in and never removed, but it does seem to have a remove() > > The MTK IOMMU driver need depend on this SMI driver. the IOMMU is a > builtin driver, thus the SMI also should be a builtin driver. > > Technically, If the driver is builtin, then the "remove" function can be > removed? If yes, I could use a new patch do it. Yeah, I guess so. It's always sad to see cleanup code getting removed, but it makes sense to me. > > It looks the MACRO(builtin_platform_driver) only support one driver, but > we have two driver(smi-common and smi-larb) here. > > > function that tears down everything else, so it seemed a shame to > > start leaking now. Maybe the AUTOREMOVE flag would do it. > >