Re: [PATCH wireless-next v2 06/31] wifi: mm81x: add core.h
From: Lachlan Hodges
Date: Wed Jun 10 2026 - 01:06:27 EST
On Thu, Jun 04, 2026 at 01:40:09PM +0200, Johannes Berg wrote:
> On Thu, 2026-04-30 at 14:55 +1000, Lachlan Hodges wrote:
> >
> > +#define KHZ_TO_HZ(x) ((x) * 1000)
> > +#define KHZ100_TO_MHZ(x) ((x) / 10)
> > +#define KHZ100_TO_KHZ(freq) ((freq) * 100)
> > +#define KHZ100_TO_HZ(freq) ((freq) * 100000)
>
> Maybe not right now, but at least the first one seems fairly generic and
> could be elsewhere.
There is a function:
static int mm81x_tx_h_get_prim_bw(struct cfg80211_chan_def *chandef)
{
return chandef->s1g_primary_2mhz ? 2 : 1;
}
which should definitely be in the cfg80211 since its a generic chandef
helper and will probably be needed at somepoint in mac/cfg in the future.
I can probably just have it as a patch prior similar to the SDIO id
as part of v3. Then I guess I can also do the same for the helpers above
and place them alongside:
/* convert frequencies */
#define MHZ_TO_KHZ(freq) ((freq) * 1000)
#define KHZ_TO_MHZ(freq) ((freq) / 1000)
#define PR_KHZ(f) KHZ_TO_MHZ(f), f % 1000
#define KHZ_F "%d.%03d"
Unless you have some other preference :)
lachlan