Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp5023982imc; Mon, 25 Feb 2019 15:56:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYsMaKvj5WzKvs6zfCLmahjMDjq7SEf7v3h7uADQZ8Td6vKgUIGpkERPaAzYtes8D+pN1cs X-Received: by 2002:a63:4913:: with SMTP id w19mr21256569pga.394.1551139005758; Mon, 25 Feb 2019 15:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551139005; cv=none; d=google.com; s=arc-20160816; b=da2/4lEdADhOeojUmxaC82YBIzTcwPTtnKzenPnI0BMhOCUR5Fbjea73l2ZfMfJg0i 4gXBuiyiYJ+s9UIhUKSwIP6+EIWCCfcqmH56iBJMClWd0pov04kjXCLSXTeN+FRr/c4w XGZ3sdrHYEA/h/cIYLywc1s21Wure6k4vTqshR1q/GLoTga4Lc0vRNVdMRHD5d94d/TG tB8RXr/rzxXoS8f0RvCG7y4yudOw87pNVm14u406b+D3Gs6eh5r1YeTotBeZIQwP6cip a37cQCPMCz5ggov+akoa3rq1o4Smrmy8DZWvAIDfxFVlnY3NKHVo6/O4FY+QfmDArJaJ NWag== 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=dYbJU7KLt5fEwcgGrnxctZm7wSA32fxgxnmdAdViJBo=; b=qQe8GHtR1viFbNCzehlgPklB8cLM0jgVzeLhh4EVFjarq8658gPW9uh0pb1LF8Y7cO lA/FKsVs8xO6Fwil0pINc+YLtTz8PpkJ1vS/EawrmAqPB/lWasHtXnl1gm8COSy43uzq 6StcAAlbxuRsWJgnhdXD9ad+AsPoszdPhGvnLjoCx+Ymywz1P2XbvPKtTXdk+2KepgXx 79i+ZGfgyT/8jPGrhFp/TRTQaxbOtm9GzKrM6EIOcPcrFzxUNAkI5+CH985N5ZbidUeX 84km1Pb9qmZnuqB3Kdx5P0MdzScCHETrh/1vjJAEafTwzqmuJ2BMCbC1xO5F7eBPKH7p rV+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UT+ZbmKg; 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 e12si7068126pgd.381.2019.02.25.15.56.30; Mon, 25 Feb 2019 15:56:45 -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=UT+ZbmKg; 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 S1729124AbfBYXz3 (ORCPT + 99 others); Mon, 25 Feb 2019 18:55:29 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:40280 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728727AbfBYXz3 (ORCPT ); Mon, 25 Feb 2019 18:55:29 -0500 Received: by mail-lj1-f193.google.com with SMTP id w6so9088953ljd.7 for ; Mon, 25 Feb 2019 15:55:28 -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=dYbJU7KLt5fEwcgGrnxctZm7wSA32fxgxnmdAdViJBo=; b=UT+ZbmKg075BMaoRB3dhU31fxp6X1Tf7UHYXVQYaK8UAfVWUk/ZwXVhmbxnTcYJ81q c676Cv+YcqLBgfy8NFHZHV58ZwllODWoGj4WqRxk9FvCasx3FU0WjRhsuLmOREqVmxJI dtA4oDX3k8kRvxo3hDxECsOCT2ad3sKa6QnL8= 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=dYbJU7KLt5fEwcgGrnxctZm7wSA32fxgxnmdAdViJBo=; b=Je2Wbjr/S1CnBElbjTFCHD7TWiocFvUGqKrZdqoM4Np95pophsJhz8fDeXsh5pgFMl T88vF2xGmJgx7vzs8Ak3Cxfy11GImNYpkv9BbS8pGDCfWpXx0PXy2UtNn/2NEeo24/qx OWuteDRAlM/VrpP71onWqx8uQJWETjdJKMZLKlbH7sX77WiZd7z5FU5/E5L09iDfLMkQ RIWkecX06Dj6azf90reADZuf4VCz8Q8Rdd+/IS3SlUrB6ty2Lnr9Q4HR39kF53yPb4i/ /8YvxI1PoQv+/lGoCJOGb3kFVMSJkyI+eeCkkAl+loIa4N3SfNWlSmc1suy+D7Taj2Bm 2cBg== X-Gm-Message-State: AHQUAuY7Mp44nXxP6q4RpI9HJg9XoAFYf1qoRF+eIbuOON92cwRseq1O zz6ZFY4zgX/+YKiB+02fTluq73GpKyk= X-Received: by 2002:a2e:9e09:: with SMTP id e9mr5881157ljk.14.1551138927406; Mon, 25 Feb 2019 15:55:27 -0800 (PST) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id q12sm514597lfc.8.2019.02.25.15.55.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 15:55:26 -0800 (PST) Received: by mail-lj1-f174.google.com with SMTP id w6so9088908ljd.7 for ; Mon, 25 Feb 2019 15:55:26 -0800 (PST) X-Received: by 2002:a2e:99c9:: with SMTP id l9mr11481483ljj.60.1551138926072; Mon, 25 Feb 2019 15:55:26 -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> In-Reply-To: <1546318276-18993-6-git-send-email-yong.wu@mediatek.com> From: Evan Green Date: Mon, 25 Feb 2019 15:54:50 -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 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() function that tears down everything else, so it seemed a shame to start leaking now. Maybe the AUTOREMOVE flag would do it.