diff options
Diffstat (limited to 'drivers/coresight/of_coresight.c')
-rw-r--r-- | drivers/coresight/of_coresight.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/coresight/of_coresight.c b/drivers/coresight/of_coresight.c index 5030c0734508..c3efa418a86d 100644 --- a/drivers/coresight/of_coresight.c +++ b/drivers/coresight/of_coresight.c @@ -93,7 +93,7 @@ static int of_coresight_alloc_memory(struct device *dev, if (!pdata->outports) return -ENOMEM; - /* Children connected to this component via @outport */ + /* Children connected to this component via @outports */ pdata->child_names = devm_kzalloc(dev, pdata->nr_outport * sizeof(*pdata->child_names), GFP_KERNEL); @@ -117,7 +117,7 @@ struct coresight_platform_data *of_get_coresight_platform_data( struct coresight_platform_data *pdata; struct of_endpoint endpoint, rendpoint; struct device *rdev; - struct device_node *cpu; + struct device_node *dn; struct device_node *ep = NULL; struct device_node *rparent = NULL; struct device_node *rport = NULL; @@ -126,7 +126,7 @@ struct coresight_platform_data *of_get_coresight_platform_data( if (!pdata) return ERR_PTR(-ENOMEM); - /* Use device name as debugfs handle */ + /* Use device name as sysfs handle */ pdata->name = dev_name(dev); /* Get the number of input and output port for this component */ @@ -174,7 +174,7 @@ struct coresight_platform_data *of_get_coresight_platform_data( continue; rdev = of_coresight_get_endpoint_device(rparent); - if (!dev) + if (!rdev) continue; pdata->child_names[i] = dev_name(rdev); @@ -186,14 +186,16 @@ struct coresight_platform_data *of_get_coresight_platform_data( /* Affinity defaults to CPU0 */ pdata->cpu = 0; - cpu = of_parse_phandle(node, "cpu", 0); - if (cpu) { - const u32 *mpidr; + dn = of_parse_phandle(node, "cpu", 0); + if (dn) { + const u32 *cell; int len, index; + u64 hwid; - mpidr = of_get_property(cpu, "reg", &len); - if (mpidr && len == 4) { - index = get_logical_index(be32_to_cpup(mpidr)); + cell = of_get_property(dn, "reg", &len); + if (cell) { + hwid = of_read_number(cell, of_n_addr_cells(dn)); + index = get_logical_index(hwid); if (index != -EINVAL) pdata->cpu = index; } |