From: "Nicolas Escande" <nico.escande@gmail.com>
To: "Baochen Qiang" <baochen.qiang@oss.qualcomm.com>,
"Nicolas Escande" <nico.escande@gmail.com>,
<ath12k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH ath-next v5] wifi: ath12k: avoid dynamic alloc when parsing wmi tb
Date: Thu, 02 Apr 2026 12:47:17 +0200 [thread overview]
Message-ID: <DHILY3AU5IF4.QIHK6RI52T93@gmail.com> (raw)
In-Reply-To: <b066de0a-71bc-4d03-8ce1-c6ff22eddda1@oss.qualcomm.com>
On Tue Mar 31, 2026 at 4:44 AM CEST, Baochen Qiang wrote:
[...]
>> @@ -11239,3 +11149,30 @@ int ath12k_wmi_send_mlo_link_set_active_cmd(struct ath12k_base *ab,
>> dev_kfree_skb(skb);
>> return ret;
>> }
>> +
>> +int ath12k_wmi_alloc(void)
>> +{
>> + guard(mutex)(&ath12k_wmi_mutex);
>> +
>> + if (!ath12k_wmi_tb)
>> + ath12k_wmi_tb = __alloc_percpu(WMI_TAG_MAX * sizeof(void *),
>> + __alignof__(void *));
>> + if (!ath12k_wmi_tb)
>> + return -ENOMEM;
>
> better move the second testing inside ?
>
> if (!ath12k_wmi_tb) {
> ath12k_wmi_tb = alloc();
> if (!ath12k_wmi_tb)
> return -ENOMEM;
> }
I tend to prefer not over indenting when I can avoid it but ok.
>
>> +
>> + ath12k_wmi_refcount++;
>> + return 0;
>> +}
>> +
>> +void ath12k_wmi_free(void)
>> +{
>> + guard(mutex)(&ath12k_wmi_mutex);
>> +
>> + if (!WARN_ON(ath12k_wmi_refcount - 1 < 0))
>
> better to use refcount_t and its APIs?
Indeed I'm not familiar with them but I'll look into it
>
>> + ath12k_wmi_refcount--;
>> +
>> + if (!ath12k_wmi_refcount) {
>> + free_percpu(ath12k_wmi_tb);
>> + ath12k_wmi_tb = NULL;
>> + }
>> +}
prev parent reply other threads:[~2026-04-02 10:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 10:24 [PATCH ath-next v5] wifi: ath12k: avoid dynamic alloc when parsing wmi tb Nicolas Escande
2026-03-30 19:38 ` Jeff Johnson
2026-04-02 10:44 ` Nicolas Escande
2026-03-31 2:44 ` Baochen Qiang
2026-04-02 10:47 ` Nicolas Escande [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DHILY3AU5IF4.QIHK6RI52T93@gmail.com \
--to=nico.escande@gmail.com \
--cc=ath12k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox