[PATCH v4 2/5] wifi: ath11k: store cur_regulatory_info for each radio

Kalle Valo kvalo at kernel.org
Wed Aug 2 04:30:55 PDT 2023


Wen Gong <quic_wgong at quicinc.com> writes:

> The regulatory info of WMI_REG_CHAN_LIST_CC_EXT_EVENTID is not saved
> in ath11k now, the info should be saved in ath11k. Save the info for
> each radio and support switch regulatory rules dynamically.
>
> Tested-on: WCN6855 hw2.0 PCI
> WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
>
> Signed-off-by: Wen Gong <quic_wgong at quicinc.com>

[...]

> +enum wmi_vdev_type ath11k_mac_get_ar_vdev_type(struct ath11k *ar)
> +{
> +	struct ath11k_vif *arvif;
> +
> +	list_for_each_entry(arvif, &ar->arvifs, list) {
> +		return arvif->vdev_type;
> +	}
> +
> +	return WMI_VDEV_TYPE_UNSPEC;
> +}

This function looks odd to me and there are no comments to clarify.
What's the idea of using list_for_each_entry() and then immediately
return with the first entry? I guess the assumption here is that every
arvif has the same type? Can we really trust that? And at least it
should be documented here.

Also wouldn't list_first_entry_or_null() be more intuitive?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



More information about the ath11k mailing list