From 39c2787b120a6e69e065b255d4db97ee60d73bf8 Mon Sep 17 00:00:00 2001 From: Axel Haslam Date: Fri, 26 Feb 2016 11:39:48 +0100 Subject: [PATCH] greybus: Notify user space only when the test finished. Currently, user space is notified for every message sent, but this is not really needed and does not work in the async case where all messages are sent from the start. Instead, notify userspace only when all the transfers are complete. This allows userspace to wait in a poll loop and wakeup only when the test is finished. Also, don't use the bundle kobj to send the notification it is the loopback device that contains the loopback attributes. Signed-off-by: Axel Haslam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/loopback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 9f0da57..9014c2b 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -986,14 +986,14 @@ static int gb_loopback_fn(void *data) break; mutex_lock(&gb->mutex); - sysfs_notify(&gb->connection->bundle->dev.kobj, - NULL, "iteration_count"); /* Optionally terminate */ if (send_count == gb->iteration_max) { if (gb->iteration_count == gb->iteration_max) { gb->type = 0; send_count = 0; + sysfs_notify(&gb->dev->kobj, NULL, + "iteration_count"); } mutex_unlock(&gb->mutex); continue; -- 2.7.4