OSDN Git Service

coresight: etb10: Cleanup power management
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Thu, 25 Apr 2019 19:52:47 +0000 (13:52 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Apr 2019 20:00:15 +0000 (22:00 +0200)
We drop the power before we complete the probe successfully. We
are supposed to drop it only when we are successful. Also, probing
the etb_buffer_length happens with the power turned up. So we don't
need to do that again in the helper.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-etb10.c

index 105782e..13c0a60 100644 (file)
@@ -93,17 +93,9 @@ struct etb_drvdata {
 static int etb_set_buffer(struct coresight_device *csdev,
                          struct perf_output_handle *handle);
 
-static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata)
+static inline unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata)
 {
-       u32 depth = 0;
-
-       pm_runtime_get_sync(drvdata->dev);
-
-       /* RO registers don't need locking */
-       depth = readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG);
-
-       pm_runtime_put(drvdata->dev);
-       return depth;
+       return readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG);
 }
 
 static void __etb_enable_hw(struct etb_drvdata *drvdata)
@@ -720,7 +712,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
        spin_lock_init(&drvdata->spinlock);
 
        drvdata->buffer_depth = etb_get_buffer_depth(drvdata);
-       pm_runtime_put(&adev->dev);
 
        if (drvdata->buffer_depth & 0x80000000)
                return -EINVAL;
@@ -747,6 +738,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
        if (ret)
                goto err_misc_register;
 
+       pm_runtime_put(&adev->dev);
        return 0;
 
 err_misc_register: