summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/tb.h
diff options
context:
space:
mode:
authorAndreas Noever <andreas.noever@gmail.com>2014-06-03 22:04:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-19 14:07:07 -0700
commitd6cc51cd1a4aed1d9e2dd66d643d729acb4be560 (patch)
treea193e0c2807cf18e11c770392c71e51bafbe378a /drivers/thunderbolt/tb.h
parentf25bf6fcb1a83a149bc8b5285d33b48cbd47c7d7 (diff)
downloadop-kernel-dev-d6cc51cd1a4aed1d9e2dd66d643d729acb4be560.zip
op-kernel-dev-d6cc51cd1a4aed1d9e2dd66d643d729acb4be560.tar.gz
thunderbolt: Setup control channel
Add struct tb which will contain our view of the thunderbolt bus. For now it just contains a pointer to the control channel and a workqueue for hotplug events. Add thunderbolt_alloc_and_start() and thunderbolt_shutdown_and_free() which are responsible for setup and teardown of struct tb. Signed-off-by: Andreas Noever <andreas.noever@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt/tb.h')
-rw-r--r--drivers/thunderbolt/tb.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
new file mode 100644
index 0000000..6055dfd
--- /dev/null
+++ b/drivers/thunderbolt/tb.h
@@ -0,0 +1,35 @@
+/*
+ * Thunderbolt Cactus Ridge driver - bus logic (NHI independent)
+ *
+ * Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com>
+ */
+
+#ifndef TB_H_
+#define TB_H_
+
+#include "ctl.h"
+
+/**
+ * struct tb - main thunderbolt bus structure
+ */
+struct tb {
+ struct mutex lock; /*
+ * Big lock. Must be held when accessing cfg or
+ * any struct tb_switch / struct tb_port.
+ */
+ struct tb_nhi *nhi;
+ struct tb_ctl *ctl;
+ struct workqueue_struct *wq; /* ordered workqueue for plug events */
+ bool hotplug_active; /*
+ * tb_handle_hotplug will stop progressing plug
+ * events and exit if this is not set (it needs to
+ * acquire the lock one more time). Used to drain
+ * wq after cfg has been paused.
+ */
+
+};
+
+struct tb *thunderbolt_alloc_and_start(struct tb_nhi *nhi);
+void thunderbolt_shutdown_and_free(struct tb *tb);
+
+#endif
OpenPOWER on IntegriCloud