diff options
author | Mayuresh Kulkarni <mkulkarni@nvidia.com> | 2012-05-14 14:38:22 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-05-17 06:13:18 -0700 |
commit | a3b39fa6020e7c53236a50bbda1ca0a2ab78b2c2 (patch) | |
tree | 26fcb40c85645ef6ad1004ee65a3e28da8061288 /drivers/video/tegra/host/nvhost_channel.c | |
parent | e6ce6a3069e2a83c0343d6de8656aee95c6b49f3 (diff) |
video: tegra: host: remove nvhost_channel from nvhost_master
- nvhost_master holds a reference to all the channels for
a chip architecture
- however, nvhost_master is a private data of host1x hardware
device. so it should contain only members needed by host1x
hardware device
- add chip specific apis to allocate and free channels
- this will also help to remove the static binding between
nvhost_device and a channel per SoC in future
Bug 871237
Change-Id: I2148db57b995b4cb60954ebb6e670f588552eca4
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/91687
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/nvhost_channel.c')
-rw-r--r-- | drivers/video/tegra/host/nvhost_channel.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/video/tegra/host/nvhost_channel.c b/drivers/video/tegra/host/nvhost_channel.c index e09f50a6694e..8b79479bdc1a 100644 --- a/drivers/video/tegra/host/nvhost_channel.c +++ b/drivers/video/tegra/host/nvhost_channel.c @@ -125,3 +125,29 @@ int nvhost_channel_suspend(struct nvhost_channel *ch) return ret; } + +struct nvhost_channel *nvhost_alloc_channel_internal(int chindex, + int max_channels, int *current_channel_count) +{ + struct nvhost_channel *ch = NULL; + + if ( (chindex > max_channels) || + ( (*current_channel_count + 1) > max_channels) ) + return NULL; + else { + ch = kzalloc(sizeof(*ch), GFP_KERNEL); + if (ch == NULL) + return NULL; + else { + (*current_channel_count)++; + return ch; + } + } +} + +void nvhost_free_channel_internal(struct nvhost_channel *ch, + int *current_channel_count) +{ + kfree(ch); + (*current_channel_count)--; +} |