Skip to content

Commit

Permalink
Revert "of/irq: Support #msi-cells=<0> in of_msi_get_domain"
Browse files Browse the repository at this point in the history
This reverts commit 46f24a5.
  • Loading branch information
AK-Papon committed Nov 19, 2024
1 parent 4b743b7 commit 3f3b957
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions drivers/of/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,22 +781,42 @@ struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 rid)
* @np: device node for @dev
* @token: bus type for this domain
*
* Parse the msi-parent property and returns the corresponding MSI domain.
* Parse the msi-parent property (both the simple and the complex
* versions), and returns the corresponding MSI domain.
*
* Returns: the MSI domain for this device (or NULL on failure).
*/
struct irq_domain *of_msi_get_domain(struct device *dev,
struct device_node *np,
enum irq_domain_bus_token token)
{
struct of_phandle_iterator it;
struct device_node *msi_np;
struct irq_domain *d;
int err;

of_for_each_phandle(&it, err, np, "msi-parent", "#msi-cells", 0) {
d = irq_find_matching_host(it.node, token);
if (d)
return d;
/* Check for a single msi-parent property */
msi_np = of_parse_phandle(np, "msi-parent", 0);
if (msi_np && !of_property_read_bool(msi_np, "#msi-cells")) {
d = irq_find_matching_host(msi_np, token);
if (!d)
of_node_put(msi_np);
return d;
}

if (token == DOMAIN_BUS_PLATFORM_MSI) {
/* Check for the complex msi-parent version */
struct of_phandle_args args;
int index = 0;

while (!of_parse_phandle_with_args(np, "msi-parent",
"#msi-cells",
index, &args)) {
d = irq_find_matching_host(args.np, token);
if (d)
return d;

of_node_put(args.np);
index++;
}
}

return NULL;
Expand Down

0 comments on commit 3f3b957

Please sign in to comment.