lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 26/36] coresight: Add support for releasing platform specific data
    Date
    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.

    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    ---
    drivers/hwtracing/coresight/coresight-platform.c | 12 +++++++++---
    drivers/hwtracing/coresight/coresight-priv.h | 4 ++++
    drivers/hwtracing/coresight/coresight.c | 3 +++
    3 files changed, 16 insertions(+), 3 deletions(-)

    diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
    index 0415fff..a408b01 100644
    --- a/drivers/hwtracing/coresight/coresight-platform.c
    +++ b/drivers/hwtracing/coresight/coresight-platform.c
    @@ -17,6 +17,7 @@
    #include <linux/cpumask.h>
    #include <asm/smp_plat.h>

    +#include "coresight-priv.h"
    /*
    * coresight_alloc_conns: Allocate connections record for each output
    * port from the device.
    @@ -304,7 +305,7 @@ EXPORT_SYMBOL_GPL(coresight_get_cpu);
    struct coresight_platform_data *
    coresight_get_platform_data(struct device *dev)
    {
    - struct coresight_platform_data *pdata;
    + struct coresight_platform_data *pdata, *ret = NULL;
    struct fwnode_handle *fwnode = dev_fwnode(dev);

    if (IS_ERR_OR_NULL(fwnode))
    @@ -315,8 +316,13 @@ coresight_get_platform_data(struct device *dev)
    return ERR_PTR(-ENOMEM);

    if (is_of_node(fwnode))
    - return of_get_coresight_platform_data(dev, pdata);
    + ret = of_get_coresight_platform_data(dev, pdata);

    - return ERR_PTR(-ENOENT);
    + if (!IS_ERR_OR_NULL(ret))
    + return pdata;
    +
    + /* Cleanup the connection information */
    + coresight_release_platform_data(pdata);
    + return ret;
    }
    EXPORT_SYMBOL_GPL(coresight_get_platform_data);
    diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
    index e0684d0..c216421 100644
    --- a/drivers/hwtracing/coresight/coresight-priv.h
    +++ b/drivers/hwtracing/coresight/coresight-priv.h
    @@ -200,4 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id)
    return 0;
    }

    +static inline void
    +coresight_release_platform_data(struct coresight_platform_data *pdata)
    +{}
    +
    #endif
    diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
    index f6c5244..82fb411 100644
    --- a/drivers/hwtracing/coresight/coresight.c
    +++ b/drivers/hwtracing/coresight/coresight.c
    @@ -1248,6 +1248,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
    err_free_csdev:
    kfree(csdev);
    err_out:
    + /* Cleanup the connection information */
    + coresight_release_platform_data(desc->pdata);
    return ERR_PTR(ret);
    }
    EXPORT_SYMBOL_GPL(coresight_register);
    @@ -1257,6 +1259,7 @@ void coresight_unregister(struct coresight_device *csdev)
    etm_perf_del_symlink_sink(csdev);
    /* Remove references of that device in the topology */
    coresight_remove_conns(csdev);
    + coresight_release_platform_data(csdev->pdata);
    device_unregister(&csdev->dev);
    }
    EXPORT_SYMBOL_GPL(coresight_unregister);
    --
    2.7.4
    \
     
     \ /
      Last update: 2019-04-15 18:08    [W:4.077 / U:0.380 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site