[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k07yq230.fsf@kernel.org>
Date: Wed, 27 Jul 2022 13:31:15 +0300
From: Kalle Valo <kvalo@...nel.org>
To: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
Cc: loic.poulain@...aro.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, wcn36xx@...ts.infradead.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 4/4] wcn36xx: Add debugfs entry to read firmware feature strings
Bryan O'Donoghue <bryan.odonoghue@...aro.org> writes:
> Add in the ability to easily find the firmware feature bits reported in the
> get feature exchange without having to compile-in debug prints.
>
> root@...aro-alip:~# cat /sys/kernel/debug/ieee80211/phy0/wcn36xx/firmware_feat_caps
> MCC
> P2P
> DOT11AC
> SLM_SESSIONIZATION
> DOT11AC_OPMODE
> SAP32STA
> TDLS
> P2P_GO_NOA_DECOUPLE_INIT_SCAN
> WLANACTIVE_OFFLOAD
> BEACON_OFFLOAD
> SCAN_OFFLOAD
> BCN_MISS_OFFLOAD
> STA_POWERSAVE
> STA_ADVANCED_PWRSAVE
> BCN_FILTER
> RTT
> RATECTRL
> WOW
> WLAN_ROAM_SCAN_OFFLOAD
> SPECULATIVE_PS_POLL
> IBSS_HEARTBEAT_OFFLOAD
> WLAN_SCAN_OFFLOAD
> WLAN_PERIODIC_TX_PTRN
> ADVANCE_TDLS
> BATCH_SCAN
> FW_IN_TX_PATH
> EXTENDED_NSOFFLOAD_SLOT
> CH_SWITCH_V1
> HT40_OBSS_SCAN
> UPDATE_CHANNEL_LIST
> WLAN_MCADDR_FLT
> WLAN_CH144
> TDLS_SCAN_COEXISTENCE
> LINK_LAYER_STATS_MEAS
> MU_MIMO
> EXTENDED_SCAN
> DYNAMIC_WMM_PS
> MAC_SPOOFED_SCAN
> FW_STATS
> WPS_PRBRSP_TMPL
> BCN_IE_FLT_DELTA
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
[...]
> +static ssize_t read_file_firmware_feature_caps(struct file *file,
> + char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wcn36xx *wcn = file->private_data;
> + unsigned long page = get_zeroed_page(GFP_KERNEL);
> + char *p = (char *)page;
> + int i;
> + int ret;
> +
> + if (!p)
> + return -ENOMEM;
> +
> + mutex_lock(&wcn->hal_mutex);
> + for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) {
> + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) {
> + p += sprintf(p, "%s\n",
> + wcn36xx_firmware_get_cap_name(i));
> + }
> + }
> + mutex_unlock(&wcn->hal_mutex);
> +
> + ret = simple_read_from_buffer(user_buf, count, ppos, (char *)page,
> + (unsigned long)p - page);
> +
> + free_page(page);
> + return ret;
> +}
Why not use the normal use kzalloc() and kfree()? That way you would not
need a separate page variable. What's the benefit from
get_zeroed_page()?
Also I don't see any checks for a memory allocation failure.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists