]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
thunderbolt: Rework tb_tunnel_consumed_bandwidth()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 26 Aug 2024 12:04:27 +0000 (15:04 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 3 Jan 2025 09:50:08 +0000 (11:50 +0200)
Rework to avoid the goto as it only makes it confusing. Move logging to
happen at the end so we can see all the tunnels this is being called.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tunnel.c

index 09619190c34a78e227aa410da35cebf71806b4a7..c625b5b84a7c65e84ef5c24081c641e22d8f6591 100644 (file)
@@ -2361,26 +2361,20 @@ int tb_tunnel_consumed_bandwidth(struct tb_tunnel *tunnel, int *consumed_up,
 {
        int up_bw = 0, down_bw = 0;
 
-       if (!tb_tunnel_is_active(tunnel))
-               goto out;
-
-       if (tunnel->consumed_bandwidth) {
+       if (tb_tunnel_is_active(tunnel) && tunnel->consumed_bandwidth) {
                int ret;
 
                ret = tunnel->consumed_bandwidth(tunnel, &up_bw, &down_bw);
                if (ret)
                        return ret;
-
-               tb_tunnel_dbg(tunnel, "consumed bandwidth %d/%d Mb/s\n", up_bw,
-                             down_bw);
        }
 
-out:
        if (consumed_up)
                *consumed_up = up_bw;
        if (consumed_down)
                *consumed_down = down_bw;
 
+       tb_tunnel_dbg(tunnel, "consumed bandwidth %d/%d Mb/s\n", up_bw, down_bw);
        return 0;
 }