From patchwork Fri Apr 21 07:44:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yankejian X-Patchwork-Id: 753165 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 3w8S1664hTz9s7B for ; Fri, 21 Apr 2017 17:24:42 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1036001AbdDUHYl (ORCPT ); Fri, 21 Apr 2017 03:24:41 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5377 "EHLO dggrg02-dlp.huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1035963AbdDUHYi (ORCPT ); Fri, 21 Apr 2017 03:24:38 -0400 Received: from 172.30.72.56 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.56]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AME04558; Fri, 21 Apr 2017 15:24:35 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Fri, 21 Apr 2017 15:24:28 +0800 From: Yankejian To: , , , , , CC: , , Subject: [PATCH net v2 1/3] net: hns: support deferred probe when can not obtain irq Date: Fri, 21 Apr 2017 15:44:42 +0800 Message-ID: <1492760684-117205-2-git-send-email-yankejian@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492760684-117205-1-git-send-email-yankejian@huawei.com> References: <1492760684-117205-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.0A020206.58F9B3B4.005E, 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: be6bedd6f14026eac91774c9914a750a 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 Reviewed-by: Yisen Zhuang --- 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);