diff options
author | Andreas Noever <andreas.noever@gmail.com> | 2014-06-03 22:04:02 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-19 23:07:08 +0200 |
commit | a25c8b2fc9636aaf29d9d9d89f92cdfd27a2a23d (patch) | |
tree | db952ae5e1d2897f54751e9d2d4c258dce853a00 /drivers/thunderbolt/tb.c | |
parent | thunderbolt: Add tb_regs.h (diff) | |
download | linux-a25c8b2fc9636aaf29d9d9d89f92cdfd27a2a23d.tar.xz linux-a25c8b2fc9636aaf29d9d9d89f92cdfd27a2a23d.zip |
thunderbolt: Initialize root switch and ports
This patch adds the structures tb_switch and tb_port as well as code to
initialize the root switch.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-rw-r--r-- | drivers/thunderbolt/tb.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 164dea083e9e..f1b6100b6cf0 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -71,6 +71,10 @@ void thunderbolt_shutdown_and_free(struct tb *tb) { mutex_lock(&tb->lock); + if (tb->root_switch) + tb_switch_free(tb->root_switch); + tb->root_switch = NULL; + if (tb->ctl) { tb_ctl_stop(tb->ctl); tb_ctl_free(tb->ctl); @@ -126,6 +130,10 @@ struct tb *thunderbolt_alloc_and_start(struct tb_nhi *nhi) */ tb_ctl_start(tb->ctl); + tb->root_switch = tb_switch_alloc(tb, 0); + if (!tb->root_switch) + goto err_locked; + /* Allow tb_handle_hotplug to progress events */ tb->hotplug_active = true; mutex_unlock(&tb->lock); |