Commit c38e505e authored by Suzuki K. Poulose's avatar Suzuki K. Poulose Committed by Greg Kroah-Hartman

coresight: tmc: Get rid of mode parameter for helper routines

Get rid of the superfluous mode parameter and the check for
the mode in tmc_etX_enable_sink_{perf/sysfs}. While at it, also
remove the unnecessary WARN_ON() checks.

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 297ab90f
...@@ -103,7 +103,7 @@ static void tmc_etf_disable_hw(struct tmc_drvdata *drvdata) ...@@ -103,7 +103,7 @@ static void tmc_etf_disable_hw(struct tmc_drvdata *drvdata)
CS_LOCK(drvdata->base); CS_LOCK(drvdata->base);
} }
static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev, u32 mode) static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev)
{ {
int ret = 0; int ret = 0;
bool used = false; bool used = false;
...@@ -111,10 +111,6 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev, u32 mode) ...@@ -111,10 +111,6 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev, u32 mode)
unsigned long flags; unsigned long flags;
struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
/* This shouldn't be happening */
if (WARN_ON(mode != CS_MODE_SYSFS))
return -EINVAL;
/* /*
* If we don't have a buffer release the lock and allocate memory. * If we don't have a buffer release the lock and allocate memory.
* Otherwise keep the lock and move along. * Otherwise keep the lock and move along.
...@@ -176,16 +172,12 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev, u32 mode) ...@@ -176,16 +172,12 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev, u32 mode)
return ret; return ret;
} }
static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, u32 mode) static int tmc_enable_etf_sink_perf(struct coresight_device *csdev)
{ {
int ret = 0; int ret = 0;
unsigned long flags; unsigned long flags;
struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
/* This shouldn't be happening */
if (WARN_ON(mode != CS_MODE_PERF))
return -EINVAL;
spin_lock_irqsave(&drvdata->spinlock, flags); spin_lock_irqsave(&drvdata->spinlock, flags);
if (drvdata->reading) { if (drvdata->reading) {
ret = -EINVAL; ret = -EINVAL;
...@@ -202,7 +194,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, u32 mode) ...@@ -202,7 +194,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, u32 mode)
goto out; goto out;
} }
drvdata->mode = mode; drvdata->mode = CS_MODE_PERF;
tmc_etb_enable_hw(drvdata); tmc_etb_enable_hw(drvdata);
out: out:
spin_unlock_irqrestore(&drvdata->spinlock, flags); spin_unlock_irqrestore(&drvdata->spinlock, flags);
...@@ -214,9 +206,9 @@ static int tmc_enable_etf_sink(struct coresight_device *csdev, u32 mode) ...@@ -214,9 +206,9 @@ static int tmc_enable_etf_sink(struct coresight_device *csdev, u32 mode)
{ {
switch (mode) { switch (mode) {
case CS_MODE_SYSFS: case CS_MODE_SYSFS:
return tmc_enable_etf_sink_sysfs(csdev, mode); return tmc_enable_etf_sink_sysfs(csdev);
case CS_MODE_PERF: case CS_MODE_PERF:
return tmc_enable_etf_sink_perf(csdev, mode); return tmc_enable_etf_sink_perf(csdev);
} }
/* We shouldn't be here */ /* We shouldn't be here */
......
...@@ -93,7 +93,7 @@ static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) ...@@ -93,7 +93,7 @@ static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata)
CS_LOCK(drvdata->base); CS_LOCK(drvdata->base);
} }
static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev, u32 mode) static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
{ {
int ret = 0; int ret = 0;
bool used = false; bool used = false;
...@@ -102,9 +102,6 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev, u32 mode) ...@@ -102,9 +102,6 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev, u32 mode)
dma_addr_t paddr; dma_addr_t paddr;
struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
/* This shouldn't be happening */
if (WARN_ON(mode != CS_MODE_SYSFS))
return -EINVAL;
/* /*
* If we don't have a buffer release the lock and allocate memory. * If we don't have a buffer release the lock and allocate memory.
...@@ -170,16 +167,12 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev, u32 mode) ...@@ -170,16 +167,12 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev, u32 mode)
return ret; return ret;
} }
static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, u32 mode) static int tmc_enable_etr_sink_perf(struct coresight_device *csdev)
{ {
int ret = 0; int ret = 0;
unsigned long flags; unsigned long flags;
struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
/* This shouldn't be happening */
if (WARN_ON(mode != CS_MODE_PERF))
return -EINVAL;
spin_lock_irqsave(&drvdata->spinlock, flags); spin_lock_irqsave(&drvdata->spinlock, flags);
if (drvdata->reading) { if (drvdata->reading) {
ret = -EINVAL; ret = -EINVAL;
...@@ -208,9 +201,9 @@ static int tmc_enable_etr_sink(struct coresight_device *csdev, u32 mode) ...@@ -208,9 +201,9 @@ static int tmc_enable_etr_sink(struct coresight_device *csdev, u32 mode)
{ {
switch (mode) { switch (mode) {
case CS_MODE_SYSFS: case CS_MODE_SYSFS:
return tmc_enable_etr_sink_sysfs(csdev, mode); return tmc_enable_etr_sink_sysfs(csdev);
case CS_MODE_PERF: case CS_MODE_PERF:
return tmc_enable_etr_sink_perf(csdev, mode); return tmc_enable_etr_sink_perf(csdev);
} }
/* We shouldn't be here */ /* We shouldn't be here */
......
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