mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
Devicetree for 5.2:
- Fix possible memory leak in reserved-memory failure case - Support for DMA parent bus which are not a parent node - Clang -Wunsequenced fix - Remove some unnecessary prints on memory alloc failures - Various printk msg and comment fixes - Update DT schema tools repository location - Convert simple-framebuffer binding to DT schema - Bindings for isl68137 and ir38064 trivial devices - New documentation on binding do's and don't's for binding writers to ignore -----BEGIN PGP SIGNATURE----- iQJEBAABCgAuFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAlzR2jQQHHJvYmhAa2Vy bmVsLm9yZwAKCRD6+121jbxhw1+uD/92gu3NHyncELMu7TRHubuM1P5PCAC//BEH ZOG8lopp1v27cPA3aGiSoQu/Uy+JgCjLZWiF9ZiiCvKYaKEdYPB1r7vKWtQ/G2Mk iHJPAgm7uzq0jWTh3J9h6kZkQos1zx9Qh4R81RUdoCY9cGq613Q309Vtj+zluV4Q UVq7fGUL7kDN5LDQh+gTYkX/XBk7I5F5L50RnVcgTIVGCU2DLnRmaXdyrc71N55P w0S2d9eeUIO1N4p4aVnnL1NiY5TjVoh5T6FMWaRzRXr97/YFQVZRBFHKf5AdmUw6 oBbF2wglfWohs5kz30EpuMiqB87vHHy+VbVcybIbZxHHt5wZ7JFNQhGFV74WSt+I +YvmjtKmJZ78ZHjA8wbCno+/DUMkK8Hi5Ft6k7AICDYC6MmAbkBlSIpp10rb6Jfh c4N8Aj7uWv5MRw6dcXkUalE6FBdFq98diFrxSKOlRHwOgDFhoaDBHykAmQmKWvUl hgTjLIcl8FJbsEIyrG5mqlumo6I6/GImpmKqaZ7nD3pzfTKiWi/oVsF4vz5vulY3 Q2dAHLm+UIysI3owbOstnC6tCM+r870FQ8VOPu8Kz0NKoot4ZkUajPr9uVlu5TEM KZLWZ0j4/YnBg9DoPugjkT4YywOGl9VyqFK090pqzseYJ0Lgz7dAl6/QOWkH7C1C yvX2czRWSg== =zBKC -----END PGP SIGNATURE----- Merge tag 'devicetree-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux Pull Devicetree updates from Rob Herring: - Fix possible memory leak in reserved-memory failure case - Support for DMA parent bus which are not a parent node - Clang -Wunsequenced fix - Remove some unnecessary prints on memory alloc failures - Various printk msg and comment fixes - Update DT schema tools repository location - Convert simple-framebuffer binding to DT schema - Bindings for isl68137 and ir38064 trivial devices - New documentation on binding do's and don't's for binding writers to ignore * tag 'devicetree-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (22 commits) of: unittest: Remove error printing on OOM of: irq: Remove WARN_ON() for kzalloc() failure dt-bindings: pinctrl: fix bias-pull,up typo dt-bindings: Update schema project location to devicetree.org github group of: fix clang -Wunsequenced for be32_to_cpu() of/device.c: fix the wrong comments dt-bindings: Add isl68137 as a trivial device dt-bindings: Add ir38064 as a trivial device of: del redundant type conversion dt-bindings: mfd: axp20x: Add fallback for axp805 of: Improve of_phandle_iterator_next() error message dt-bindings: connector: Spelling mistake dt-bindings: Add schemas for simple-framebuffer of: address: Add support for the parent DMA bus of: address: Retrieve a parent through a callback in __of_translate_address dt-bindings: bus: Add binding for the Allwinner MBUS controller dt-bindings: interconnect: Add a dma interconnect name of: use correct function prototype for of_overlay_fdt_apply() of: reserved_mem: fix reserve memory leak of: property: Document that of_graph_get_endpoint_by_regs needs of_node_put ...
This commit is contained in:
commit
82efe43959
28 changed files with 341 additions and 196 deletions
|
|
@ -569,6 +569,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
|
|||
* relative to that node.
|
||||
*/
|
||||
static u64 __of_translate_address(struct device_node *dev,
|
||||
struct device_node *(*get_parent)(const struct device_node *),
|
||||
const __be32 *in_addr, const char *rprop,
|
||||
struct device_node **host)
|
||||
{
|
||||
|
|
@ -585,7 +586,7 @@ static u64 __of_translate_address(struct device_node *dev,
|
|||
|
||||
*host = NULL;
|
||||
/* Get parent & match bus type */
|
||||
parent = of_get_parent(dev);
|
||||
parent = get_parent(dev);
|
||||
if (parent == NULL)
|
||||
goto bail;
|
||||
bus = of_match_bus(parent);
|
||||
|
|
@ -609,7 +610,7 @@ static u64 __of_translate_address(struct device_node *dev,
|
|||
/* Switch to parent bus */
|
||||
of_node_put(dev);
|
||||
dev = parent;
|
||||
parent = of_get_parent(dev);
|
||||
parent = get_parent(dev);
|
||||
|
||||
/* If root, we have finished */
|
||||
if (parent == NULL) {
|
||||
|
|
@ -665,7 +666,8 @@ u64 of_translate_address(struct device_node *dev, const __be32 *in_addr)
|
|||
struct device_node *host;
|
||||
u64 ret;
|
||||
|
||||
ret = __of_translate_address(dev, in_addr, "ranges", &host);
|
||||
ret = __of_translate_address(dev, of_get_parent,
|
||||
in_addr, "ranges", &host);
|
||||
if (host) {
|
||||
of_node_put(host);
|
||||
return OF_BAD_ADDR;
|
||||
|
|
@ -675,12 +677,31 @@ u64 of_translate_address(struct device_node *dev, const __be32 *in_addr)
|
|||
}
|
||||
EXPORT_SYMBOL(of_translate_address);
|
||||
|
||||
static struct device_node *__of_get_dma_parent(const struct device_node *np)
|
||||
{
|
||||
struct of_phandle_args args;
|
||||
int ret, index;
|
||||
|
||||
index = of_property_match_string(np, "interconnect-names", "dma-mem");
|
||||
if (index < 0)
|
||||
return of_get_parent(np);
|
||||
|
||||
ret = of_parse_phandle_with_args(np, "interconnects",
|
||||
"#interconnect-cells",
|
||||
index, &args);
|
||||
if (ret < 0)
|
||||
return of_get_parent(np);
|
||||
|
||||
return of_node_get(args.np);
|
||||
}
|
||||
|
||||
u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
|
||||
{
|
||||
struct device_node *host;
|
||||
u64 ret;
|
||||
|
||||
ret = __of_translate_address(dev, in_addr, "dma-ranges", &host);
|
||||
ret = __of_translate_address(dev, __of_get_dma_parent,
|
||||
in_addr, "dma-ranges", &host);
|
||||
|
||||
if (host) {
|
||||
of_node_put(host);
|
||||
|
|
@ -736,7 +757,8 @@ static u64 of_translate_ioport(struct device_node *dev, const __be32 *in_addr,
|
|||
unsigned long port;
|
||||
struct device_node *host;
|
||||
|
||||
taddr = __of_translate_address(dev, in_addr, "ranges", &host);
|
||||
taddr = __of_translate_address(dev, of_get_parent,
|
||||
in_addr, "ranges", &host);
|
||||
if (host) {
|
||||
/* host-specific port access */
|
||||
port = logic_pio_trans_hwaddr(&host->fwnode, taddr, size);
|
||||
|
|
@ -908,9 +930,15 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
|
|||
return -EINVAL;
|
||||
|
||||
while (1) {
|
||||
struct device_node *parent;
|
||||
|
||||
naddr = of_n_addr_cells(node);
|
||||
nsize = of_n_size_cells(node);
|
||||
node = of_get_next_parent(node);
|
||||
|
||||
parent = __of_get_dma_parent(node);
|
||||
of_node_put(node);
|
||||
|
||||
node = parent;
|
||||
if (!node)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1350,8 +1350,9 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
|
|||
* property data length
|
||||
*/
|
||||
if (it->cur + count > it->list_end) {
|
||||
pr_err("%pOF: arguments longer than property\n",
|
||||
it->parent);
|
||||
pr_err("%pOF: %s = %d found %d\n",
|
||||
it->parent, it->cells_name,
|
||||
count, it->cell_count);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
/**
|
||||
* of_match_device - Tell if a struct device matches an of_device_id list
|
||||
* @ids: array of of device match structures to search in
|
||||
* @matches: array of of device match structures to search in
|
||||
* @dev: the of device structure to match against
|
||||
*
|
||||
* Used by a driver to check whether an platform_device present in the
|
||||
|
|
|
|||
|
|
@ -1091,7 +1091,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
|
|||
/* Retrieve command line */
|
||||
p = of_get_flat_dt_prop(node, "bootargs", &l);
|
||||
if (p != NULL && l > 0)
|
||||
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
|
||||
strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
|
||||
|
||||
/*
|
||||
* CONFIG_CMDLINE is meant to be a default in case nothing else
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ void __init of_irq_init(const struct of_device_id *matches)
|
|||
* pointer, interrupt-parent device_node etc.
|
||||
*/
|
||||
desc = kzalloc(sizeof(*desc), GFP_KERNEL);
|
||||
if (WARN_ON(!desc)) {
|
||||
if (!desc) {
|
||||
of_node_put(np);
|
||||
goto err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
|
|||
{
|
||||
extern const struct of_device_id __reservedmem_of_table[];
|
||||
const struct of_device_id *i;
|
||||
int ret = -ENOENT;
|
||||
|
||||
for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
|
||||
reservedmem_of_init_fn initfn = i->data;
|
||||
|
|
@ -179,13 +180,14 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
|
|||
if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
|
||||
continue;
|
||||
|
||||
if (initfn(rmem) == 0) {
|
||||
ret = initfn(rmem);
|
||||
if (ret == 0) {
|
||||
pr_info("initialized node %s, compatible id %s\n",
|
||||
rmem->name, compat);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __init __rmem_cmp(const void *a, const void *b)
|
||||
|
|
@ -245,7 +247,9 @@ void __init fdt_init_reserved_mem(void)
|
|||
int len;
|
||||
const __be32 *prop;
|
||||
int err = 0;
|
||||
int nomap;
|
||||
|
||||
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
|
||||
prop = of_get_flat_dt_prop(node, "phandle", &len);
|
||||
if (!prop)
|
||||
prop = of_get_flat_dt_prop(node, "linux,phandle", &len);
|
||||
|
|
@ -255,8 +259,16 @@ void __init fdt_init_reserved_mem(void)
|
|||
if (rmem->size == 0)
|
||||
err = __reserved_mem_alloc_size(node, rmem->name,
|
||||
&rmem->base, &rmem->size);
|
||||
if (err == 0)
|
||||
__reserved_mem_init_node(rmem);
|
||||
if (err == 0) {
|
||||
err = __reserved_mem_init_node(rmem);
|
||||
if (err != 0 && err != -ENOENT) {
|
||||
pr_info("node %s compatible matching fail\n",
|
||||
rmem->name);
|
||||
memblock_free(rmem->base, rmem->size);
|
||||
if (nomap)
|
||||
memblock_add(rmem->base, rmem->size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ EXPORT_SYMBOL(of_graph_get_next_endpoint);
|
|||
*
|
||||
* Return: An 'endpoint' node pointer which is identified by reg and at the same
|
||||
* is the child of a port node identified by port_reg. reg and port_reg are
|
||||
* ignored when they are -1.
|
||||
* ignored when they are -1. Use of_node_put() on the pointer when done.
|
||||
*/
|
||||
struct device_node *of_graph_get_endpoint_by_regs(
|
||||
const struct device_node *parent, int port_reg, int reg)
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ static void __init of_unittest_check_phandles(void)
|
|||
}
|
||||
|
||||
nh = kzalloc(sizeof(*nh), GFP_KERNEL);
|
||||
if (WARN_ON(!nh))
|
||||
if (!nh)
|
||||
return;
|
||||
|
||||
nh->np = np;
|
||||
|
|
@ -1199,12 +1199,9 @@ static int __init unittest_data_add(void)
|
|||
|
||||
/* creating copy */
|
||||
unittest_data = kmemdup(__dtb_testcases_begin, size, GFP_KERNEL);
|
||||
|
||||
if (!unittest_data) {
|
||||
pr_warn("%s: Failed to allocate memory for unittest_data; "
|
||||
"not running tests\n", __func__);
|
||||
if (!unittest_data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
|
||||
if (!unittest_data_node) {
|
||||
pr_warn("%s: No tree to attach; not running tests\n", __func__);
|
||||
|
|
@ -1845,10 +1842,8 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev)
|
|||
dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
||||
|
||||
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
|
||||
if (!std) {
|
||||
dev_err(dev, "Failed to allocate unittest i2c data\n");
|
||||
if (!std)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* link them together */
|
||||
std->pdev = pdev;
|
||||
|
|
|
|||
Loading…
Reference in a new issue