video: tegra: nvmap: Change function declaration order.
Krishna Reddy [Tue, 22 May 2012 18:36:03 +0000 (11:36 -0700)]
Change function declaration order to avoid multiple
CONFIG_TEGRA_NVMAP #ifdef's.

Change-Id: Icb10380f8da4b8037b90e787f961a28e8528814f
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/103990
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bo Yan <byan@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/nvmap/nvmap.h

index b0fb70f..25403f5 100644 (file)
@@ -37,6 +37,8 @@ struct nvmap_device;
 struct page;
 struct tegra_iovmm_area;
 
+void _nvmap_handle_free(struct nvmap_handle *h);
+
 #if defined(CONFIG_TEGRA_NVMAP)
 #define nvmap_err(_client, _fmt, ...)                          \
        dev_err(nvmap_client_to_device(_client),                \
@@ -162,7 +164,46 @@ static inline void nvmap_ref_unlock(struct nvmap_client *priv)
 {
        mutex_unlock(&priv->ref_lock);
 }
-#endif /* CONFIG_TEGRA_NVMAP */
+
+static inline struct nvmap_handle *nvmap_handle_get(struct nvmap_handle *h)
+{
+       if (unlikely(atomic_inc_return(&h->ref) <= 1)) {
+               pr_err("%s: %s getting a freed handle\n",
+                       __func__, current->group_leader->comm);
+               if (atomic_read(&h->ref) <= 0)
+                       return NULL;
+       }
+       return h;
+}
+
+static inline void nvmap_handle_put(struct nvmap_handle *h)
+{
+       int cnt = atomic_dec_return(&h->ref);
+
+       if (WARN_ON(cnt < 0)) {
+               pr_err("%s: %s put to negative references\n",
+                       __func__, current->comm);
+       } else if (cnt == 0)
+               _nvmap_handle_free(h);
+}
+
+static inline pgprot_t nvmap_pgprot(struct nvmap_handle *h, pgprot_t prot)
+{
+       if (h->flags == NVMAP_HANDLE_UNCACHEABLE)
+               return pgprot_noncached(prot);
+       else if (h->flags == NVMAP_HANDLE_WRITE_COMBINE)
+               return pgprot_writecombine(prot);
+       else if (h->flags == NVMAP_HANDLE_INNER_CACHEABLE)
+               return pgprot_inner_writeback(prot);
+       return prot;
+}
+
+#else /* CONFIG_TEGRA_NVMAP */
+struct nvmap_handle *nvmap_handle_get(struct nvmap_handle *h);
+void nvmap_handle_put(struct nvmap_handle *h);
+pgprot_t nvmap_pgprot(struct nvmap_handle *h, pgprot_t prot);
+
+#endif /* !CONFIG_TEGRA_NVMAP */
 
 struct device *nvmap_client_to_device(struct nvmap_client *client);
 
@@ -216,51 +257,10 @@ int nvmap_pin_ids(struct nvmap_client *client,
 void nvmap_unpin_ids(struct nvmap_client *priv,
                     unsigned int nr, const unsigned long *ids);
 
-void _nvmap_handle_free(struct nvmap_handle *h);
-
 int nvmap_handle_remove(struct nvmap_device *dev, struct nvmap_handle *h);
 
 void nvmap_handle_add(struct nvmap_device *dev, struct nvmap_handle *h);
 
-#if defined(CONFIG_TEGRA_NVMAP)
-static inline struct nvmap_handle *nvmap_handle_get(struct nvmap_handle *h)
-{
-       if (unlikely(atomic_inc_return(&h->ref) <= 1)) {
-               pr_err("%s: %s getting a freed handle\n",
-                       __func__, current->group_leader->comm);
-               if (atomic_read(&h->ref) <= 0)
-                       return NULL;
-       }
-       return h;
-}
-
-static inline void nvmap_handle_put(struct nvmap_handle *h)
-{
-       int cnt = atomic_dec_return(&h->ref);
-
-       if (WARN_ON(cnt < 0)) {
-               pr_err("%s: %s put to negative references\n",
-                       __func__, current->comm);
-       } else if (cnt == 0)
-               _nvmap_handle_free(h);
-}
-
-static inline pgprot_t nvmap_pgprot(struct nvmap_handle *h, pgprot_t prot)
-{
-       if (h->flags == NVMAP_HANDLE_UNCACHEABLE)
-               return pgprot_noncached(prot);
-       else if (h->flags == NVMAP_HANDLE_WRITE_COMBINE)
-               return pgprot_writecombine(prot);
-       else if (h->flags == NVMAP_HANDLE_INNER_CACHEABLE)
-               return pgprot_inner_writeback(prot);
-       return prot;
-}
-#else /* CONFIG_TEGRA_NVMAP */
-struct nvmap_handle *nvmap_handle_get(struct nvmap_handle *h);
-void nvmap_handle_put(struct nvmap_handle *h);
-pgprot_t nvmap_pgprot(struct nvmap_handle *h, pgprot_t prot);
-#endif /* !CONFIG_TEGRA_NVMAP */
-
 int is_nvmap_vma(struct vm_area_struct *vma);
 
 struct nvmap_handle_ref *nvmap_alloc_iovm(struct nvmap_client *client,
@@ -268,4 +268,4 @@ struct nvmap_handle_ref *nvmap_alloc_iovm(struct nvmap_client *client,
 
 void nvmap_free_iovm(struct nvmap_client *client, struct nvmap_handle_ref *r);
 
-#endif
+#endif /* __VIDEO_TEGRA_NVMAP_NVMAP_H */