Commit 688da45f authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

coresight: Add support for releasing platform specific data

Add a helper to clean up the platform specific data provided
by the firmware. This will be later used for dropping the necessary
references when we switch to the fwnode handles for tracking
connections.
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 af7cfd0f
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <asm/smp_plat.h> #include <asm/smp_plat.h>
#include "coresight-priv.h"
/* /*
* coresight_alloc_conns: Allocate connections record for each output * coresight_alloc_conns: Allocate connections record for each output
* port from the device. * port from the device.
...@@ -311,7 +312,7 @@ struct coresight_platform_data * ...@@ -311,7 +312,7 @@ struct coresight_platform_data *
coresight_get_platform_data(struct device *dev) coresight_get_platform_data(struct device *dev)
{ {
int ret = -ENOENT; int ret = -ENOENT;
struct coresight_platform_data *pdata; struct coresight_platform_data *pdata = NULL;
struct fwnode_handle *fwnode = dev_fwnode(dev); struct fwnode_handle *fwnode = dev_fwnode(dev);
if (IS_ERR_OR_NULL(fwnode)) if (IS_ERR_OR_NULL(fwnode))
...@@ -329,6 +330,9 @@ coresight_get_platform_data(struct device *dev) ...@@ -329,6 +330,9 @@ coresight_get_platform_data(struct device *dev)
if (!ret) if (!ret)
return pdata; return pdata;
error: error:
if (!IS_ERR_OR_NULL(pdata))
/* Cleanup the connection information */
coresight_release_platform_data(pdata);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(coresight_get_platform_data); EXPORT_SYMBOL_GPL(coresight_get_platform_data);
...@@ -200,4 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) ...@@ -200,4 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id)
return 0; return 0;
} }
static inline void
coresight_release_platform_data(struct coresight_platform_data *pdata)
{}
#endif #endif
...@@ -1250,6 +1250,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) ...@@ -1250,6 +1250,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
err_free_csdev: err_free_csdev:
kfree(csdev); kfree(csdev);
err_out: err_out:
/* Cleanup the connection information */
coresight_release_platform_data(desc->pdata);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
EXPORT_SYMBOL_GPL(coresight_register); EXPORT_SYMBOL_GPL(coresight_register);
...@@ -1259,6 +1261,7 @@ void coresight_unregister(struct coresight_device *csdev) ...@@ -1259,6 +1261,7 @@ void coresight_unregister(struct coresight_device *csdev)
etm_perf_del_symlink_sink(csdev); etm_perf_del_symlink_sink(csdev);
/* Remove references of that device in the topology */ /* Remove references of that device in the topology */
coresight_remove_conns(csdev); coresight_remove_conns(csdev);
coresight_release_platform_data(csdev->pdata);
device_unregister(&csdev->dev); device_unregister(&csdev->dev);
} }
EXPORT_SYMBOL_GPL(coresight_unregister); EXPORT_SYMBOL_GPL(coresight_unregister);
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