Netdev List
 help / color / mirror / Atom feed
From: Yankejian <yankejian@huawei.com>
To: <davem@davemloft.net>, <salil.mehta@huawei.com>,
	<yisen.zhuang@huawei.com>, <allenhuangsz10@gmail.com>,
	<lipeng321@huawei.com>, <huangdaode@hisilicon.com>,
	<hjat.hejun@huawei.com>, <zhangping5@huawei.com>,
	<qichengming@huawei.com>, <qumingguang@hisilicon.com>,
	<zhouhuiru@huawei.com>
Cc: <netdev@vger.kernel.org>, <charles.chenxin@huawei.com>,
	<linuxarm@huawei.com>
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	[thread overview]
Message-ID: <1492510354-11300-2-git-send-email-yankejian@huawei.com> (raw)
In-Reply-To: <1492510354-11300-1-git-send-email-yankejian@huawei.com>

From: lipeng <lipeng321@huawei.com>

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 <lipeng321@huawei.com>
---
 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);
-- 
1.9.1

  reply	other threads:[~2017-04-18  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 10:12 [PATCH net-next 0/3] net: hns: add deferred probe and fix a bug Yankejian
2017-04-18 10:12 ` Yankejian [this message]
2017-04-18 10:12 ` [PATCH net-next 2/3] net: hns: support deferred probe when no mdio Yankejian
2017-04-20 11:13   ` Matthias Brugger
2017-04-21  7:18     ` lipeng (Y)
2017-04-18 10:12 ` [PATCH net-next 3/3] net: hns: fixed bug that skb used after kfree Yankejian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492510354-11300-2-git-send-email-yankejian@huawei.com \
    --to=yankejian@huawei.com \
    --cc=allenhuangsz10@gmail.com \
    --cc=charles.chenxin@huawei.com \
    --cc=davem@davemloft.net \
    --cc=hjat.hejun@huawei.com \
    --cc=huangdaode@hisilicon.com \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=qichengming@huawei.com \
    --cc=qumingguang@hisilicon.com \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    --cc=zhangping5@huawei.com \
    --cc=zhouhuiru@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox