diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2017-06-06 15:25:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-09 12:42:42 +0300 |
commit | 81a54b5e1986d02da33c59133556ce9fe2032049 (patch) | |
tree | ce49795db099240d89d573cc8a6cd49b0e06578f /drivers/thunderbolt/domain.c | |
parent | 05c242e9e47d210ed6cbef31f2c441fa6ee325c6 (diff) | |
download | linux-81a54b5e1986d02da33c59133556ce9fe2032049.tar.xz |
thunderbolt: Let the connection manager handle all notifications
Currently the control channel (ctl.c) handles the one supported
notification (PLUG_EVENT) and sends back ACK accordingly. However, we
are going to add support for the internal connection manager (ICM) that
needs to handle a different notifications. So instead of dealing
everything in the control channel, we change the callback to take an
arbitrary thunderbolt packet and convert the native connection manager
to handle the event itself.
In addition we only push replies we know of to the response FIFO.
Everything else is treated as notification (or request) and is expected
to be dealt by the connection manager implementation.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Reviewed-by: Michael Jamet <michael.jamet@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt/domain.c')
-rw-r--r-- | drivers/thunderbolt/domain.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c index 3302f4c59638..54bc15f9bf6b 100644 --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c @@ -95,6 +95,19 @@ err_free: return NULL; } +static void tb_domain_event_cb(void *data, enum tb_cfg_pkg_type type, + const void *buf, size_t size) +{ + struct tb *tb = data; + + if (!tb->cm_ops->handle_event) { + tb_warn(tb, "domain does not have event handler\n"); + return; + } + + tb->cm_ops->handle_event(tb, type, buf, size); +} + /** * tb_domain_add() - Add domain to the system * @tb: Domain to add @@ -115,7 +128,7 @@ int tb_domain_add(struct tb *tb) mutex_lock(&tb->lock); - tb->ctl = tb_ctl_alloc(tb->nhi, tb->cm_ops->hotplug, tb); + tb->ctl = tb_ctl_alloc(tb->nhi, tb_domain_event_cb, tb); if (!tb->ctl) { ret = -ENOMEM; goto err_unlock; |