mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
Merge "ion: msm: Assume devicetree support"
This commit is contained in:
commit
e8eaa8ee05
1 changed files with 10 additions and 30 deletions
|
|
@ -32,7 +32,6 @@ struct ion_heap_desc {
|
|||
const char *name;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct ion_heap_desc ion_heap_meta[] = {
|
||||
{
|
||||
.id = ION_SYSTEM_HEAP_ID,
|
||||
|
|
@ -79,9 +78,7 @@ static struct ion_heap_desc ion_heap_meta[] = {
|
|||
.name = ION_SECURE_CARVEOUT_HEAP_NAME,
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
#define MAKE_HEAP_TYPE_MAPPING(h) { .name = #h, \
|
||||
.heap_type = ION_HEAP_TYPE_##h, }
|
||||
|
||||
|
|
@ -330,13 +327,13 @@ out:
|
|||
|
||||
static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
|
||||
{
|
||||
struct ion_platform_data *pdata = 0;
|
||||
struct ion_platform_data *pdata = NULL;
|
||||
struct ion_platform_heap *heaps = NULL;
|
||||
struct device_node *node;
|
||||
struct platform_device *new_dev = NULL;
|
||||
const struct device_node *dt_node = pdev->dev.of_node;
|
||||
const __be32 *val;
|
||||
int ret = -EINVAL;
|
||||
int ret;
|
||||
u32 num_heaps = 0;
|
||||
int idx = 0;
|
||||
|
||||
|
|
@ -364,6 +361,7 @@ static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
|
|||
new_dev = of_platform_device_create(node, NULL, &pdev->dev);
|
||||
if (!new_dev) {
|
||||
pr_err("Failed to create device %s\n", node->name);
|
||||
ret = -EINVAL;
|
||||
goto free_heaps;
|
||||
}
|
||||
of_dma_configure(&new_dev->dev, node, true);
|
||||
|
|
@ -372,6 +370,7 @@ static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
|
|||
val = of_get_address(node, 0, NULL, NULL);
|
||||
if (!val) {
|
||||
pr_err("%s: Unable to find reg key\n", __func__);
|
||||
ret = -EINVAL;
|
||||
goto free_heaps;
|
||||
}
|
||||
pdata->heaps[idx].id = (u32)of_read_number(val, 1);
|
||||
|
|
@ -393,16 +392,6 @@ free_heaps:
|
|||
free_pdata(pdata);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
#else
|
||||
static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void free_pdata(const struct ion_platform_data *pdata)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ion_heap *get_ion_heap(int heap_id)
|
||||
{
|
||||
|
|
@ -424,20 +413,13 @@ struct ion_heap *get_ion_heap(int heap_id)
|
|||
static int msm_ion_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct ion_platform_data *pdata;
|
||||
unsigned int pdata_needs_to_be_freed;
|
||||
int err = -1;
|
||||
int i;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
pdata = msm_ion_parse_dt(pdev);
|
||||
if (IS_ERR(pdata)) {
|
||||
status = ION_INIT_FAILURE;
|
||||
return PTR_ERR(pdata);
|
||||
}
|
||||
pdata_needs_to_be_freed = 1;
|
||||
} else {
|
||||
pdata = pdev->dev.platform_data;
|
||||
pdata_needs_to_be_freed = 0;
|
||||
pdata = msm_ion_parse_dt(pdev);
|
||||
if (IS_ERR(pdata)) {
|
||||
status = ION_INIT_FAILURE;
|
||||
return PTR_ERR(pdata);
|
||||
}
|
||||
|
||||
num_heaps = pdata->nr;
|
||||
|
|
@ -470,8 +452,7 @@ static int msm_ion_probe(struct platform_device *pdev)
|
|||
|
||||
ion_device_add_heap(heaps[i]);
|
||||
}
|
||||
if (pdata_needs_to_be_freed)
|
||||
free_pdata(pdata);
|
||||
free_pdata(pdata);
|
||||
|
||||
/*
|
||||
* Publish the status at the end, so our interfaces know that they
|
||||
|
|
@ -483,8 +464,7 @@ static int msm_ion_probe(struct platform_device *pdev)
|
|||
|
||||
out:
|
||||
kfree(heaps);
|
||||
if (pdata_needs_to_be_freed)
|
||||
free_pdata(pdata);
|
||||
free_pdata(pdata);
|
||||
status = ION_INIT_FAILURE;
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue