coresight: stm: Cleanup device specific data

Keep track of the STM coresight device which is a child device
of the AMBA device. Since we can get to the coresight_device
from the "device" instance, remove the explicit field.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Suzuki K Poulose 2019-06-19 11:29:15 -06:00 коммит произвёл Greg Kroah-Hartman
Родитель fa87fa7967
Коммит ec62db1b2f
1 изменённых файлов: 10 добавлений и 11 удалений

Просмотреть файл

@ -110,7 +110,6 @@ struct channel_space {
/** /**
* struct stm_drvdata - specifics associated to an STM component * struct stm_drvdata - specifics associated to an STM component
* @base: memory mapped base address for this component. * @base: memory mapped base address for this component.
* @dev: the device entity associated to this component.
* @atclk: optional clock for the core parts of the STM. * @atclk: optional clock for the core parts of the STM.
* @csdev: component vitals needed by the framework. * @csdev: component vitals needed by the framework.
* @spinlock: only one at a time pls. * @spinlock: only one at a time pls.
@ -128,7 +127,6 @@ struct channel_space {
*/ */
struct stm_drvdata { struct stm_drvdata {
void __iomem *base; void __iomem *base;
struct device *dev;
struct clk *atclk; struct clk *atclk;
struct coresight_device *csdev; struct coresight_device *csdev;
spinlock_t spinlock; spinlock_t spinlock;
@ -205,13 +203,13 @@ static int stm_enable(struct coresight_device *csdev,
if (val) if (val)
return -EBUSY; return -EBUSY;
pm_runtime_get_sync(drvdata->dev); pm_runtime_get_sync(csdev->dev.parent);
spin_lock(&drvdata->spinlock); spin_lock(&drvdata->spinlock);
stm_enable_hw(drvdata); stm_enable_hw(drvdata);
spin_unlock(&drvdata->spinlock); spin_unlock(&drvdata->spinlock);
dev_dbg(drvdata->dev, "STM tracing enabled\n"); dev_dbg(&csdev->dev, "STM tracing enabled\n");
return 0; return 0;
} }
@ -271,10 +269,10 @@ static void stm_disable(struct coresight_device *csdev,
/* Wait until the engine has completely stopped */ /* Wait until the engine has completely stopped */
coresight_timeout(drvdata->base, STMTCSR, STMTCSR_BUSY_BIT, 0); coresight_timeout(drvdata->base, STMTCSR, STMTCSR_BUSY_BIT, 0);
pm_runtime_put(drvdata->dev); pm_runtime_put(csdev->dev.parent);
local_set(&drvdata->mode, CS_MODE_DISABLED); local_set(&drvdata->mode, CS_MODE_DISABLED);
dev_dbg(drvdata->dev, "STM tracing disabled\n"); dev_dbg(&csdev->dev, "STM tracing disabled\n");
} }
} }
@ -763,9 +761,10 @@ static void stm_init_default_data(struct stm_drvdata *drvdata)
bitmap_clear(drvdata->chs.guaranteed, 0, drvdata->numsp); bitmap_clear(drvdata->chs.guaranteed, 0, drvdata->numsp);
} }
static void stm_init_generic_data(struct stm_drvdata *drvdata) static void stm_init_generic_data(struct stm_drvdata *drvdata,
const char *name)
{ {
drvdata->stm.name = dev_name(drvdata->dev); drvdata->stm.name = name;
/* /*
* MasterIDs are assigned at HW design phase. As such the core is * MasterIDs are assigned at HW design phase. As such the core is
@ -807,7 +806,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
if (!drvdata) if (!drvdata)
return -ENOMEM; return -ENOMEM;
drvdata->dev = &adev->dev;
drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */
if (!IS_ERR(drvdata->atclk)) { if (!IS_ERR(drvdata->atclk)) {
ret = clk_prepare_enable(drvdata->atclk); ret = clk_prepare_enable(drvdata->atclk);
@ -848,7 +846,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
spin_lock_init(&drvdata->spinlock); spin_lock_init(&drvdata->spinlock);
stm_init_default_data(drvdata); stm_init_default_data(drvdata);
stm_init_generic_data(drvdata); stm_init_generic_data(drvdata, dev_name(dev));
if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) { if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) {
dev_info(dev, dev_info(dev,
@ -870,7 +868,8 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
pm_runtime_put(&adev->dev); pm_runtime_put(&adev->dev);
dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id)); dev_info(&drvdata->csdev->dev, "%s initialized\n",
(char *)coresight_get_uci_data(id));
return 0; return 0;
stm_unregister: stm_unregister: