return NULL;
}
-static inline void tmc_etr_enable_catu(struct tmc_drvdata *drvdata)
+static inline int tmc_etr_enable_catu(struct tmc_drvdata *drvdata,
+ struct etr_buf *etr_buf)
{
struct coresight_device *catu = tmc_etr_get_catu_device(drvdata);
if (catu && helper_ops(catu)->enable)
- helper_ops(catu)->enable(catu, drvdata->etr_buf);
+ return helper_ops(catu)->enable(catu, etr_buf);
+ return 0;
}
static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata)
static int tmc_etr_enable_hw(struct tmc_drvdata *drvdata,
struct etr_buf *etr_buf)
{
+ int rc;
+
/* Callers should provide an appropriate buffer for use */
if (WARN_ON(!etr_buf))
return -EINVAL;
if (WARN_ON(drvdata->etr_buf))
return -EBUSY;
- /* Set the buffer for the session */
- drvdata->etr_buf = etr_buf;
/*
* If this ETR is connected to a CATU, enable it before we turn
* this on.
*/
- tmc_etr_enable_catu(drvdata);
+ rc = tmc_etr_enable_catu(drvdata, etr_buf);
+ if (!rc) {
+ drvdata->etr_buf = etr_buf;
+ __tmc_etr_enable_hw(drvdata);
+ }
- __tmc_etr_enable_hw(drvdata);
- return 0;
+ return rc;
}
/*