Skip to content

Commit 8d73f6b

Browse files
committed
thunderbolt: Make bandwidth allocation mode function names consistent
Make sure the DisplayPort bandwidth allocation mode function names are consistent with the existing ones, such as USB3. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent fd4d58d commit 8d73f6b

4 files changed

Lines changed: 52 additions & 46 deletions

File tree

drivers/thunderbolt/tb.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ tb_attach_bandwidth_group(struct tb_cm *tcm, struct tb_port *in,
131131
static void tb_discover_bandwidth_group(struct tb_cm *tcm, struct tb_port *in,
132132
struct tb_port *out)
133133
{
134-
if (usb4_dp_port_bw_mode_enabled(in)) {
134+
if (usb4_dp_port_bandwidth_mode_enabled(in)) {
135135
int index, i;
136136

137137
index = usb4_dp_port_group_id(in);
@@ -1169,7 +1169,7 @@ tb_recalc_estimated_bandwidth_for_group(struct tb_bandwidth_group *group)
11691169
struct tb_tunnel *tunnel;
11701170
struct tb_port *out;
11711171

1172-
if (!usb4_dp_port_bw_mode_enabled(in))
1172+
if (!usb4_dp_port_bandwidth_mode_enabled(in))
11731173
continue;
11741174

11751175
tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, NULL);
@@ -1217,7 +1217,7 @@ tb_recalc_estimated_bandwidth_for_group(struct tb_bandwidth_group *group)
12171217
else
12181218
estimated_bw = estimated_up;
12191219

1220-
if (usb4_dp_port_set_estimated_bw(in, estimated_bw))
1220+
if (usb4_dp_port_set_estimated_bandwidth(in, estimated_bw))
12211221
tb_port_warn(in, "failed to update estimated bandwidth\n");
12221222
}
12231223

@@ -1912,12 +1912,12 @@ static void tb_handle_dp_bandwidth_request(struct work_struct *work)
19121912

19131913
tb_port_dbg(in, "handling bandwidth allocation request\n");
19141914

1915-
if (!usb4_dp_port_bw_mode_enabled(in)) {
1915+
if (!usb4_dp_port_bandwidth_mode_enabled(in)) {
19161916
tb_port_warn(in, "bandwidth allocation mode not enabled\n");
19171917
goto unlock;
19181918
}
19191919

1920-
ret = usb4_dp_port_requested_bw(in);
1920+
ret = usb4_dp_port_requested_bandwidth(in);
19211921
if (ret < 0) {
19221922
if (ret == -ENODATA)
19231923
tb_port_dbg(in, "no bandwidth request active\n");

drivers/thunderbolt/tb.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,19 +1292,20 @@ int usb4_usb3_port_release_bandwidth(struct tb_port *port, int *upstream_bw,
12921292
int *downstream_bw);
12931293

12941294
int usb4_dp_port_set_cm_id(struct tb_port *port, int cm_id);
1295-
bool usb4_dp_port_bw_mode_supported(struct tb_port *port);
1296-
bool usb4_dp_port_bw_mode_enabled(struct tb_port *port);
1297-
int usb4_dp_port_set_cm_bw_mode_supported(struct tb_port *port, bool supported);
1295+
bool usb4_dp_port_bandwidth_mode_supported(struct tb_port *port);
1296+
bool usb4_dp_port_bandwidth_mode_enabled(struct tb_port *port);
1297+
int usb4_dp_port_set_cm_bandwidth_mode_supported(struct tb_port *port,
1298+
bool supported);
12981299
int usb4_dp_port_group_id(struct tb_port *port);
12991300
int usb4_dp_port_set_group_id(struct tb_port *port, int group_id);
13001301
int usb4_dp_port_nrd(struct tb_port *port, int *rate, int *lanes);
13011302
int usb4_dp_port_set_nrd(struct tb_port *port, int rate, int lanes);
13021303
int usb4_dp_port_granularity(struct tb_port *port);
13031304
int usb4_dp_port_set_granularity(struct tb_port *port, int granularity);
1304-
int usb4_dp_port_set_estimated_bw(struct tb_port *port, int bw);
1305-
int usb4_dp_port_allocated_bw(struct tb_port *port);
1306-
int usb4_dp_port_allocate_bw(struct tb_port *port, int bw);
1307-
int usb4_dp_port_requested_bw(struct tb_port *port);
1305+
int usb4_dp_port_set_estimated_bandwidth(struct tb_port *port, int bw);
1306+
int usb4_dp_port_allocated_bandwidth(struct tb_port *port);
1307+
int usb4_dp_port_allocate_bandwidth(struct tb_port *port, int bw);
1308+
int usb4_dp_port_requested_bandwidth(struct tb_port *port);
13081309

13091310
int usb4_pci_port_set_ext_encapsulation(struct tb_port *port, bool enable);
13101311

drivers/thunderbolt/tunnel.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
641641
in->cap_adap + DP_REMOTE_CAP, 1);
642642
}
643643

644-
static int tb_dp_bw_alloc_mode_enable(struct tb_tunnel *tunnel)
644+
static int tb_dp_bandwidth_alloc_mode_enable(struct tb_tunnel *tunnel)
645645
{
646646
int ret, estimated_bw, granularity, tmp;
647647
struct tb_port *out = tunnel->dst_port;
@@ -653,7 +653,7 @@ static int tb_dp_bw_alloc_mode_enable(struct tb_tunnel *tunnel)
653653
if (!bw_alloc_mode)
654654
return 0;
655655

656-
ret = usb4_dp_port_set_cm_bw_mode_supported(in, true);
656+
ret = usb4_dp_port_set_cm_bandwidth_mode_supported(in, true);
657657
if (ret)
658658
return ret;
659659

@@ -717,12 +717,12 @@ static int tb_dp_bw_alloc_mode_enable(struct tb_tunnel *tunnel)
717717

718718
tb_port_dbg(in, "estimated bandwidth %d Mb/s\n", estimated_bw);
719719

720-
ret = usb4_dp_port_set_estimated_bw(in, estimated_bw);
720+
ret = usb4_dp_port_set_estimated_bandwidth(in, estimated_bw);
721721
if (ret)
722722
return ret;
723723

724724
/* Initial allocation should be 0 according the spec */
725-
ret = usb4_dp_port_allocate_bw(in, 0);
725+
ret = usb4_dp_port_allocate_bandwidth(in, 0);
726726
if (ret)
727727
return ret;
728728

@@ -744,7 +744,7 @@ static int tb_dp_init(struct tb_tunnel *tunnel)
744744
if (!tb_switch_is_usb4(sw))
745745
return 0;
746746

747-
if (!usb4_dp_port_bw_mode_supported(in))
747+
if (!usb4_dp_port_bandwidth_mode_supported(in))
748748
return 0;
749749

750750
tb_port_dbg(in, "bandwidth allocation mode supported\n");
@@ -753,17 +753,17 @@ static int tb_dp_init(struct tb_tunnel *tunnel)
753753
if (ret)
754754
return ret;
755755

756-
return tb_dp_bw_alloc_mode_enable(tunnel);
756+
return tb_dp_bandwidth_alloc_mode_enable(tunnel);
757757
}
758758

759759
static void tb_dp_deinit(struct tb_tunnel *tunnel)
760760
{
761761
struct tb_port *in = tunnel->src_port;
762762

763-
if (!usb4_dp_port_bw_mode_supported(in))
763+
if (!usb4_dp_port_bandwidth_mode_supported(in))
764764
return;
765-
if (usb4_dp_port_bw_mode_enabled(in)) {
766-
usb4_dp_port_set_cm_bw_mode_supported(in, false);
765+
if (usb4_dp_port_bandwidth_mode_enabled(in)) {
766+
usb4_dp_port_set_cm_bandwidth_mode_supported(in, false);
767767
tb_port_dbg(in, "bandwidth allocation mode disabled\n");
768768
}
769769
}
@@ -827,21 +827,22 @@ static int tb_dp_nrd_bandwidth(struct tb_tunnel *tunnel, int *max_bw)
827827
return nrd_bw;
828828
}
829829

830-
static int tb_dp_bw_mode_consumed_bandwidth(struct tb_tunnel *tunnel,
831-
int *consumed_up, int *consumed_down)
830+
static int tb_dp_bandwidth_mode_consumed_bandwidth(struct tb_tunnel *tunnel,
831+
int *consumed_up,
832+
int *consumed_down)
832833
{
833834
struct tb_port *out = tunnel->dst_port;
834835
struct tb_port *in = tunnel->src_port;
835836
int ret, allocated_bw, max_bw;
836837

837-
if (!usb4_dp_port_bw_mode_enabled(in))
838+
if (!usb4_dp_port_bandwidth_mode_enabled(in))
838839
return -EOPNOTSUPP;
839840

840841
if (!tunnel->bw_mode)
841842
return -EOPNOTSUPP;
842843

843844
/* Read what was allocated previously if any */
844-
ret = usb4_dp_port_allocated_bw(in);
845+
ret = usb4_dp_port_allocated_bandwidth(in);
845846
if (ret < 0)
846847
return ret;
847848
allocated_bw = ret;
@@ -876,10 +877,10 @@ static int tb_dp_allocated_bandwidth(struct tb_tunnel *tunnel, int *allocated_up
876877
* If we have already set the allocated bandwidth then use that.
877878
* Otherwise we read it from the DPRX.
878879
*/
879-
if (usb4_dp_port_bw_mode_enabled(in) && tunnel->bw_mode) {
880+
if (usb4_dp_port_bandwidth_mode_enabled(in) && tunnel->bw_mode) {
880881
int ret, allocated_bw, max_bw;
881882

882-
ret = usb4_dp_port_allocated_bw(in);
883+
ret = usb4_dp_port_allocated_bandwidth(in);
883884
if (ret < 0)
884885
return ret;
885886
allocated_bw = ret;
@@ -911,7 +912,7 @@ static int tb_dp_alloc_bandwidth(struct tb_tunnel *tunnel, int *alloc_up,
911912
struct tb_port *in = tunnel->src_port;
912913
int max_bw, ret, tmp;
913914

914-
if (!usb4_dp_port_bw_mode_enabled(in))
915+
if (!usb4_dp_port_bandwidth_mode_enabled(in))
915916
return -EOPNOTSUPP;
916917

917918
ret = tb_dp_nrd_bandwidth(tunnel, &max_bw);
@@ -920,14 +921,14 @@ static int tb_dp_alloc_bandwidth(struct tb_tunnel *tunnel, int *alloc_up,
920921

921922
if (in->sw->config.depth < out->sw->config.depth) {
922923
tmp = min(*alloc_down, max_bw);
923-
ret = usb4_dp_port_allocate_bw(in, tmp);
924+
ret = usb4_dp_port_allocate_bandwidth(in, tmp);
924925
if (ret)
925926
return ret;
926927
*alloc_down = tmp;
927928
*alloc_up = 0;
928929
} else {
929930
tmp = min(*alloc_up, max_bw);
930-
ret = usb4_dp_port_allocate_bw(in, tmp);
931+
ret = usb4_dp_port_allocate_bandwidth(in, tmp);
931932
if (ret)
932933
return ret;
933934
*alloc_down = 0;
@@ -1048,8 +1049,8 @@ static int tb_dp_consumed_bandwidth(struct tb_tunnel *tunnel, int *consumed_up,
10481049
* mode is enabled first and then read the bandwidth
10491050
* through those registers.
10501051
*/
1051-
ret = tb_dp_bw_mode_consumed_bandwidth(tunnel, consumed_up,
1052-
consumed_down);
1052+
ret = tb_dp_bandwidth_mode_consumed_bandwidth(tunnel, consumed_up,
1053+
consumed_down);
10531054
if (ret < 0) {
10541055
if (ret != -EOPNOTSUPP)
10551056
return ret;

drivers/thunderbolt/usb4.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,13 +2294,14 @@ int usb4_dp_port_set_cm_id(struct tb_port *port, int cm_id)
22942294
}
22952295

22962296
/**
2297-
* usb4_dp_port_bw_mode_supported() - Is the bandwidth allocation mode supported
2297+
* usb4_dp_port_bandwidth_mode_supported() - Is the bandwidth allocation mode
2298+
* supported
22982299
* @port: DP IN adapter to check
22992300
*
23002301
* Can be called to any DP IN adapter. Returns true if the adapter
23012302
* supports USB4 bandwidth allocation mode, false otherwise.
23022303
*/
2303-
bool usb4_dp_port_bw_mode_supported(struct tb_port *port)
2304+
bool usb4_dp_port_bandwidth_mode_supported(struct tb_port *port)
23042305
{
23052306
int ret;
23062307
u32 val;
@@ -2317,13 +2318,14 @@ bool usb4_dp_port_bw_mode_supported(struct tb_port *port)
23172318
}
23182319

23192320
/**
2320-
* usb4_dp_port_bw_mode_enabled() - Is the bandwidth allocation mode enabled
2321+
* usb4_dp_port_bandwidth_mode_enabled() - Is the bandwidth allocation mode
2322+
* enabled
23212323
* @port: DP IN adapter to check
23222324
*
23232325
* Can be called to any DP IN adapter. Returns true if the bandwidth
23242326
* allocation mode has been enabled, false otherwise.
23252327
*/
2326-
bool usb4_dp_port_bw_mode_enabled(struct tb_port *port)
2328+
bool usb4_dp_port_bandwidth_mode_enabled(struct tb_port *port)
23272329
{
23282330
int ret;
23292331
u32 val;
@@ -2340,7 +2342,8 @@ bool usb4_dp_port_bw_mode_enabled(struct tb_port *port)
23402342
}
23412343

23422344
/**
2343-
* usb4_dp_port_set_cm_bw_mode_supported() - Set/clear CM support for bandwidth allocation mode
2345+
* usb4_dp_port_set_cm_bandwidth_mode_supported() - Set/clear CM support for
2346+
* bandwidth allocation mode
23442347
* @port: DP IN adapter
23452348
* @supported: Does the CM support bandwidth allocation mode
23462349
*
@@ -2349,7 +2352,8 @@ bool usb4_dp_port_bw_mode_enabled(struct tb_port *port)
23492352
* otherwise. Specifically returns %-OPNOTSUPP if the passed in adapter
23502353
* does not support this.
23512354
*/
2352-
int usb4_dp_port_set_cm_bw_mode_supported(struct tb_port *port, bool supported)
2355+
int usb4_dp_port_set_cm_bandwidth_mode_supported(struct tb_port *port,
2356+
bool supported)
23532357
{
23542358
u32 val;
23552359
int ret;
@@ -2623,7 +2627,7 @@ int usb4_dp_port_set_granularity(struct tb_port *port, int granularity)
26232627
}
26242628

26252629
/**
2626-
* usb4_dp_port_set_estimated_bw() - Set estimated bandwidth
2630+
* usb4_dp_port_set_estimated_bandwidth() - Set estimated bandwidth
26272631
* @port: DP IN adapter
26282632
* @bw: Estimated bandwidth in Mb/s.
26292633
*
@@ -2633,7 +2637,7 @@ int usb4_dp_port_set_granularity(struct tb_port *port, int granularity)
26332637
* and negative errno otherwise. Specifically returns %-EOPNOTSUPP if
26342638
* the adapter does not support this.
26352639
*/
2636-
int usb4_dp_port_set_estimated_bw(struct tb_port *port, int bw)
2640+
int usb4_dp_port_set_estimated_bandwidth(struct tb_port *port, int bw)
26372641
{
26382642
u32 val, granularity;
26392643
int ret;
@@ -2659,14 +2663,14 @@ int usb4_dp_port_set_estimated_bw(struct tb_port *port, int bw)
26592663
}
26602664

26612665
/**
2662-
* usb4_dp_port_allocated_bw() - Return allocated bandwidth
2666+
* usb4_dp_port_allocated_bandwidth() - Return allocated bandwidth
26632667
* @port: DP IN adapter
26642668
*
26652669
* Reads and returns allocated bandwidth for @port in Mb/s (taking into
26662670
* account the programmed granularity). Returns negative errno in case
26672671
* of error.
26682672
*/
2669-
int usb4_dp_port_allocated_bw(struct tb_port *port)
2673+
int usb4_dp_port_allocated_bandwidth(struct tb_port *port)
26702674
{
26712675
u32 val, granularity;
26722676
int ret;
@@ -2752,15 +2756,15 @@ static int usb4_dp_port_wait_and_clear_cm_ack(struct tb_port *port,
27522756
}
27532757

27542758
/**
2755-
* usb4_dp_port_allocate_bw() - Set allocated bandwidth
2759+
* usb4_dp_port_allocate_bandwidth() - Set allocated bandwidth
27562760
* @port: DP IN adapter
27572761
* @bw: New allocated bandwidth in Mb/s
27582762
*
27592763
* Communicates the new allocated bandwidth with the DPCD (graphics
27602764
* driver). Takes into account the programmed granularity. Returns %0 in
27612765
* success and negative errno in case of error.
27622766
*/
2763-
int usb4_dp_port_allocate_bw(struct tb_port *port, int bw)
2767+
int usb4_dp_port_allocate_bandwidth(struct tb_port *port, int bw)
27642768
{
27652769
u32 val, granularity;
27662770
int ret;
@@ -2794,7 +2798,7 @@ int usb4_dp_port_allocate_bw(struct tb_port *port, int bw)
27942798
}
27952799

27962800
/**
2797-
* usb4_dp_port_requested_bw() - Read requested bandwidth
2801+
* usb4_dp_port_requested_bandwidth() - Read requested bandwidth
27982802
* @port: DP IN adapter
27992803
*
28002804
* Reads the DPCD (graphics driver) requested bandwidth and returns it
@@ -2803,7 +2807,7 @@ int usb4_dp_port_allocate_bw(struct tb_port *port, int bw)
28032807
* the adapter does not support bandwidth allocation mode, and %ENODATA
28042808
* if there is no active bandwidth request from the graphics driver.
28052809
*/
2806-
int usb4_dp_port_requested_bw(struct tb_port *port)
2810+
int usb4_dp_port_requested_bandwidth(struct tb_port *port)
28072811
{
28082812
u32 val, granularity;
28092813
int ret;

0 commit comments

Comments
 (0)