staging: board: Set PM domain before probe
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 27 Oct 2015 14:27:26 +0000 (15:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2015 00:05:57 +0000 (09:05 +0900)
PM domains shouldn't be modified after a device is probed, so set it
before device registration to be sure of that.

In the future the PM domain pointer will be set through a setter that
will WARN if the device has been probed already.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/board/board.c

index 3eb5eb8..965afc7 100644 (file)
@@ -187,6 +187,9 @@ int __init board_staging_register_device(const struct board_staging_dev *dev)
        for (i = 0; i < dev->nclocks; i++)
                board_staging_register_clock(&dev->clocks[i]);
 
+       if (dev->domain)
+               board_staging_add_dev_domain(pdev, dev->domain);
+
        error = platform_device_register(pdev);
        if (error) {
                pr_err("Failed to register device %s (%d)\n", pdev->name,
@@ -194,9 +197,6 @@ int __init board_staging_register_device(const struct board_staging_dev *dev)
                return error;
        }
 
-       if (dev->domain)
-               board_staging_add_dev_domain(pdev, dev->domain);
-
        return error;
 }