Commit 850ccfe3 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

coresight: etb10: Cleanup power management

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: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1b015ef2
...@@ -93,17 +93,9 @@ struct etb_drvdata { ...@@ -93,17 +93,9 @@ struct etb_drvdata {
static int etb_set_buffer(struct coresight_device *csdev, static int etb_set_buffer(struct coresight_device *csdev,
struct perf_output_handle *handle); 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; return readl_relaxed(drvdata->base + ETB_RAM_DEPTH_REG);
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;
} }
static void __etb_enable_hw(struct etb_drvdata *drvdata) 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) ...@@ -720,7 +712,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
spin_lock_init(&drvdata->spinlock); spin_lock_init(&drvdata->spinlock);
drvdata->buffer_depth = etb_get_buffer_depth(drvdata); drvdata->buffer_depth = etb_get_buffer_depth(drvdata);
pm_runtime_put(&adev->dev);
if (drvdata->buffer_depth & 0x80000000) if (drvdata->buffer_depth & 0x80000000)
return -EINVAL; return -EINVAL;
...@@ -747,6 +738,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -747,6 +738,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
if (ret) if (ret)
goto err_misc_register; goto err_misc_register;
pm_runtime_put(&adev->dev);
return 0; return 0;
err_misc_register: err_misc_register:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment