]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: add slave_initialized flag
authorBryan Wu <pengw@nvidia.com>
Mon, 7 Oct 2013 22:17:33 +0000 (15:17 -0700)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Wed, 23 Oct 2013 08:08:56 +0000 (01:08 -0700)
A slave platform_device will be registered when we initialize the
master device. But if modprobe to init master device again, it will
try to initialize slave platform device again then oops happens.

And if we registered a platform_device in kernel, we normally don't
release it. So introduce a flag of nvhost_device_data to indicate
the status of slave and skip the slave init.

Bug 1377330

Change-Id: Ia4dfe6f8046952e2642343d23e39a14b6eb021b4
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/289326
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/bus_client.c
include/linux/nvhost.h

index e2a3f99d5d6065878207f512ddc2a3bcc9291080..4b143c72c1452dc08c5e224f8095c346a6f70b1a 100644 (file)
@@ -1282,9 +1282,10 @@ int nvhost_client_device_init(struct platform_device *dev)
 
        dev_info(&dev->dev, "initialized\n");
 
-       if (pdata->slave) {
+       if (pdata->slave && !pdata->slave_initialized) {
                pdata->slave->dev.parent = dev->dev.parent;
                platform_device_register(pdata->slave);
+               pdata->slave_initialized = 1;
        }
 
        return 0;
index f2ecd951a832145879dbe5b4c857aff3e2c4616d..631efd153218eb46b159f4b21d163c8102abd4dc 100644 (file)
@@ -189,6 +189,7 @@ struct nvhost_device_data {
 
        struct platform_device *master; /* Master of a slave device */
        struct platform_device *slave;  /* Slave device to create in probe */
+       int             slave_initialized;
 
        int             num_clks;       /* Number of clocks opened for dev */
        struct clk      *clk[NVHOST_MODULE_MAX_CLOCKS];