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 <jcrouse@codeaurora.org>
This commit is contained in:
Jordan Crouse
2011-10-12 17:05:19 -06:00
committed by Stephen Boyd
parent 323102293b
commit d784ff4e9e

View File

@@ -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__ */
/**