From d784ff4e9e6b9d564eaec646c4813448fd8b5cdf Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Wed, 12 Oct 2011 17:05:19 -0600 Subject: [PATCH] gpu: ion: Add inline stubs for Ion functions Add inline stubs for in-kernel Ion functions to use when Ion is not enabled in the kernel config. Change-Id: Ic0dedbadbe4d7bab8f24763e67dd775c769b06df Signed-off-by: Jordan Crouse --- include/linux/ion.h | 70 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/include/linux/ion.h b/include/linux/ion.h index d48c5f35f5c..885917128c8 100644 --- a/include/linux/ion.h +++ b/include/linux/ion.h @@ -117,6 +117,8 @@ struct ion_platform_data { struct ion_platform_heap heaps[]; }; +#ifdef CONFIG_ION + /** * ion_reserve() - reserve memory for ion heaps if applicable * @data: platform data specifying starting physical address and @@ -249,7 +251,6 @@ int ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle); */ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd); - /** * ion_handle_get_flags - get the flags for a given handle * @@ -263,6 +264,73 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd); int ion_handle_get_flags(struct ion_client *client, struct ion_handle *handle, unsigned long *flags); +#else +static inline void ion_reserve(struct ion_platform_data *data) +{ + +} + +static inline struct ion_client *ion_client_create(struct ion_device *dev, + unsigned int heap_mask, const char *name) +{ + return ERR_PTR(-ENODEV); +} + +static inline struct ion_client *msm_ion_client_create(unsigned int heap_mask, + const char *name) +{ + return ERR_PTR(-ENODEV); +} + +static inline void ion_client_destroy(struct ion_client *client) { } + +static inline struct ion_handle *ion_alloc(struct ion_client *client, + size_t len, size_t align, unsigned int flags) +{ + return ERR_PTR(-ENODEV); +} + +static inline void ion_free(struct ion_client *client, + struct ion_handle *handle) { } + + +static inline int ion_phys(struct ion_client *client, + struct ion_handle *handle, ion_phys_addr_t *addr, size_t *len) +{ + return -ENODEV; +} + +static inline struct sg_table *ion_sg_table(struct ion_client *client, + struct ion_handle *handle) +{ + return ERR_PTR(-ENODEV); +} + +static inline void *ion_map_kernel(struct ion_client *client, + struct ion_handle *handle, unsigned long flags) +{ + return ERR_PTR(-ENODEV); +} + +static inline void ion_unmap_kernel(struct ion_client *client, + struct ion_handle *handle) { } + +static inline int ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle) +{ + return -ENODEV; +} + +static inline struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd) +{ + return ERR_PTR(-ENODEV); +} + +static inline int ion_handle_get_flags(struct ion_client *client, + struct ion_handle *handle, unsigned long *flags) +{ + return -ENODEV; +} +#endif /* CONFIG_ION */ #endif /* __KERNEL__ */ /**