Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
[sfrench/cifs-2.6.git] / drivers / hwtracing / coresight / coresight-tpiu.c
index 63d9af31f57fb66eefd416144a70a355bd8632e1..f8583e4032a6880e0cedbce384bec5f6c7c67e3e 100644 (file)
 #define FFCR_FON_MAN           BIT(6)
 #define FFCR_STOP_FI           BIT(12)
 
+DEFINE_CORESIGHT_DEVLIST(tpiu_devs, "tpiu");
+
 /**
  * @base:      memory mapped base address for this component.
- * @dev:       the device entity associated to this component.
  * @atclk:     optional clock for the core parts of the TPIU.
  * @csdev:     component vitals needed by the framework.
  */
 struct tpiu_drvdata {
        void __iomem            *base;
-       struct device           *dev;
        struct clk              *atclk;
        struct coresight_device *csdev;
 };
@@ -75,7 +75,7 @@ static int tpiu_enable(struct coresight_device *csdev, u32 mode, void *__unused)
 
        tpiu_enable_hw(drvdata);
        atomic_inc(csdev->refcnt);
-       dev_dbg(drvdata->dev, "TPIU enabled\n");
+       dev_dbg(&csdev->dev, "TPIU enabled\n");
        return 0;
 }
 
@@ -104,7 +104,7 @@ static int tpiu_disable(struct coresight_device *csdev)
 
        tpiu_disable_hw(drvdata);
 
-       dev_dbg(drvdata->dev, "TPIU disabled\n");
+       dev_dbg(&csdev->dev, "TPIU disabled\n");
        return 0;
 }
 
@@ -126,20 +126,15 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
        struct tpiu_drvdata *drvdata;
        struct resource *res = &adev->res;
        struct coresight_desc desc = { 0 };
-       struct device_node *np = adev->dev.of_node;
 
-       if (np) {
-               pdata = of_get_coresight_platform_data(dev, np);
-               if (IS_ERR(pdata))
-                       return PTR_ERR(pdata);
-               adev->dev.platform_data = pdata;
-       }
+       desc.name = coresight_alloc_device_name(&tpiu_devs, dev);
+       if (!desc.name)
+               return -ENOMEM;
 
        drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
        if (!drvdata)
                return -ENOMEM;
 
-       drvdata->dev = &adev->dev;
        drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */
        if (!IS_ERR(drvdata->atclk)) {
                ret = clk_prepare_enable(drvdata->atclk);
@@ -158,6 +153,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
        /* Disable tpiu to support older devices */
        tpiu_disable_hw(drvdata);
 
+       pdata = coresight_get_platform_data(dev);
+       if (IS_ERR(pdata))
+               return PTR_ERR(pdata);
+       dev->platform_data = pdata;
+
        desc.type = CORESIGHT_DEV_TYPE_SINK;
        desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PORT;
        desc.ops = &tpiu_cs_ops;