History

coresight: Make device to CPU mapping generic

The CoreSight components ETM and CPU-Debug are always associated with CPUs. Replace the of_coresight_get_cpu() with a platform agnostic helper, in preparation to add ACPI support.

Suzuki K Poulose committed 7 years ago

Commit 91824db1 parent f03631d3 files · +15 −13Browse files

Unified · Split

3 files
  1. drivers/hwtracing/coresight/coresight-cpu-debug.c +1 −2
  2. drivers/hwtracing/coresight/coresight-platform.c +13 −5
  3. include/linux/coresight.h +1 −6
drivers/hwtracing/coresight/coresight-cpu-debug.c+1−2
@@ -572,14 +572,13 @@ static int debug_probe(struct amba_device *adev, const struct amba_id *id) · 571 unmodified lines
572 struct device *dev = &adev->dev;572 struct device *dev = &adev->dev;
573 struct debug_drvdata *drvdata;573 struct debug_drvdata *drvdata;
574 struct resource *res = &adev->res;574 struct resource *res = &adev->res;
575 struct device_node *np = adev->dev.of_node;
576 int ret;575 int ret;
577 576
578 drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);577 drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
579 if (!drvdata)578 if (!drvdata)
580 return -ENOMEM;579 return -ENOMEM;
581 580
582 drvdata->cpu = np ? of_coresight_get_cpu(np) : 0;581 drvdata->cpu = coresight_get_cpu(dev);
583 if (per_cpu(debug_drvdata, drvdata->cpu)) {582 if (per_cpu(debug_drvdata, drvdata->cpu)) {
584 dev_err(dev, "CPU%d drvdata has already been initialized\n",583 dev_err(dev, "CPU%d drvdata has already been initialized\n",
585 drvdata->cpu);584 drvdata->cpu);
drivers/hwtracing/coresight/coresight-platform.c+13−5
@@ -151,12 +151,14 @@ static void of_coresight_get_ports(const struct device_node *node, · 150 unmodified lines
151 }151 }
152}152}
153 153
154int of_coresight_get_cpu(const struct device_node *node)154static int of_coresight_get_cpu(struct device *dev)
155{155{
156 int cpu;156 int cpu;
157 struct device_node *dn;157 struct device_node *dn;
158 158
159 dn = of_parse_phandle(node, "cpu", 0);159 if (!dev->of_node)
160 return 0;
161 dn = of_parse_phandle(dev->of_node, "cpu", 0);
160 /* Affinity defaults to CPU0 */162 /* Affinity defaults to CPU0 */
161 if (!dn)163 if (!dn)
162 return 0;164 return 0;
@@ -166,7 +168,6 @@ int of_coresight_get_cpu(const struct device_node *node) · 3 unmodified lines
166 /* Affinity to CPU0 if no cpu nodes are found */168 /* Affinity to CPU0 if no cpu nodes are found */
167 return (cpu < 0) ? 0 : cpu;169 return (cpu < 0) ? 0 : cpu;
168}170}
169EXPORT_SYMBOL_GPL(of_coresight_get_cpu);
170 171
171/*172/*
172 * of_coresight_parse_endpoint : Parse the given output endpoint @ep173 * of_coresight_parse_endpoint : Parse the given output endpoint @ep
@@ -240,8 +241,6 @@ static int of_get_coresight_platform_data(struct device *dev, · 67 unmodified lines
240 bool legacy_binding = false;241 bool legacy_binding = false;
241 struct device_node *node = dev->of_node;242 struct device_node *node = dev->of_node;
242 243
243 pdata->cpu = of_coresight_get_cpu(node);
244
245 /* Get the number of input and output port for this component */244 /* Get the number of input and output port for this component */
246 of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport);245 of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport);
247 246
@@ -300,6 +299,14 @@ of_get_coresight_platform_data(struct device *dev, · 52 unmodified lines
300}299}
301#endif300#endif
302 301
302int coresight_get_cpu(struct device *dev)
303{
304 if (is_of_node(dev->fwnode))
305 return of_coresight_get_cpu(dev);
306 return 0;
307}
308EXPORT_SYMBOL_GPL(coresight_get_cpu);
309
303struct coresight_platform_data *310struct coresight_platform_data *
304coresight_get_platform_data(struct device *dev)311coresight_get_platform_data(struct device *dev)
305{312{
@@ -318,6 +325,7 @@ coresight_get_platform_data(struct device *dev) · 12 unmodified lines
318 325
319 /* Use device name as sysfs handle */326 /* Use device name as sysfs handle */
320 pdata->name = dev_name(dev);327 pdata->name = dev_name(dev);
328 pdata->cpu = coresight_get_cpu(dev);
321 329
322 if (is_of_node(fwnode))330 if (is_of_node(fwnode))
323 ret = of_get_coresight_platform_data(dev, pdata);331 ret = of_get_coresight_platform_data(dev, pdata);
include/linux/coresight.h+1−6
@@ -292,12 +292,7 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} · 291 unmodified lines
292 292
293#endif293#endif
294 294
295#ifdef CONFIG_OF295extern int coresight_get_cpu(struct device *dev);
296extern int of_coresight_get_cpu(const struct device_node *node);
297#else
298static inline int of_coresight_get_cpu(const struct device_node *node)
299{ return 0; }
300#endif
301 296
302struct coresight_platform_data *coresight_get_platform_data(struct device *dev);297struct coresight_platform_data *coresight_get_platform_data(struct device *dev);
303 298

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t