Commit 9fa36828 authored by James Clark's avatar James Clark Committed by Suzuki K Poulose
Browse files

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: default avatarMike Leach <mike.leach@linaro.org>
Signed-off-by: default avatarJames Clark <james.clark@arm.com>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-3-james.clark@arm.com
parent c45b2835
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -225,7 +225,8 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data)
	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;

+3 −3
Original line number Diff line number Diff line
@@ -552,8 +552,8 @@ static int etm_enable_sysfs(struct coresight_device *csdev)
	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);

	/*
+3 −3
Original line number Diff line number Diff line
@@ -822,8 +822,8 @@ static int etm4_enable_sysfs(struct coresight_device *csdev)
	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);

	/*
+2 −7
Original line number Diff line number Diff line
@@ -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);
Loading