aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/loopback.c
diff options
context:
space:
mode:
authorAlexandre Bailon <abailon@baylibre.com>2016-03-08 17:40:16 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-03-09 22:31:32 -0800
commit01480ba336982d49e2208636e38c0a80b732eba8 (patch)
treeeda7c51203c2f76cf18fb42c0da8bb36e9d8682a /drivers/staging/greybus/loopback.c
parentgreybus: loopback: round closest the sixth decimal (diff)
downloadlinux-dev-01480ba336982d49e2208636e38c0a80b732eba8.tar.xz
linux-dev-01480ba336982d49e2208636e38c0a80b732eba8.zip
greybus: loopback: Fix broken synchonous test
loopback driver use the send_count variable to know the test progress. The test may be stopped or change but this variable is never cleaned. Such situation may break the next run. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/loopback.c')
-rw-r--r--drivers/staging/greybus/loopback.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 9f1cd9d6cd54..6c62706bb94c 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -107,6 +107,8 @@ struct gb_loopback {
u64 elapsed_nsecs;
u32 apbridge_latency_ts;
u32 gpbridge_latency_ts;
+
+ u32 send_count;
};
static struct class loopback_class = {
@@ -247,6 +249,7 @@ static void gb_loopback_check_attr(struct gb_loopback *gb)
gb->requests_timedout = 0;
gb->requests_completed = 0;
gb->iteration_count = 0;
+ gb->send_count = 0;
gb->error = 0;
if (kfifo_depth < gb->iteration_max) {
@@ -971,7 +974,7 @@ static int gb_loopback_fn(void *data)
int us_wait = 0;
int type;
u32 size;
- u32 send_count = 0;
+
struct gb_loopback *gb = data;
while (1) {
@@ -989,10 +992,10 @@ static int gb_loopback_fn(void *data)
mutex_lock(&gb->mutex);
/* Optionally terminate */
- if (send_count == gb->iteration_max) {
+ if (gb->send_count == gb->iteration_max) {
if (gb->iteration_count == gb->iteration_max) {
gb->type = 0;
- send_count = 0;
+ gb->send_count = 0;
sysfs_notify(&gb->dev->kobj, NULL,
"iteration_count");
}
@@ -1032,7 +1035,7 @@ static int gb_loopback_fn(void *data)
gb->iteration_count++;
gb_loopback_calculate_stats(gb, !!error);
}
- send_count++;
+ gb->send_count++;
if (us_wait)
udelay(us_wait);
}