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.

Signed-off-by: Andrew Chew <achew@nvidia.com>
Change-Id: I72ffc1e8d3eb7bc0d86896e80f121d2a432abbad
Reviewed-on: http://git-master/r/145343
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Allen Martin <amartin@nvidia.com>

Rebase-Id: Rb1f9c754c85da8bb0c1171e80f597b26f40c426a

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

index c79a22d..7033fe8 100644 (file)
@@ -764,6 +764,18 @@ 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));
+}
+
 /* This is a simple wrapper around request_firmware that takes
  * 'fw_name' and if available applies a SOC relative path prefix to it.
  * The caller is responsible for calling release_firmware later.
index f665e17..ff3dd86 100644 (file)
@@ -41,5 +41,6 @@ const struct firmware *
 nvhost_client_request_firmware(struct nvhost_device *dev, const char *fw_name);
 
 int nvhost_client_device_get_resources(struct nvhost_device *dev);
+void nvhost_client_device_put_resources(struct nvhost_device *dev);
 
 #endif