staging: fsl-dpaa2/eth: Defer probing if no MC portal available
authorIoana Radulescu <ruxandra.radulescu@nxp.com>
Tue, 20 Mar 2018 12:04:46 +0000 (07:04 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 17:15:34 +0000 (18:15 +0100)
MC portals may not be available at the initial probing attempt
due to dependencies on other modules.

Check the return value of the MC portal allocation function and
defer probing in case it's not available yet. For all other error
cases the behaviour stays the same.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Suggested-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c

index f013af61c4473425368463e97817e7e74d671b8a..ac1a7504266457b1b1d6c7363db81c66eb26b531 100644 (file)
@@ -2441,7 +2441,10 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev)
        err = fsl_mc_portal_allocate(dpni_dev, FSL_MC_IO_ATOMIC_CONTEXT_PORTAL,
                                     &priv->mc_io);
        if (err) {
-               dev_err(dev, "MC portal allocation failed\n");
+               if (err == -ENXIO)
+                       err = -EPROBE_DEFER;
+               else
+                       dev_err(dev, "MC portal allocation failed\n");
                goto err_portal_alloc;
        }