From 42e45a9449f1376d4decd751612a48f6db1f6e37 Mon Sep 17 00:00:00 2001 From: Robin Murphy Date: Mon, 14 Jan 2019 15:14:14 +0000 Subject: media: s5p-mfc: Fix memdev DMA configuration Having of_reserved_mem_device_init() forcibly reconfigure DMA for all callers, potentially overriding the work done by a bus-specific .dma_configure method earlier, is at best a bad idea and at worst actively harmful. If drivers really need virtual devices to own dma-coherent memory, they should explicitly configure those devices based on the appropriate firmware node as they create them. It looks like the only driver not passing in a proper OF platform device is s5p-mfc, so move the rogue of_dma_configure() call into that driver where it logically belongs. Reviewed-by: Marek Szyprowski Acked-by: Mauro Carvalho Chehab Signed-off-by: Robin Murphy Signed-off-by: Rob Herring --- drivers/of/of_reserved_mem.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/of') diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 1977ee0adcb1..9e02a5d80225 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -340,10 +340,6 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, mutex_lock(&of_rmem_assigned_device_mutex); list_add(&rd->list, &of_rmem_assigned_device_list); mutex_unlock(&of_rmem_assigned_device_mutex); - /* ensure that dma_ops is set for virtual devices - * using reserved memory - */ - of_dma_configure(dev, np, true); dev_info(dev, "assigned reserved memory node %s\n", rmem->name); } else { -- cgit From fd25ffdfd0b520f25d5c532e962dfc20d58cf4f5 Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Thu, 24 Jan 2019 15:22:13 -0800 Subject: of: unittest: remove report of expected error update_node_properties() reports an error when the test data contains a node (such as "/aliases") that already exists in the base devicetree. The error is caused by of_fdt_unflatten_tree() autogenerating the "name" property, thus both the existing node and the new node will have a property with the same name. Suppress reporting the known error. Signed-off-by: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/unittest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/of') diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 84427384654d..3249fe259d30 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1116,9 +1116,12 @@ static void update_node_properties(struct device_node *np, for (prop = np->properties; prop != NULL; prop = save_next) { save_next = prop->next; ret = of_add_property(dup, prop); - if (ret) + if (ret) { + if (ret == -EEXIST && !strcmp(prop->name, "name")) + continue; pr_err("unittest internal error: unable to add testdata property %pOF/%s", np, prop->name); + } } } -- cgit From 89716dc353bdf1ab34c3a41d3f157ce28b4fbe7d Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Thu, 24 Jan 2019 15:22:14 -0800 Subject: of: unittest: add caution to function header comment Name of function attach_node_and_children() is misleading because if the node already exists in the livetree then only the node's properties are attached. This works for the existing test data, but add comment warning of this misleading name. Signed-off-by: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/unittest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/of') diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 3249fe259d30..872956500c27 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1127,7 +1127,11 @@ static void update_node_properties(struct device_node *np, /** * attach_node_and_children - attaches nodes - * and its children to live tree + * and its children to live tree. + * CAUTION: misleading function name - if node @np already exists in + * the live tree then children of @np are *not* attached to the live + * tree. This works for the current test devicetree nodes because such + * nodes do not have child nodes. * * @np: Node to attach to live tree */ -- cgit From 221e1e0b016529f33b0d1bbf7d07c54463b55ca6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 11 Feb 2019 14:35:45 +0100 Subject: of: mark early_init_dt_alloc_reserved_memory_arch static This function is only used in of_reserved_mem.c, and never overridden despite the __weak marker. Signed-off-by: Christoph Hellwig Signed-off-by: Rob Herring --- drivers/of/of_reserved_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/of') diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 9e02a5d80225..e773063c6de9 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -26,7 +26,7 @@ static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS]; static int reserved_mem_count; -int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, +static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, phys_addr_t align, phys_addr_t start, phys_addr_t end, bool nomap, phys_addr_t *res_base) { -- cgit From 935665c1a117f34662549f01e1c9bc5ea7132556 Mon Sep 17 00:00:00 2001 From: Brendan Higgins Date: Tue, 19 Feb 2019 15:54:22 -0800 Subject: of: unittest: unflatten device tree on UML when testing UML supports enabling OF, and is useful for running the device tree tests, so add support for unflattening device tree blobs so we can actually use it. Signed-off-by: Brendan Higgins Reviewed-by: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/unittest.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/of') diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 872956500c27..66037511f2d7 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -2521,6 +2521,10 @@ static int __init of_unittest(void) int res; /* adding data for unittest */ + + if (IS_ENABLED(CONFIG_UML)) + unittest_unflatten_overlay_base(); + res = unittest_data_add(); if (res) return res; -- cgit