Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7aa279e8 authored by Charan Teja Reddy's avatar Charan Teja Reddy Committed by Gerrit - the friendly Code Review server
Browse files

coresight: place pm_runtime_put() properly



When we register coresight device to the amba bus, before calling
driver probe, clocks will be enabled by the amba bus framework and
disabled only in failure cases returned by driver probe. So, ensure not
to call the pm_runtime_put, which also disables the clocks, in probe
failure cases. Otherwise clocks gets disabled twice, once by amba bus
framework and then by the pm_runtime_put, that leads to the loss of
the clock vote by the previous coresight module, if any.

Change-Id: Ied492303458ad12acb65bf2e80fb30efc5fee837
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
parent ac121119
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2012,2018 The Linux Foundation. All rights reserved.
 *
 * Description: CoreSight Embedded Trace Buffer driver
 *
@@ -686,7 +686,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;
@@ -712,6 +711,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
	ret = misc_register(&drvdata->miscdev);
	if (ret)
		goto err_misc_register;
	pm_runtime_put(&adev->dev);

	return 0;

+4 −2
Original line number Diff line number Diff line
@@ -708,8 +708,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
		drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4;
	}

	pm_runtime_put(&adev->dev);

	ret = tmc_iommu_init(drvdata);
	if (ret) {
		dev_err(dev, "TMC SMMU init failed, err =%d\n", ret);
@@ -792,6 +790,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
		tmc_iommu_deinit(drvdata);
		coresight_unregister(drvdata->csdev);
	}

	if (!ret)
		pm_runtime_put(&adev->dev);

	return ret;

out_iommu_deinit:
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -678,8 +678,6 @@ static int tpda_probe(struct amba_device *adev, const struct amba_id *id)
	if (!coresight_authstatus_enabled(drvdata->base))
		goto err;

	pm_runtime_put(&adev->dev);

	tpda_init_default_data(drvdata);

	desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
@@ -695,6 +693,8 @@ static int tpda_probe(struct amba_device *adev, const struct amba_id *id)
	if (IS_ERR(drvdata->csdev))
		return PTR_ERR(drvdata->csdev);

	pm_runtime_put(&adev->dev);

	dev_dbg(drvdata->dev, "TPDA initialized\n");
	return 0;
err:
+2 −1
Original line number Diff line number Diff line
@@ -4345,7 +4345,6 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
	drvdata->bc_counters_avail = BMVAL(devid, 6, 10) + 1;
	drvdata->tc_counters_avail = BMVAL(devid, 4, 5) + 1;

	pm_runtime_put(&adev->dev);
	tpdm_setup_disable(drvdata);

	drvdata->traceid = traceid++;
@@ -4368,6 +4367,8 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
	if (boot_enable)
		coresight_enable(drvdata->csdev);

	pm_runtime_put(&adev->dev);

	return 0;
}