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

Commit 92dd0e70 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>
Signed-off-by: default avatarMulu He <muluhe@codeaurora.org>
parent 746b6d4c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * 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
 */
@@ -674,7 +674,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;
@@ -700,6 +699,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
@@ -667,8 +667,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 = of_get_coresight_csr_name(adev->dev.of_node, &drvdata->csr_name);
	if (ret)
		dev_err(dev, "No csr data\n");
@@ -727,6 +725,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
		coresight_unregister(drvdata->csdev);
		goto out_iommu_deinit;
	}

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

	return ret;

out_iommu_deinit: