From: Xu Jianqun Date: Tue, 5 Jan 2016 09:46:02 +0000 (+0800) Subject: staging: ion: rockchip: add rockchip ion device X-Git-Tag: firefly_0821_release~3530 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dd26e2db1b8a042e8c63cd7b05eb33ed4f53bada;p=firefly-linux-kernel-4.4.55.git staging: ion: rockchip: add rockchip ion device Add rockchip_ion_dev for other modules to use. Change-Id: I270705dc711b93af6be6dd593858723eb853aa95 Signed-off-by: Xu Jianqun --- diff --git a/drivers/staging/android/ion/rockchip/rockchip_ion.c b/drivers/staging/android/ion/rockchip/rockchip_ion.c index c3e6da57de7f..a54a48e45a08 100644 --- a/drivers/staging/android/ion/rockchip/rockchip_ion.c +++ b/drivers/staging/android/ion/rockchip/rockchip_ion.c @@ -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); diff --git a/include/linux/rockchip_ion.h b/include/linux/rockchip_ion.h index d8b8b67bf11f..39c497774fb0 100644 --- a/include/linux/rockchip_ion.h +++ b/include/linux/rockchip_ion.h @@ -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