mfd: motorola-cpcap: Use devm_of_platform_populate()
authorBenjamin Gaignard <benjamin.gaignard@linaro.org>
Mon, 29 May 2017 15:45:58 +0000 (17:45 +0200)
committerLee Jones <lee.jones@linaro.org>
Thu, 6 Jul 2017 07:29:12 +0000 (08:29 +0100)
Usage of  devm_of_platform_populate() simplify driver code
by allowing to delete cpcap_remove().

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/motorola-cpcap.c

index 3cab58ab0b848232e16a514b14337817400c271b..d2cc1eabac05b26faaf76d21d6a18cce8ceccd68 100644 (file)
@@ -260,17 +260,7 @@ static int cpcap_probe(struct spi_device *spi)
        if (ret)
                return ret;
 
-       return of_platform_populate(spi->dev.of_node, NULL, NULL,
-                                   &cpcap->spi->dev);
-}
-
-static int cpcap_remove(struct spi_device *pdev)
-{
-       struct cpcap_ddata *cpcap = spi_get_drvdata(pdev);
-
-       of_platform_depopulate(&cpcap->spi->dev);
-
-       return 0;
+       return devm_of_platform_populate(&cpcap->spi->dev);
 }
 
 static struct spi_driver cpcap_driver = {
@@ -279,7 +269,6 @@ static struct spi_driver cpcap_driver = {
                .of_match_table = cpcap_of_match,
        },
        .probe = cpcap_probe,
-       .remove = cpcap_remove,
 };
 module_spi_driver(cpcap_driver);