mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 03:01:41 +02:00
coresight: etm4x: Remove redundant checks in PM save and restore
ETMv4 driver save/restore callbacks still re-check conditions that are already validated by the core layer before the callbacks are invoked. Remove the duplicated checks and fold the two-level functions into direct callback implementations. The obsolete WARN_ON() checks are removed as well. Reviewed-by: Mike Leach <mike.leach@linaro.org> Tested-by: James Clark <james.clark@linaro.org> Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com> Reviewed-by: James Clark <james.clark@linaro.org> Tested-by: Jie Gan <jie.gan@oss.qualcomm.com> Signed-off-by: Leo Yan <leo.yan@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20260515-arm_coresight_path_power_management_improvement-v14-13-f88c4a3ecfe9@arm.com
This commit is contained in:
parent
0f5e588c70
commit
81bf1c33f6
|
|
@ -1853,17 +1853,14 @@ static inline bool etm4_pm_save_needed(struct etmv4_drvdata *drvdata)
|
|||
return !!drvdata->save_state;
|
||||
}
|
||||
|
||||
static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
|
||||
static int etm4_cpu_save(struct coresight_device *csdev)
|
||||
{
|
||||
int i, ret = 0;
|
||||
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
struct etmv4_save_state *state;
|
||||
struct coresight_device *csdev = drvdata->csdev;
|
||||
struct csdev_access *csa;
|
||||
struct device *etm_dev;
|
||||
|
||||
if (WARN_ON(!csdev))
|
||||
return -ENODEV;
|
||||
|
||||
etm_dev = &csdev->dev;
|
||||
csa = &csdev->access;
|
||||
|
||||
|
|
@ -1995,32 +1992,13 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int etm4_cpu_save(struct coresight_device *csdev)
|
||||
{
|
||||
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
int ret = 0;
|
||||
|
||||
if (!etm4_pm_save_needed(drvdata))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Save and restore the ETM Trace registers only if
|
||||
* the ETM is active.
|
||||
*/
|
||||
if (coresight_get_mode(drvdata->csdev))
|
||||
ret = __etm4_cpu_save(drvdata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
|
||||
static void etm4_cpu_restore(struct coresight_device *csdev)
|
||||
{
|
||||
int i;
|
||||
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
struct etmv4_save_state *state = drvdata->save_state;
|
||||
struct csdev_access *csa = &drvdata->csdev->access;
|
||||
|
||||
if (WARN_ON(!drvdata->csdev))
|
||||
return;
|
||||
|
||||
etm4_cs_unlock(drvdata, csa);
|
||||
etm4x_relaxed_write32(csa, state->trcclaimset, TRCCLAIMSET);
|
||||
|
||||
|
|
@ -2113,17 +2091,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
|
|||
etm4_cs_lock(drvdata, csa);
|
||||
}
|
||||
|
||||
static void etm4_cpu_restore(struct coresight_device *csdev)
|
||||
{
|
||||
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
|
||||
if (!etm4_pm_save_needed(drvdata))
|
||||
return;
|
||||
|
||||
if (coresight_get_mode(drvdata->csdev))
|
||||
__etm4_cpu_restore(drvdata);
|
||||
}
|
||||
|
||||
static const struct coresight_ops etm4_cs_ops = {
|
||||
.trace_id = coresight_etm_get_trace_id,
|
||||
.source_ops = &etm4_source_ops,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user