Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2939f41 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

greybus: loopback: add poll support to the iteration_count sysfs file



This adds the ability to poll on "iteration_count" in sysfs and be woken
up when it changes, saving some cycles constantly hammering on the file
waiting for it to change.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Tested-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
parent 701615f8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -141,7 +141,6 @@ gb_loopback_stats_attrs(throughput);
gb_loopback_ro_attr(error, d);
/* The current index of the for (i = 0; i < iteration_max; i++) loop */
gb_loopback_ro_attr(iteration_count, u);
/* TODO iteration_count might be better with the KOBJ_CHANGE event */

/*
 * Type of loopback message to send based on protocol type definitions
@@ -406,6 +405,8 @@ static int gb_loopback_fn(void *data)
		if (gb->iteration_max) {
			if (gb->iteration_count < gb->iteration_max) {
				gb->iteration_count++;
				sysfs_notify(&gb->connection->dev.kobj, NULL,
					     "iteration_count");
			} else {
				gb->type = 0;
				continue;