summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-07-23 10:50:02 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-07-23 12:55:25 -0700
commit5a5bc354c65d9e5f255f1861212ec5fa4852a891 (patch)
treefc5646c6483bd0f097b71bb8a64cdfc0048195d7 /drivers/staging/greybus/connection.c
parent10f9fa133a295fa0f2f36c1a481b7e8b82b12891 (diff)
downloadlinux-stable-5a5bc354c65d9e5f255f1861212ec5fa4852a891.tar.gz
linux-stable-5a5bc354c65d9e5f255f1861212ec5fa4852a891.tar.bz2
linux-stable-5a5bc354c65d9e5f255f1861212ec5fa4852a891.zip
greybus: operation: use per-connection work queues
Replace the global operation work queue with per-connection work queues. There is no need to keep operations strictly ordered across connections, something which only adds unnecessary latency. Tested-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index 555625c3fcef..b88abed2e1ad 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -7,6 +7,8 @@
* Released under the GPLv2 only.
*/
+#include <linux/workqueue.h>
+
#include "greybus.h"
static DEFINE_SPINLOCK(gb_connections_lock);
@@ -99,6 +101,7 @@ static void gb_connection_release(struct device *dev)
{
struct gb_connection *connection = to_gb_connection(dev);
+ destroy_workqueue(connection->wq);
kfree(connection);
}
@@ -190,6 +193,11 @@ gb_connection_create_range(struct greybus_host_device *hd,
spin_lock_init(&connection->lock);
INIT_LIST_HEAD(&connection->operations);
+ connection->wq = alloc_workqueue("%s:%d", WQ_UNBOUND, 1,
+ dev_name(parent), cport_id);
+ if (!connection->wq)
+ goto err_free_connection;
+
connection->dev.parent = parent;
connection->dev.bus = &greybus_bus_type;
connection->dev.type = &greybus_connection_type;
@@ -227,6 +235,8 @@ gb_connection_create_range(struct greybus_host_device *hd,
return connection;
+err_free_connection:
+ kfree(connection);
err_remove_ida:
ida_simple_remove(id_map, hd_cport_id);