staging: ion: rockchip: add rockchip ion device

Add rockchip_ion_dev for other modules to use.

Change-Id: I270705dc711b93af6be6dd593858723eb853aa95
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
This commit is contained in:
Xu Jianqun
2016-01-05 17:46:02 +08:00
parent 83eee8537b
commit dd26e2db1b
2 changed files with 8 additions and 3 deletions

View File

@@ -27,7 +27,7 @@
#include "../ion_priv.h"
static struct ion_device *idev;
struct ion_device *rockchip_ion_dev;
static struct ion_heap **heaps;
struct ion_heap_desc {
@@ -229,6 +229,7 @@ static int rk_ion_probe(struct platform_device *pdev)
int err;
int i;
struct ion_platform_data *pdata = pdev->dev.platform_data;
struct ion_device *idev;
if (!pdata) {
pdata = rk_ion_of(pdev->dev.of_node);
@@ -243,6 +244,8 @@ static int rk_ion_probe(struct platform_device *pdev)
return PTR_ERR(idev);
}
rockchip_ion_dev = idev;
/* create the heaps as specified in the board file */
for (i = 0; i < pdata->nr; i++) {
struct ion_platform_heap *heap_data = &pdata->heaps[i];
@@ -286,12 +289,12 @@ static int rk_ion_remove(struct platform_device *pdev)
struct ion_client *rockchip_ion_client_create(const char *name)
{
if (!idev) {
if (!rockchip_ion_dev) {
pr_err("rockchip ion idev is NULL\n");
return NULL;
}
return ion_client_create(idev, name);
return ion_client_create(rockchip_ion_dev, name);
}
EXPORT_SYMBOL_GPL(rockchip_ion_client_create);

View File

@@ -34,6 +34,8 @@ struct ion_phys_data {
#define ION_IOC_GET_PHYS _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
struct ion_phys_data)
extern struct ion_device *rockchip_ion_dev;
struct ion_client *rockchip_ion_client_create(const char *name);
#endif