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

Commit ca5ddfab authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Yabin Cui
Browse files

UPSTREAM: coresight: etb10: Handle errors enabling the device



(Upstream commit 62563e84a8c9c682e07b8cce8678e583a24be504).

Prepare the etb10 driver to return errors in enabling
the device.

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>

Bug: 140266694
Change-Id: I7b94e65c3587857a290a89b65ca9a5f0348474a5
Signed-off-by: default avatarYabin Cui <yabinc@google.com>
parent a3266c21
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata)
	return depth;
}

static void etb_enable_hw(struct etb_drvdata *drvdata)
static void __etb_enable_hw(struct etb_drvdata *drvdata)
{
	int i;
	u32 depth;
@@ -134,6 +134,12 @@ static void etb_enable_hw(struct etb_drvdata *drvdata)
	CS_LOCK(drvdata->base);
}

static int etb_enable_hw(struct etb_drvdata *drvdata)
{
	__etb_enable_hw(drvdata);
	return 0;
}

static int etb_enable_sysfs(struct coresight_device *csdev)
{
	int ret = 0;
@@ -152,8 +158,9 @@ static int etb_enable_sysfs(struct coresight_device *csdev)
	if (drvdata->mode == CS_MODE_SYSFS)
		goto out;

	ret = etb_enable_hw(drvdata);
	if (!ret)
		drvdata->mode = CS_MODE_SYSFS;
	etb_enable_hw(drvdata);

out:
	spin_unlock_irqrestore(&drvdata->spinlock, flags);
@@ -183,8 +190,9 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data)
	if (ret)
		goto out;

	ret = etb_enable_hw(drvdata);
	if (!ret)
		drvdata->mode = CS_MODE_PERF;
	etb_enable_hw(drvdata);

out:
	spin_unlock_irqrestore(&drvdata->spinlock, flags);