Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1900917img; Wed, 27 Feb 2019 07:20:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IaRWK+LDSBSt9JKHy+ROtaNaABRR7oSgPSU9VJJMeWQLbAJGq3kV+40AgtrfAP3RcF0BlV7 X-Received: by 2002:a17:902:7202:: with SMTP id ba2mr2617784plb.147.1551280803682; Wed, 27 Feb 2019 07:20:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551280803; cv=none; d=google.com; s=arc-20160816; b=d+eCazrhH99P0SW91v3nh5lpaVQu/slqL/BcuBRmZRBkpKfvWtWbi4PRlGYb2juOZ+ NPe8hYwRH9IBIy9/C3txJRjg4h++bKg5l6MBr6ijeqUpMxfLNDHM4mA86+Wtfnzw1sdH nrrTENa3i4WGyqLellZQPeZPCaJNNF5cb+iqE/RZb1LY7Ia1/L06SZBxlU9hYGYfqSHZ OXo3gG0BGXGOo6KgX2exix9dC/DnomEJZnjB1rkDGCojJ2DKL83/mPA0yccrH2Q7r0oI uOsXPt2mv6GEVyJcHa3/tS7EwxmbHjNRsZVpqFx+0zklZ6htg1fzslvPXXm0XWsGCAlv /f7Q== 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; bh=F5LEBmOz3vCzBMzw+J+KyO7u6tcPROvPqNYm5pBrh1E=; b=iiGhSlRqFodITuu3uaoa5WnbOghQFMMURcPcC8bHG2mBPB/P/GJKtETAB9xNyKZPEi OWBqdUPAtDTEwWm0yqCcQgDAxob9yxcu9XHYj+RhXv7LmEOQjbxjiiR4hcujPMTgp5D3 x1Ss2apwjkywjvIJXmdaohPTAWttooTke9CLNO5kv5/bokuG1cyY2wq9Zv5I082iV2/C TW/vK/eStG5E0KoZWBq3aVcvnuclVrynZyAYa0bOwvM6gFK4nQue5lo+ZG/rgVvaysLh EsYgQ1qecepD9CikZHmQ8wLpuPYvX1Ss5K/ywMA+eD0Fwxe2G/VriUssw0FlelbUFtbp Qf4w== 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 13si14842465pgm.311.2019.02.27.07.19.47; Wed, 27 Feb 2019 07:20:03 -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; 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 S1730681AbfB0OdQ (ORCPT + 99 others); Wed, 27 Feb 2019 09:33:16 -0500 Received: from Mailgw01.mediatek.com ([1.203.163.78]:3774 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730222AbfB0OdQ (ORCPT ); Wed, 27 Feb 2019 09:33:16 -0500 X-UUID: f55e4a5a8f51462190eff2082b83c161-20190227 X-UUID: f55e4a5a8f51462190eff2082b83c161-20190227 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1393374690; Wed, 27 Feb 2019 22:33:07 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Feb 2019 22:33:05 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Feb 2019 22:33:05 +0800 Message-ID: <1551277985.17917.48.camel@mhfsdcap03> Subject: Re: [PATCH 05/13] memory: mtk-smi: Add device-link between smi-larb and smi-common From: Yong Wu To: Evan Green CC: Joerg Roedel , Greg Kroah-Hartman , Matthias Brugger , Rob Herring , Robin Murphy , Tomasz Figa , Will Deacon , , , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , , , Arnd Bergmann , , , Nicolas Boichat Date: Wed, 27 Feb 2019 22:33:05 +0800 In-Reply-To: References: <1546318276-18993-1-git-send-email-yong.wu@mediatek.com> <1546318276-18993-6-git-send-email-yong.wu@mediatek.com> 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 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. 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.