]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: move client device node
authorShridhar Rasal <srasal@nvidia.com>
Sat, 25 Jan 2014 02:02:50 +0000 (07:32 +0530)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Tue, 4 Feb 2014 13:05:52 +0000 (05:05 -0800)
For dynamic channel mapping, when ref_count is zero,
it is unclear to which device channel maps to.

So moving channel device node to nvhost_device_data from
nvhost_channel.

Bug 1259844

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

index 8e1631cbd9f90b8cc9ff8ea53ccad6d43ff45df3..28154abed954b8d7e47e2473999826119c15f37e 100644 (file)
@@ -206,8 +206,12 @@ static int __nvhost_channelopen(struct inode *inode,
        struct nvhost_channel_userctx *priv;
        struct nvhost_device_data *pdata;
 
-       if (inode)
-               ch = container_of(inode->i_cdev, struct nvhost_channel, cdev);
+       if (inode) {
+               pdata = container_of(inode->i_cdev,
+                               struct nvhost_device_data, cdev);
+               ch = pdata->channel;
+       }
+
        ch = nvhost_getchannel(ch, false, true);
        if (!ch)
                return -ENOMEM;
@@ -1131,15 +1135,16 @@ int nvhost_client_user_init(struct platform_device *dev)
 
        /* gk20a creates the channel node by itself */
        if (pdata->class != NV_GRAPHICS_GPU_CLASS_ID) {
-               ch->node = nvhost_client_device_create(dev, &ch->cdev,
+               pdata->node = nvhost_client_device_create(dev, &pdata->cdev,
                                        "", devno, &nvhost_channelops);
-               if (ch->node == NULL)
+               if (pdata->node == NULL)
                        goto fail;
        }
 
        if (pdata->as_ops) {
                ++devno;
-               ch->as_node = nvhost_client_device_create(dev, &ch->as_cdev,
+               ch->as_node = nvhost_client_device_create(dev,
+                                       &ch->as_cdev,
                                        "as-", devno, &nvhost_asops);
                if (ch->as_node == NULL)
                        goto fail;
@@ -1190,9 +1195,9 @@ void nvhost_client_user_deinit(struct platform_device *dev)
 
        BUG_ON(!ch);
 
-       if (ch->node) {
-               device_destroy(nvhost_master->nvhost_class, ch->cdev.dev);
-               cdev_del(&ch->cdev);
+       if (pdata->node) {
+               device_destroy(nvhost_master->nvhost_class, pdata->cdev.dev);
+               cdev_del(&pdata->cdev);
        }
 
        if (ch->as_node) {
index 1ed9c9aa37a899bf0d205a64aea7757ffdb729c0..9e1ecd009a6469c09cdc7460f4b7fb7a207302f5 100644 (file)
@@ -53,9 +53,7 @@ struct nvhost_channel {
        struct mutex submitlock;
        void __iomem *aperture;
        struct nvhost_hwctx *cur_ctx;
-       struct device *node;
        struct platform_device *dev;
-       struct cdev cdev;
        struct nvhost_hwctx_handler *ctxhandler;
        struct nvhost_cdma cdma;
 
index 03e7dcb093ddf7584d833fa18d2ee75d7414f07a..7bf9e777d460ca14750e1cade8bcb68d8c4845df 100644 (file)
@@ -203,6 +203,10 @@ struct nvhost_device_data {
 
        struct nvhost_channel *channel; /* Channel assigned for the module */
 
+       /* device node for channel operations */
+       struct device *node;
+       struct cdev cdev;
+
        /* device node for ctrl block */
        struct device *ctrl_node;
        struct cdev ctrl_cdev;