]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: move AS device node
authorShridhar Rasal <srasal@nvidia.com>
Mon, 27 Jan 2014 08:50:24 +0000 (14:20 +0530)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Mon, 24 Feb 2014 09:16:41 +0000 (01:16 -0800)
To make dynamic channel mapping easier, moving address space
node to nvhost_device_data.

Bug 1259844

Change-Id: I36f30e97441d26216c5536bb2bc160a9d9afc3d7
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/367105
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/bus_client.c
drivers/video/tegra/host/nvhost_as.c
drivers/video/tegra/host/nvhost_channel.h
include/linux/nvhost.h

index a7ddfb36f380a565487e1df6b5aa72052e9d6254..6ad11911af9b7b792a77710688df45dbf7a3ff83 100644 (file)
@@ -1148,9 +1148,7 @@ int nvhost_client_user_init(struct platform_device *dev)
 {
        int err, devno;
        struct nvhost_device_data *pdata = platform_get_drvdata(dev);
-       struct nvhost_channel *ch = pdata->channel;
 
-       BUG_ON(!ch);
        /* reserve 3 minor #s for <dev> and as-<dev>, and ctrl-<dev> */
 
        err = alloc_chrdev_region(&devno, 0, 5, IFACE_NAME);
@@ -1169,10 +1167,10 @@ int nvhost_client_user_init(struct platform_device *dev)
 
        if (pdata->as_ops) {
                ++devno;
-               ch->as_node = nvhost_client_device_create(dev,
-                                       &ch->as_cdev,
-                                       "as-", devno, &nvhost_asops);
-               if (ch->as_node == NULL)
+               pdata->as_node = nvhost_client_device_create(dev,
+                                               &pdata->as_cdev, "as-",
+                                               devno, &nvhost_asops);
+               if (pdata->as_node == NULL)
                        goto fail;
        }
 
@@ -1195,18 +1193,15 @@ void nvhost_client_user_deinit(struct platform_device *dev)
 {
        struct nvhost_master *nvhost_master = nvhost_get_host(dev);
        struct nvhost_device_data *pdata = platform_get_drvdata(dev);
-       struct nvhost_channel *ch = pdata->channel;
-
-       BUG_ON(!ch);
 
        if (pdata->node) {
                device_destroy(nvhost_master->nvhost_class, pdata->cdev.dev);
                cdev_del(&pdata->cdev);
        }
 
-       if (ch->as_node) {
-               device_destroy(nvhost_master->nvhost_class, ch->as_cdev.dev);
-               cdev_del(&ch->as_cdev);
+       if (pdata->as_node) {
+               device_destroy(nvhost_master->nvhost_class, pdata->as_cdev.dev);
+               cdev_del(&pdata->as_cdev);
        }
 
        if (pdata->ctrl_node) {
index 3bb3a8099dc2325170b8c81c27c4d37d0b3cb792..e2070fd6358ee30c0afb4e2faa9e6efa2d93b904 100644 (file)
@@ -37,12 +37,15 @@ int nvhost_as_dev_open(struct inode *inode, struct file *filp)
 {
        struct nvhost_as_share *as_share;
        struct nvhost_channel *ch;
+       struct nvhost_device_data *pdata;
        int err;
 
        nvhost_dbg_fn("");
 
        /* this will come from module, not channel, later */
-       ch = container_of(inode->i_cdev, struct nvhost_channel, as_cdev);
+       pdata = container_of(inode->i_cdev, struct nvhost_device_data, as_cdev);
+
+       ch = pdata->channel;
        if (!ch->as) {
                nvhost_dbg_fn("no as for the channel!");
                return -ENOENT;
@@ -70,11 +73,14 @@ int nvhost_as_dev_release(struct inode *inode, struct file *filp)
 {
        struct nvhost_as_share *as_share = filp->private_data;
        struct nvhost_channel *ch;
+       struct nvhost_device_data *pdata;
        int ret;
 
        nvhost_dbg_fn("");
 
-       ch = container_of(inode->i_cdev, struct nvhost_channel, as_cdev);
+       pdata = container_of(inode->i_cdev, struct nvhost_device_data, as_cdev);
+
+       ch = pdata->channel;
 
        ret = nvhost_as_release_share(as_share, 0/* no hwctx to release */);
 
@@ -239,7 +245,7 @@ int nvhost_as_alloc_share(struct nvhost_channel *ch,
        as_share->ch      = ch;
        as_share->as      = as;
        as_share->host    = nvhost_get_host(ch->dev);
-       as_share->as_dev  = ch->as_node;
+       as_share->as_dev  = pdata->as_node;
        as_share->id      = generate_as_share_id(as_share->as);
 
        /* call module to allocate hw resources */
index 9e1ecd009a6469c09cdc7460f4b7fb7a207302f5..3416e00c976a4068acdec208b7fba80c75eec405 100644 (file)
@@ -60,8 +60,6 @@ struct nvhost_channel {
        /* the address space block here
         * belongs to the module. but for
         * now just keep it here */
-       struct device *as_node;
-       struct cdev as_cdev;
        struct nvhost_as *as;
 };
 
index 7a2a1930898f9b2e30824bc5b664c43d5d80db3f..d993fafabaa0227a939db4da9fe23f719c5dd02a 100644 (file)
@@ -150,6 +150,10 @@ struct nvhost_device_data {
        struct device *node;
        struct cdev cdev;
 
+       /* Address space device node */
+       struct device *as_node;
+       struct cdev as_cdev;
+
        /* device node for ctrl block */
        struct device *ctrl_node;
        struct cdev ctrl_cdev;