mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
coresight: Use enum type for cs_mode wherever possible
mode is stored as a local_t, but it is also passed around a lot as a plain u32, so use the correct type wherever local_t isn't currently used. This helps a little bit with readability. Reviewed-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: James Clark <james.clark@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20230425143542.2305069-3-james.clark@arm.com
This commit is contained in:
parent
c45b2835e7
commit
9fa3682869
@ -308,7 +308,7 @@ void coresight_set_assoc_ectdev_mutex(struct coresight_device *csdev,
|
||||
EXPORT_SYMBOL_GPL(coresight_set_assoc_ectdev_mutex);
|
||||
|
||||
static int coresight_enable_sink(struct coresight_device *csdev,
|
||||
u32 mode, void *data)
|
||||
enum cs_mode mode, void *data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -416,7 +416,8 @@ static void coresight_disable_link(struct coresight_device *csdev,
|
||||
csdev->enable = false;
|
||||
}
|
||||
|
||||
static int coresight_enable_source(struct coresight_device *csdev, u32 mode)
|
||||
static int coresight_enable_source(struct coresight_device *csdev,
|
||||
enum cs_mode mode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -516,7 +517,7 @@ void coresight_disable_path(struct list_head *path)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(coresight_disable_path);
|
||||
|
||||
int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data)
|
||||
int coresight_enable_path(struct list_head *path, enum cs_mode mode, void *sink_data)
|
||||
{
|
||||
|
||||
int ret = 0;
|
||||
|
@ -225,7 +225,8 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
|
||||
static int etb_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||
void *data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -552,8 +552,8 @@ unlock_enable_sysfs:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int etm_enable(struct coresight_device *csdev,
|
||||
struct perf_event *event, u32 mode)
|
||||
static int etm_enable(struct coresight_device *csdev, struct perf_event *event,
|
||||
enum cs_mode mode)
|
||||
{
|
||||
int ret;
|
||||
u32 val;
|
||||
@ -671,7 +671,7 @@ static void etm_disable_sysfs(struct coresight_device *csdev)
|
||||
static void etm_disable(struct coresight_device *csdev,
|
||||
struct perf_event *event)
|
||||
{
|
||||
u32 mode;
|
||||
enum cs_mode mode;
|
||||
struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
|
||||
/*
|
||||
|
@ -822,8 +822,8 @@ unlock_sysfs_enable:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int etm4_enable(struct coresight_device *csdev,
|
||||
struct perf_event *event, u32 mode)
|
||||
static int etm4_enable(struct coresight_device *csdev, struct perf_event *event,
|
||||
enum cs_mode mode)
|
||||
{
|
||||
int ret;
|
||||
u32 val;
|
||||
@ -989,7 +989,7 @@ static void etm4_disable_sysfs(struct coresight_device *csdev)
|
||||
static void etm4_disable(struct coresight_device *csdev,
|
||||
struct perf_event *event)
|
||||
{
|
||||
u32 mode;
|
||||
enum cs_mode mode;
|
||||
struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
|
||||
/*
|
||||
|
@ -82,12 +82,6 @@ enum etm_addr_type {
|
||||
ETM_ADDR_TYPE_STOP,
|
||||
};
|
||||
|
||||
enum cs_mode {
|
||||
CS_MODE_DISABLED,
|
||||
CS_MODE_SYSFS,
|
||||
CS_MODE_PERF,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cs_buffer - keep track of a recording session' specifics
|
||||
* @cur: index of the current buffer
|
||||
@ -133,7 +127,8 @@ static inline void CS_UNLOCK(void __iomem *addr)
|
||||
}
|
||||
|
||||
void coresight_disable_path(struct list_head *path);
|
||||
int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data);
|
||||
int coresight_enable_path(struct list_head *path, enum cs_mode mode,
|
||||
void *sink_data);
|
||||
struct coresight_device *coresight_get_sink(struct list_head *path);
|
||||
struct coresight_device *
|
||||
coresight_get_enabled_sink(struct coresight_device *source);
|
||||
|
@ -119,7 +119,7 @@ DEFINE_CORESIGHT_DEVLIST(stm_devs, "stm");
|
||||
* @spinlock: only one at a time pls.
|
||||
* @chs: the channels accociated to this STM.
|
||||
* @stm: structure associated to the generic STM interface.
|
||||
* @mode: this tracer's mode, i.e sysFS, or disabled.
|
||||
* @mode: this tracer's mode (enum cs_mode), i.e sysFS, or disabled.
|
||||
* @traceid: value of the current ID for this component.
|
||||
* @write_bytes: Maximus bytes this STM can write at a time.
|
||||
* @stmsper: settings for register STMSPER.
|
||||
@ -192,8 +192,8 @@ static void stm_enable_hw(struct stm_drvdata *drvdata)
|
||||
CS_LOCK(drvdata->base);
|
||||
}
|
||||
|
||||
static int stm_enable(struct coresight_device *csdev,
|
||||
struct perf_event *event, u32 mode)
|
||||
static int stm_enable(struct coresight_device *csdev, struct perf_event *event,
|
||||
enum cs_mode mode)
|
||||
{
|
||||
u32 val;
|
||||
struct stm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
|
@ -302,7 +302,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data)
|
||||
}
|
||||
|
||||
static int tmc_enable_etf_sink(struct coresight_device *csdev,
|
||||
u32 mode, void *data)
|
||||
enum cs_mode mode, void *data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -1666,17 +1666,16 @@ unlock_out:
|
||||
}
|
||||
|
||||
static int tmc_enable_etr_sink(struct coresight_device *csdev,
|
||||
u32 mode, void *data)
|
||||
enum cs_mode mode, void *data)
|
||||
{
|
||||
switch (mode) {
|
||||
case CS_MODE_SYSFS:
|
||||
return tmc_enable_etr_sink_sysfs(csdev);
|
||||
case CS_MODE_PERF:
|
||||
return tmc_enable_etr_sink_perf(csdev, data);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* We shouldn't be here */
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int tmc_disable_etr_sink(struct coresight_device *csdev)
|
||||
|
@ -42,8 +42,8 @@ static void __tpdm_enable(struct tpdm_drvdata *drvdata)
|
||||
CS_LOCK(drvdata->base);
|
||||
}
|
||||
|
||||
static int tpdm_enable(struct coresight_device *csdev,
|
||||
struct perf_event *event, u32 mode)
|
||||
static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
|
||||
enum cs_mode mode)
|
||||
{
|
||||
struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
|
||||
|
@ -69,7 +69,8 @@ static void tpiu_enable_hw(struct csdev_access *csa)
|
||||
CS_LOCK(csa->base);
|
||||
}
|
||||
|
||||
static int tpiu_enable(struct coresight_device *csdev, u32 mode, void *__unused)
|
||||
static int tpiu_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||
void *__unused)
|
||||
{
|
||||
tpiu_enable_hw(&csdev->access);
|
||||
atomic_inc(csdev->refcnt);
|
||||
|
@ -1005,7 +1005,8 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int arm_trbe_enable(struct coresight_device *csdev, u32 mode, void *data)
|
||||
static int arm_trbe_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||
void *data)
|
||||
{
|
||||
struct trbe_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
struct trbe_cpudata *cpudata = dev_get_drvdata(&csdev->dev);
|
||||
|
@ -256,7 +256,8 @@ static int smb_enable_perf(struct coresight_device *csdev, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smb_enable(struct coresight_device *csdev, u32 mode, void *data)
|
||||
static int smb_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||
void *data)
|
||||
{
|
||||
struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||
int ret = 0;
|
||||
|
@ -119,7 +119,7 @@ struct smb_drv_data {
|
||||
struct mutex mutex;
|
||||
bool reading;
|
||||
pid_t pid;
|
||||
u32 mode;
|
||||
enum cs_mode mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -272,6 +272,12 @@ static struct coresight_dev_list (var) = { \
|
||||
|
||||
#define to_coresight_device(d) container_of(d, struct coresight_device, dev)
|
||||
|
||||
enum cs_mode {
|
||||
CS_MODE_DISABLED,
|
||||
CS_MODE_SYSFS,
|
||||
CS_MODE_PERF,
|
||||
};
|
||||
|
||||
#define source_ops(csdev) csdev->ops->source_ops
|
||||
#define sink_ops(csdev) csdev->ops->sink_ops
|
||||
#define link_ops(csdev) csdev->ops->link_ops
|
||||
@ -288,7 +294,8 @@ static struct coresight_dev_list (var) = { \
|
||||
* @update_buffer: update buffer pointers after a trace session.
|
||||
*/
|
||||
struct coresight_ops_sink {
|
||||
int (*enable)(struct coresight_device *csdev, u32 mode, void *data);
|
||||
int (*enable)(struct coresight_device *csdev, enum cs_mode mode,
|
||||
void *data);
|
||||
int (*disable)(struct coresight_device *csdev);
|
||||
void *(*alloc_buffer)(struct coresight_device *csdev,
|
||||
struct perf_event *event, void **pages,
|
||||
@ -320,8 +327,8 @@ struct coresight_ops_link {
|
||||
*/
|
||||
struct coresight_ops_source {
|
||||
int (*cpu_id)(struct coresight_device *csdev);
|
||||
int (*enable)(struct coresight_device *csdev,
|
||||
struct perf_event *event, u32 mode);
|
||||
int (*enable)(struct coresight_device *csdev, struct perf_event *event,
|
||||
enum cs_mode mode);
|
||||
void (*disable)(struct coresight_device *csdev,
|
||||
struct perf_event *event);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user