• [PATCH v3 10/19] thunderbolt: Export ring handling functions to modules

    From Mika Westerberg@21:1/5 to All on Mon Oct 2 12:40:01 2017
    These are used by Thunderbolt services to send and receive frames over
    the high-speed DMA rings.

    We also put the functions to tb_ namespace to make sure we do not
    collide with others and add missing kernel-doc comments for the exported functions.

    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Reviewed-by: Michael Jamet <michael.jamet@intel.com>
    Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    ---
    drivers/thunderbolt/ctl.c | 20 +++---
    drivers/thunderbolt/nhi.c | 62 +++++++++++------
    drivers/thunderbolt/nhi.h | 147 +----------------------------------------
    include/linux/thunderbolt.h | 158 ++++++++++++++++++++++++++++++++++++++++++++
    4 files changed, 211 insertions(+), 176 deletions(-)

    diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
    index 05400b77dcd7..dd10789e1dbb 100644
    --- a/drivers/thunderbolt/ctl.c
    +++ b/drivers/thunderbolt/ctl.c
    @@ -359,7 +359,7 @@ static int tb_ctl_tx(struct tb_ctl *ctl, const void *data, size_t len,
    cpu_to_be32_array(pkg->buffer, data, len / 4);
    *(__be32 *) (pkg->buffer + len) = tb_crc(pkg->buffer, len);

    - res = ring_tx(ctl->tx, &pkg->frame);
    + res = tb_ring_tx(ctl->tx, &pkg->frame);
    if (res) /* ring is stopped */
    tb_ctl_pkg_free(pkg);
    return res;
    @@ -376,7 +376,7 @@ static bool tb_ctl_handle_event(struct tb_ctl *ctl, enum tb_cfg_pkg_type type,

    static void tb_ctl_rx_submit(struct ctl_pkg *pkg)
    {
    - ring_r