crypto: sa2ul - add device links to child devices
authorTero Kristo <t-kristo@ti.com>
Mon, 13 Jul 2020 08:34:25 +0000 (11:34 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 23 Jul 2020 07:34:17 +0000 (17:34 +1000)
The child devices for sa2ul (like the RNG) have hard dependency towards
the parent, they can't function without the parent enabled. Add device
link for this purpose so that the dependencies are taken care of properly.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/sa2ul.c

index fb4c0aba9048a855fcd7a4fed559ce585a2b7089..ebcdffcdb68610e6e101f67f531436cad2421a29 100644 (file)
@@ -2302,6 +2302,15 @@ err_dma_tx:
        return ret;
 }
 
+static int sa_link_child(struct device *dev, void *data)
+{
+       struct device *parent = data;
+
+       device_link_add(dev, parent, DL_FLAG_AUTOPROBE_CONSUMER);
+
+       return 0;
+}
+
 static int sa_ul_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
@@ -2352,6 +2361,8 @@ static int sa_ul_probe(struct platform_device *pdev)
        if (ret)
                goto release_dma;
 
+       device_for_each_child(&pdev->dev, &pdev->dev, sa_link_child);
+
        return 0;
 
 release_dma: