From patchwork Tue Apr 18 10:12:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yankejian X-Patchwork-Id: 751751 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3w6gR13Sd7z9s78 for ; Tue, 18 Apr 2017 19:52:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754922AbdDRJw1 (ORCPT ); Tue, 18 Apr 2017 05:52:27 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:5771 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754813AbdDRJwW (ORCPT ); Tue, 18 Apr 2017 05:52:22 -0400 Received: from 172.30.72.55 (EHLO DGGEML404-HUB.china.huawei.com) ([172.30.72.55]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AMY38712; Tue, 18 Apr 2017 17:52:19 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEML404-HUB.china.huawei.com (10.3.17.39) with Microsoft SMTP Server id 14.3.301.0; Tue, 18 Apr 2017 17:52:12 +0800 From: Yankejian To: , , , , , , , , , , CC: , , Subject: [PATCH net-next 1/3] net: hns: support deferred probe when can not obtain irq Date: Tue, 18 Apr 2017 18:12:32 +0800 Message-ID: <1492510354-11300-2-git-send-email-yankejian@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492510354-11300-1-git-send-email-yankejian@huawei.com> References: <1492510354-11300-1-git-send-email-yankejian@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.58F5E1D3.017B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d6dc4f8068c94f706c63068c6dff2c9e Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: lipeng In the hip06 and hip07 SoCs, the interrupt lines from the DSAF controllers are connected to mbigen hw module. The mbigen module is probed with module_init, and, as such, is not guaranteed to probe before the HNS driver. So we need to support deferred probe. We check for probe deferral in the hw layer probe, so we not probe into the main layer and memories, etc., to later learn that we need to defer the probe. Signed-off-by: lipeng --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index 403ea9d..2da5b42 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c @@ -2971,6 +2971,18 @@ static int hns_dsaf_probe(struct platform_device *pdev) struct dsaf_device *dsaf_dev; int ret; + /* + * Check if we should defer the probe before we probe the + * dsaf, as it's hard to defer later on. + */ + ret = platform_get_irq(pdev, 0); + if (ret < 0) { + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, "Cannot obtain irq\n"); + + return ret; + } + dsaf_dev = hns_dsaf_alloc_dev(&pdev->dev, sizeof(struct dsaf_drv_priv)); if (IS_ERR(dsaf_dev)) { ret = PTR_ERR(dsaf_dev);