From: Bryan O'Donoghue Date: Tue, 28 Jul 2015 17:34:39 +0000 (+0100) Subject: greybus: loopback: warn user if kfifo cannot log all data X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cb60f4960ea03d373899c2c21b0611404025c31f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: loopback: warn user if kfifo cannot log all data The depth of the kfifo used to log the latency data for user-space can be moved upwards or downward by way of a module parameter. The user may still specify a test set that's larger than the number of kfifo elements we have available. If the user specifies more iterations than can be logged give a warning as feedback and continue with the test. Signed-off-by: Bryan O'Donoghue Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 7b3ce13032c5..08a77fee385a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -131,14 +131,15 @@ static ssize_t field##_store(struct device *dev, \ if (ret != 1) \ len = -EINVAL; \ else \ - gb_loopback_check_attr(gb); \ + gb_loopback_check_attr(connection, gb); \ mutex_unlock(&gb->mutex); \ return len; \ } \ static DEVICE_ATTR_RW(field) static void gb_loopback_reset_stats(struct gb_loopback *gb); -static void gb_loopback_check_attr(struct gb_loopback *gb) +static void gb_loopback_check_attr(struct gb_connection *connection, + struct gb_loopback *gb) { if (gb->ms_wait > GB_LOOPBACK_MS_WAIT_MAX) gb->ms_wait = GB_LOOPBACK_MS_WAIT_MAX; @@ -148,6 +149,12 @@ static void gb_loopback_check_attr(struct gb_loopback *gb) gb->iteration_count = 0; gb_loopback_reset_stats(gb); + if (kfifo_depth < gb->iteration_max) { + dev_warn(&connection->dev, + "iteration_max %u kfifo_depth %u cannot log all data\n", + gb->iteration_max, kfifo_depth); + } + switch (gb->type) { case GB_LOOPBACK_TYPE_PING: case GB_LOOPBACK_TYPE_TRANSFER: