linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: hisi_sas: support deferred probe for v2 hw
@ 2016-12-06 12:44 John Garry
  2016-12-07  5:57 ` zhangfei
  0 siblings, 1 reply; 2+ messages in thread
From: John Garry @ 2016-12-06 12:44 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: john.garry2, linuxarm, zhangfei.gao, linux-scsi, linux-kernel,
	John Garry

In the hip06 and hip07 SoCs, the interrupt lines from the
SAS controllers are connected to mbigen hw module [1].
The mbigen module is probed with module_init, and, as such,
is not guaranteed to probe before the SAS 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 allocate shost, memories, etc.,
to later learn that we need to defer the probe.

[1] ./Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt

Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index c0e7bf2..a179592 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -2971,6 +2971,18 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
 
 static int hisi_sas_v2_probe(struct platform_device *pdev)
 {
+	/*
+	 * Check if we should defer the probe before we probe the
+	 * upper layer, as it's hard to defer later on.
+	 */
+	int ret = platform_get_irq(pdev, 0);
+
+	if (ret < 0) {
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "cannot obtain irq\n");
+		return ret;
+	}
+
 	return hisi_sas_probe(pdev, &hisi_sas_v2_hw);
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: hisi_sas: support deferred probe for v2 hw
  2016-12-06 12:44 [PATCH] scsi: hisi_sas: support deferred probe for v2 hw John Garry
@ 2016-12-07  5:57 ` zhangfei
  0 siblings, 0 replies; 2+ messages in thread
From: zhangfei @ 2016-12-07  5:57 UTC (permalink / raw)
  To: John Garry, jejb, martin.petersen
  Cc: john.garry2, linuxarm, linux-scsi, linux-kernel



On 2016年12月06日 20:44, John Garry wrote:
> In the hip06 and hip07 SoCs, the interrupt lines from the
> SAS controllers are connected to mbigen hw module [1].
> The mbigen module is probed with module_init, and, as such,
> is not guaranteed to probe before the SAS 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 allocate shost, memories, etc.,
> to later learn that we need to defer the probe.
>
> [1] ./Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
>
> Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-07  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-06 12:44 [PATCH] scsi: hisi_sas: support deferred probe for v2 hw John Garry
2016-12-07  5:57 ` zhangfei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).