Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211: simplify ieee80211_recalc_chanctx_min_def() API

ieee80211_recalc_chanctx_min_def() is used outside the chandef
code, but then should/is always used with NULL/false for the
two last arguments. Remove them, and create another level of
indirection for use inside the file.

Link: https://patch.msgid.link/20251105160431.33408844c392.I4f52298861780c17a27cd229609e8a3e29c8d740@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+32 -26
+27 -19
net/mac80211/chan.c
··· 410 410 * channel context. 411 411 */ 412 412 static u32 413 - _ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 414 - struct ieee80211_chanctx *ctx, 415 - struct ieee80211_link_data *rsvd_for, 416 - bool check_reserved) 413 + __ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 414 + struct ieee80211_chanctx *ctx, 415 + struct ieee80211_link_data *rsvd_for, 416 + bool check_reserved) 417 417 { 418 418 enum nl80211_chan_width max_bw; 419 419 struct cfg80211_chan_def min_def; ··· 518 518 * the max of min required widths of all the interfaces bound to this 519 519 * channel context. 520 520 */ 521 - void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 522 - struct ieee80211_chanctx *ctx, 523 - struct ieee80211_link_data *rsvd_for, 524 - bool check_reserved) 521 + static void 522 + _ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 523 + struct ieee80211_chanctx *ctx, 524 + struct ieee80211_link_data *rsvd_for, 525 + bool check_reserved) 525 526 { 526 - u32 changed = _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for, 527 - check_reserved); 527 + u32 changed = __ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for, 528 + check_reserved); 528 529 529 530 if (!changed) 530 531 return; ··· 537 536 538 537 /* check is BW wider */ 539 538 ieee80211_chan_bw_change(local, ctx, false, false); 539 + } 540 + 541 + void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 542 + struct ieee80211_chanctx *ctx) 543 + { 544 + _ieee80211_recalc_chanctx_min_def(local, ctx, NULL, false); 540 545 } 541 546 542 547 static void _ieee80211_change_chanctx(struct ieee80211_local *local, ··· 579 572 ieee80211_chan_bw_change(local, old_ctx, false, true); 580 573 581 574 if (ieee80211_chanreq_identical(&ctx_req, chanreq)) { 582 - ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for, false); 575 + _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for, false); 583 576 return; 584 577 } 585 578 ··· 600 593 ctx->conf.ap = chanreq->ap; 601 594 602 595 /* check if min chanctx also changed */ 603 - changed |= _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for, false); 596 + changed |= __ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for, 597 + false); 604 598 605 599 ieee80211_add_wbrf(local, &ctx->conf.def); 606 600 ··· 740 732 ctx->conf.radar_enabled = false; 741 733 ctx->conf.radio_idx = radio_idx; 742 734 ctx->radar_detected = false; 743 - _ieee80211_recalc_chanctx_min_def(local, ctx, NULL, false); 735 + __ieee80211_recalc_chanctx_min_def(local, ctx, NULL, false); 744 736 745 737 return ctx; 746 738 } ··· 933 925 934 926 if (new_ctx) { 935 927 /* recalc considering the link we'll use it for now */ 936 - ieee80211_recalc_chanctx_min_def(local, new_ctx, link, false); 928 + _ieee80211_recalc_chanctx_min_def(local, new_ctx, link, false); 937 929 938 930 ret = drv_assign_vif_chanctx(local, sdata, link->conf, new_ctx); 939 931 if (assign_on_failure || !ret) { ··· 954 946 ieee80211_recalc_chanctx_chantype(local, curr_ctx); 955 947 ieee80211_recalc_smps_chanctx(local, curr_ctx); 956 948 ieee80211_recalc_radar_chanctx(local, curr_ctx); 957 - ieee80211_recalc_chanctx_min_def(local, curr_ctx, NULL, false); 949 + ieee80211_recalc_chanctx_min_def(local, curr_ctx); 958 950 } 959 951 960 952 if (new_ctx && ieee80211_chanctx_num_assigned(local, new_ctx) > 0) { 961 953 ieee80211_recalc_txpower(link, false); 962 - ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL, false); 954 + ieee80211_recalc_chanctx_min_def(local, new_ctx); 963 955 } 964 956 965 957 if (conf) { ··· 1422 1414 if (ieee80211_chanctx_refcount(local, old_ctx) == 0) 1423 1415 ieee80211_free_chanctx(local, old_ctx, false); 1424 1416 1425 - ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL, false); 1417 + ieee80211_recalc_chanctx_min_def(local, new_ctx); 1426 1418 ieee80211_recalc_smps_chanctx(local, new_ctx); 1427 1419 ieee80211_recalc_radar_chanctx(local, new_ctx); 1428 1420 ··· 1717 1709 true, true); 1718 1710 } 1719 1711 1720 - ieee80211_recalc_chanctx_min_def(local, ctx, NULL, true); 1712 + _ieee80211_recalc_chanctx_min_def(local, ctx, NULL, true); 1721 1713 } 1722 1714 1723 1715 /* ··· 1789 1781 ieee80211_recalc_chanctx_chantype(local, ctx); 1790 1782 ieee80211_recalc_smps_chanctx(local, ctx); 1791 1783 ieee80211_recalc_radar_chanctx(local, ctx); 1792 - ieee80211_recalc_chanctx_min_def(local, ctx, NULL, false); 1784 + ieee80211_recalc_chanctx_min_def(local, ctx); 1793 1785 1794 1786 for_each_sdata_link(local, link) { 1795 1787 if (link->reserved_chanctx != ctx)
+3 -3
net/mac80211/he.c
··· 3 3 * HE handling 4 4 * 5 5 * Copyright(c) 2017 Intel Deutschland GmbH 6 - * Copyright(c) 2019 - 2024 Intel Corporation 6 + * Copyright(c) 2019-2025 Intel Corporation 7 7 */ 8 8 9 9 #include "ieee80211_i.h" ··· 313 313 ieee80211_link_sta_rc_update_omi(link, link_sta); 314 314 } else { 315 315 link_sta->rx_omi_bw_rx = bw; 316 - ieee80211_recalc_chanctx_min_def(local, chanctx, NULL, false); 316 + ieee80211_recalc_chanctx_min_def(local, chanctx); 317 317 } 318 318 319 319 link_sta->rx_omi_bw_staging = bw; ··· 359 359 /* channel context in finalize only when narrowing bandwidth */ 360 360 WARN_ON(link_sta->rx_omi_bw_rx < link_sta->rx_omi_bw_staging); 361 361 link_sta->rx_omi_bw_rx = link_sta->rx_omi_bw_staging; 362 - ieee80211_recalc_chanctx_min_def(local, chanctx, NULL, false); 362 + ieee80211_recalc_chanctx_min_def(local, chanctx); 363 363 } 364 364 365 365 trace_api_return_void(local);
+1 -3
net/mac80211/ieee80211_i.h
··· 2768 2768 void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 2769 2769 struct ieee80211_chanctx *chanctx); 2770 2770 void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 2771 - struct ieee80211_chanctx *ctx, 2772 - struct ieee80211_link_data *rsvd_for, 2773 - bool check_reserved); 2771 + struct ieee80211_chanctx *ctx); 2774 2772 bool ieee80211_is_radar_required(struct ieee80211_local *local, 2775 2773 struct cfg80211_scan_request *req); 2776 2774 bool ieee80211_is_radio_idx_in_scan_req(struct wiphy *wiphy,
+1 -1
net/mac80211/util.c
··· 2347 2347 2348 2348 chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, 2349 2349 conf); 2350 - ieee80211_recalc_chanctx_min_def(local, chanctx, NULL, false); 2350 + ieee80211_recalc_chanctx_min_def(local, chanctx); 2351 2351 } 2352 2352 } 2353 2353