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

Commit 7fb93829 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Yabin Cui
Browse files

UPSTREAM: coresight: Adding return code to sink::disable() operation



(Upstream commit 6c817a95d84b8388e97d4e2b6ee361a660e244e9).

In preparation to handle device reference counting inside of the sink
drivers, add a return code to the sink::disable() operation so that
proper action can be taken if a sink has not been disabled.

Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
Tested-by: default avatarRobert Walker <robert.walker@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 140266694
Change-Id: I85b7b561b9ebd53dab55ba730af16209f4302e8e
Signed-off-by: default avatarYabin Cui <yabinc@google.com>
parent 3d4d5bb7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ static void etb_disable_hw(struct etb_drvdata *drvdata)
	coresight_disclaim_device(drvdata->base);
}

static void etb_disable(struct coresight_device *csdev)
static int etb_disable(struct coresight_device *csdev)
{
	struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
	unsigned long flags;
@@ -340,6 +340,7 @@ static void etb_disable(struct coresight_device *csdev)
	spin_unlock_irqrestore(&drvdata->spinlock, flags);

	dev_dbg(drvdata->dev, "ETB disabled\n");
	return 0;
}

static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,
+3 −2
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ static int tmc_enable_etf_sink(struct coresight_device *csdev,
	return 0;
}

static void tmc_disable_etf_sink(struct coresight_device *csdev)
static int tmc_disable_etf_sink(struct coresight_device *csdev)
{
	unsigned long flags;
	struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@@ -284,7 +284,7 @@ static void tmc_disable_etf_sink(struct coresight_device *csdev)
	spin_lock_irqsave(&drvdata->spinlock, flags);
	if (drvdata->reading) {
		spin_unlock_irqrestore(&drvdata->spinlock, flags);
		return;
		return -EBUSY;
	}

	/* Disable the TMC only if it needs to */
@@ -296,6 +296,7 @@ static void tmc_disable_etf_sink(struct coresight_device *csdev)
	spin_unlock_irqrestore(&drvdata->spinlock, flags);

	dev_dbg(drvdata->dev, "TMC-ETB/ETF disabled\n");
	return 0;
}

static int tmc_enable_etf_link(struct coresight_device *csdev,
+3 −2
Original line number Diff line number Diff line
@@ -1393,7 +1393,7 @@ static int tmc_enable_etr_sink(struct coresight_device *csdev,
	return -EINVAL;
}

static void tmc_disable_etr_sink(struct coresight_device *csdev)
static int tmc_disable_etr_sink(struct coresight_device *csdev)
{
	unsigned long flags;
	struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@@ -1401,7 +1401,7 @@ static void tmc_disable_etr_sink(struct coresight_device *csdev)
	spin_lock_irqsave(&drvdata->spinlock, flags);
	if (drvdata->reading) {
		spin_unlock_irqrestore(&drvdata->spinlock, flags);
		return;
		return -EBUSY;
	}

	/* Disable the TMC only if it needs to */
@@ -1413,6 +1413,7 @@ static void tmc_disable_etr_sink(struct coresight_device *csdev)
	spin_unlock_irqrestore(&drvdata->spinlock, flags);

	dev_dbg(drvdata->dev, "TMC-ETR disabled\n");
	return 0;
}

static const struct coresight_ops_sink tmc_etr_sink_ops = {
+2 −1
Original line number Diff line number Diff line
@@ -94,13 +94,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
	CS_LOCK(drvdata->base);
}

static void tpiu_disable(struct coresight_device *csdev)
static int tpiu_disable(struct coresight_device *csdev)
{
	struct tpiu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);

	tpiu_disable_hw(drvdata);

	dev_dbg(drvdata->dev, "TPIU disabled\n");
	return 0;
}

static const struct coresight_ops_sink tpiu_sink_ops = {
+5 −1
Original line number Diff line number Diff line
@@ -239,9 +239,13 @@ static int coresight_enable_sink(struct coresight_device *csdev,

static void coresight_disable_sink(struct coresight_device *csdev)
{
	int ret;

	if (atomic_dec_return(csdev->refcnt) == 0) {
		if (sink_ops(csdev)->disable) {
			sink_ops(csdev)->disable(csdev);
			ret = sink_ops(csdev)->disable(csdev);
			if (ret)
				return;
			csdev->enable = false;
		}
	}
Loading