diff options
| author | Mark Brown <broonie@kernel.org> | 2026-10-20 14:16:22 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-20 14:16:22 +0100 |
| commit | f26c28d5061ba5602f60e1c08078921e76c1ec9c (patch) | |
| tree | 87bee3c3b41fc6303ee040f7c4f177726ab9186a /drivers | |
| parent | 7f669ab3d16615fff8cf7face4ed15a1ce6714e8 (diff) | |
| parent | 3db1f64a84f982f14e3e82a38f61f062cf36a4c3 (diff) | |
| download | linux-next-f26c28d5061ba5602f60e1c08078921e76c1ec9c.tar.gz linux-next-f26c28d5061ba5602f60e1c08078921e76c1ec9c.zip | |
Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/of/fdt_address.c | 2 | ||||
| -rw-r--r-- | drivers/of/irq.c | 39 | ||||
| -rw-r--r-- | drivers/of/overlay.c | 23 | ||||
| -rw-r--r-- | drivers/of/property.c | 23 |
4 files changed, 43 insertions, 44 deletions
diff --git a/drivers/of/fdt_address.c b/drivers/of/fdt_address.c index f358d2c80754..2e4e46a58cb6 100644 --- a/drivers/of/fdt_address.c +++ b/drivers/of/fdt_address.c @@ -172,7 +172,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) goto bail; bus = &of_busses[0]; - /* Cound address cells & copy address locally */ + /* Count address cells & copy address locally */ bus->count_cells(blob, parent, &na, &ns); if (!OF_CHECK_COUNTS(na, ns)) { pr_err("Bad cell count for %s\n", diff --git a/drivers/of/irq.c b/drivers/of/irq.c index ef1ed9743907..162590c1d530 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -767,34 +767,27 @@ err: } } -static int of_check_msi_parent(struct device_node *dev_node, struct device_node **msi_node) +static int of_check_msi_parent(struct device_node *dev_node, struct device_node **msi_node, + struct of_phandle_args *msi_spec) { - struct of_phandle_args msi_spec; int ret; /* * An msi-parent phandle with a missing or == 0 #msi-cells * property identifies a 1:1 ID translation mapping. * - * Set the msi controller node if the firmware matches this - * condition. + * @msi_spec keeps a reference to the target node whenever the + * phandle parses, -EINVAL included, and the caller releases it. */ ret = of_parse_phandle_with_optional_args(dev_node, "msi-parent", "#msi-cells", - 0, &msi_spec); + 0, msi_spec); if (ret) return ret; - if ((*msi_node && *msi_node != msi_spec.np) || msi_spec.args_count != 0) - ret = -EINVAL; - - if (!ret) { - /* Return with a node reference held */ - *msi_node = msi_spec.np; - return 0; - } - of_node_put(msi_spec.np); + if ((*msi_node && *msi_node != msi_spec->np) || msi_spec->args_count != 0) + return -EINVAL; - return ret; + return 0; } /** @@ -808,7 +801,9 @@ static int of_check_msi_parent(struct device_node *dev_node, struct device_node * @id_in: Device ID. * * Walk up the device hierarchy looking for devices with a "msi-map" - * or "msi-parent" property. If found, apply the mapping to @id_in. + * or "msi-parent" property. If found, apply the mapping to @id_in. With + * @msi_np non-NULL, a device declaring an msi-parent ends the walk, usable + * or not. * * Returns: The mapped MSI id. */ @@ -823,6 +818,7 @@ u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in) */ for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) { struct of_phandle_args msi_spec = {}; + int ret; if (!of_map_msi_id(parent_dev->of_node, id_in, msi_np, &msi_spec)) { if (msi_spec.np) { @@ -837,8 +833,17 @@ u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in) break; } /* -ENODEV: msi-map absent → check for msi-parent */ - if (msi_np && !of_check_msi_parent(parent_dev->of_node, msi_np)) + if (!msi_np) + continue; + + ret = of_check_msi_parent(parent_dev->of_node, msi_np, &msi_spec); + if (msi_spec.np) { + /* A declared msi-parent names the controller, usable or not */ + if (!ret && !*msi_np) + *msi_np = of_node_get(msi_spec.np); + of_node_put(msi_spec.np); break; + } } return id_out; } diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 83c56dd9b5d8..b2e1198fb41c 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -1282,26 +1282,3 @@ out: return ret; } EXPORT_SYMBOL_GPL(of_overlay_remove); - -/** - * of_overlay_remove_all() - Reverts and frees all overlay changesets - * - * Removes all overlays from the system in the correct order. - * - * Return: 0 on success, or a negative error number - */ -int of_overlay_remove_all(void) -{ - struct overlay_changeset *ovcs, *ovcs_n; - int ret; - - /* the tail of list is guaranteed to be safe to remove */ - list_for_each_entry_safe_reverse(ovcs, ovcs_n, &ovcs_list, ovcs_list) { - ret = of_overlay_remove(&ovcs->id); - if (ret) - return ret; - } - - return 0; -} -EXPORT_SYMBOL_GPL(of_overlay_remove_all); diff --git a/drivers/of/property.c b/drivers/of/property.c index 72cf12907de0..45e55f618488 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -74,7 +74,7 @@ bool of_graph_is_present(const struct device_node *node) struct device_node *port __free(device_node) = of_get_child_by_name(node, "port"); - return !!port; + return port; } EXPORT_SYMBOL(of_graph_is_present); @@ -1471,6 +1471,22 @@ static struct device_node *parse_gpio_compat(struct device_node *np, return sup_args.np; } +static struct device_node *parse_i2c_parent(struct device_node *np, + const char *prop_name, int index) +{ + if (strcmp(prop_name, "i2c-parent")) + return NULL; + + /* tc9563 (pci1179,0623) is <phandle addr>; every other user is bare phandles */ + if (of_device_is_compatible(np, "pci1179,0623")) { + if (index) + return NULL; + return of_parse_phandle(np, prop_name, 0); + } + + return of_parse_phandle(np, prop_name, index); +} + static struct device_node *parse_interrupts(struct device_node *np, const char *prop_name, int index) { @@ -1562,6 +1578,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_resets, }, { .parse_prop = parse_leds, }, { .parse_prop = parse_backlight, }, + { .parse_prop = parse_i2c_parent, }, { .parse_prop = parse_panel, }, { .parse_prop = parse_msi_parent, }, { .parse_prop = parse_pses, }, @@ -1659,12 +1676,12 @@ static bool of_is_fwnode_add_links_supported(void) return true; if (is_supported != -1) - return !!is_supported; + return is_supported; is_supported = !((match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0) || (match_property_by_path("/", "architecture", "OLPC") >= 0)); - return !!is_supported; + return is_supported; } static int of_fwnode_add_links(struct fwnode_handle *fwnode) |
