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>
{
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);
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;
}
{
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) {
{
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;
{
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 */);
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 */
/* 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;
};
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;