Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1735715ybe; Tue, 3 Sep 2019 02:42:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1nDMoiFwk5gZhrscZy3/06ycknxvzk+nyQtcNJn4kaPgGwJLq0ezjaqTppgKhmr2bx8ZE X-Received: by 2002:a63:d34c:: with SMTP id u12mr29775561pgi.114.1567503761958; Tue, 03 Sep 2019 02:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567503761; cv=none; d=google.com; s=arc-20160816; b=K/7R/jwZxSFo7ww/h2WgK7DvVeq/ySLaTLWf8qsFm3oL5weSV1BtX+EHn9+ePA2Rko MPPnFSdP+jlCeV578BIuO+qxTCHqgC06Vt/jA6Eb7AENLKq5A98JfviBLb5aB81/da7J hUJceWztyDho45y8J2C9X/4UuDPIW4gHwezWodDPJ2UsXDr2TJEE7cahE+Hs2HDOf129 TJqW40NXlMsfDMM4kNYaAnnLYP75jbRYF9ptehYA2/jRNdzY0QVtjm0X3ZNzrx5jxWEv kYfjVxU/UfAHvnXVfluHIl/dw0NNUTjEpAYDTtdkuEoPVWCFbKsYXKn++MQcmCh16hTB ZMhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=p0AYDqS3Am5xEJZIeKyhHmz0xmDKVuHTyBHRZ6xDbic=; b=wCOxriz8uJe94vubKsbYz7JFgagLeLjY5aQLHS2LQU/EzxcJpI9jd90Ai/0NWSsrHy Fald06jfHr+olrTsPMIJVuy6zPv1B8izCVjJ7J2QMLGw0lHEV4czW9+k+/eJ557gkNw/ +oO0RLV+Mh+F8fNtWXMM4WnSj9g5JrA3WqBV/BczYXLrkA38z7qpxDPwjwKG86ZjmAnD h1hVdRKv28kL4udWmoufqTOY3thU7TI+Y6gcaeAsmc470ziF9QWL9X4ILF12lT2K98kS AeHDwf6vx0CfNFg0RGs513Lxj27b3KJNKadZW9z2NmHxh2MAtjRXLV3TE2KqZwxPbbP6 uiKg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w198si16897265pfd.106.2019.09.03.02.42.26; Tue, 03 Sep 2019 02:42:41 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728907AbfICJjy (ORCPT + 99 others); Tue, 3 Sep 2019 05:39:54 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:22495 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728426AbfICJjx (ORCPT ); Tue, 3 Sep 2019 05:39:53 -0400 X-UUID: f291a62723c74f2f916943b3fe0e8269-20190903 X-UUID: f291a62723c74f2f916943b3fe0e8269-20190903 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1289156104; Tue, 03 Sep 2019 17:39:47 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 3 Sep 2019 17:39:47 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 3 Sep 2019 17:39:45 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , Subject: [PATCH v3 11/14] memory: mtk-smi: Use device_is_bound to check if smi-common is ready Date: Tue, 3 Sep 2019 17:37:33 +0800 Message-ID: <1567503456-24725-12-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1567503456-24725-1-git-send-email-yong.wu@mediatek.com> References: <1567503456-24725-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org smi-larb driver should run after smi-common, Use device_is_bound to confirm whether smicommon driver is ready. CC: Matthias Brugger Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 3df9036..789d2ab 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -296,8 +296,14 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) smi_pdev = of_find_device_by_node(smi_node); of_node_put(smi_node); if (smi_pdev) { - if (!platform_get_drvdata(smi_pdev)) + bool smicommon_is_bound; + + device_lock(&smi_pdev->dev); + smicommon_is_bound = device_is_bound(&smi_pdev->dev); + device_unlock(&smi_pdev->dev); + if (!smicommon_is_bound) return -EPROBE_DEFER; + larb->smi_common_dev = &smi_pdev->dev; link = device_link_add(dev, larb->smi_common_dev, DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); -- 1.9.1