staging: ion: rockchip: add rockchip ion device
authorXu Jianqun <jay.xu@rock-chips.com>
Tue, 5 Jan 2016 09:46:02 +0000 (17:46 +0800)
committerXu Jianqun <jay.xu@rock-chips.com>
Tue, 5 Jan 2016 10:09:26 +0000 (18:09 +0800)
Add rockchip_ion_dev for other modules to use.

Change-Id: I270705dc711b93af6be6dd593858723eb853aa95
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
drivers/staging/android/ion/rockchip/rockchip_ion.c
include/linux/rockchip_ion.h

index c3e6da57de7f14f3fed16380808b04d1060c6c8d..a54a48e45a08dc6057b7ac3272c46fd4762d9fe8 100644 (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);
 
index d8b8b67bf11f0f6dd997a66bb3022265c05bbb04..39c497774fb09926e3282dbf71648777c0e6d716 100644 (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