summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/stm
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-02-15 19:12:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 14:09:14 -0800
commitadcde635f5d6b77e9f11087af09c6f62da2bf108 (patch)
tree8032cdef7bfbf3822db6a2979d3b59d40bcffeaa /drivers/hwtracing/stm
parentcc8424074e51355e0c6ba717d8edc50d408f2802 (diff)
stm class: dummy_stm: Add link callback for fault injection
STM device's link callback has the power to abort master/channel assignment by returning a negative error code. Use this in dummy stm device to optionally abort assigning certain channel IDs. This is useful as fault injection into the stm class core, for testing purposes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/stm')
-rw-r--r--drivers/hwtracing/stm/dummy_stm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/hwtracing/stm/dummy_stm.c b/drivers/hwtracing/stm/dummy_stm.c
index 4ff5961cd36f..310adf57e7a1 100644
--- a/drivers/hwtracing/stm/dummy_stm.c
+++ b/drivers/hwtracing/stm/dummy_stm.c
@@ -50,6 +50,19 @@ module_param(nr_dummies, int, 0600);
static unsigned int dummy_stm_nr;
+static unsigned int fail_mode;
+
+module_param(fail_mode, int, 0600);
+
+static int dummy_stm_link(struct stm_data *data, unsigned int master,
+ unsigned int channel)
+{
+ if (fail_mode && (channel & fail_mode))
+ return -EINVAL;
+
+ return 0;
+}
+
static int dummy_stm_init(void)
{
int i, ret = -ENOMEM, __nr_dummies = ACCESS_ONCE(nr_dummies);
@@ -66,6 +79,7 @@ static int dummy_stm_init(void)
dummy_stm[i].sw_end = 0xffff;
dummy_stm[i].sw_nchannels = 0xffff;
dummy_stm[i].packet = dummy_stm_packet;
+ dummy_stm[i].link = dummy_stm_link;
ret = stm_register_device(NULL, &dummy_stm[i], THIS_MODULE);
if (ret)