tegra: Add function to release resources
Andrew Chew [Wed, 1 Aug 2012 23:52:42 +0000 (16:52 -0700)]
Add a companion function to nvhost_client_device_get_resources()
called nvhost_client_device_put_resources() that does the opposite
thing. This is useful for any nvhost clients that need to be loaded
as modules, since the driver removal path will be exercised in that
case.

Change-Id: Ib5cec6fce7b05c780b135b03fcd88e068f772244
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/169833
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

drivers/video/tegra/host/bus_client.c
drivers/video/tegra/host/bus_client.h

index aaa0382..4614689 100644 (file)
@@ -658,3 +658,15 @@ fail:
 
        return -ENXIO;
 }
+
+void nvhost_client_device_put_resources(struct nvhost_device *dev)
+{
+       struct resource *r;
+
+       r = nvhost_get_resource(dev, IORESOURCE_MEM, 0);
+       BUG_ON(!r);
+
+       iounmap(dev->aperture);
+
+       release_mem_region(r->start, resource_size(r));
+}
index e95ea0b..8c7bdc9 100644 (file)
@@ -37,5 +37,6 @@ int nvhost_client_device_init(struct nvhost_device *dev);
 int nvhost_client_device_suspend(struct nvhost_device *dev);
 
 int nvhost_client_device_get_resources(struct nvhost_device *dev);
+void nvhost_client_device_put_resources(struct nvhost_device *dev);
 
 #endif