[bug report] firmware: arm_scmi: Add per-channel Raw injection support

Matthew Wilcox willy at infradead.org
Tue Jan 17 06:49:31 PST 2023


On Tue, Jan 17, 2023 at 02:30:43PM +0000, Cristian Marussi wrote:
> >     1118                         ret = idr_alloc(&raw->queues_idr, q,
> >     1119                                         channels[i], channels[i] + 1,
> >     1120                                         GFP_KERNEL);
> >     1121                         if (ret != channels[i])
> >     1122                                 dev_err(dev,
> >     1123                                         "Fail to allocate Raw queue 0x%02X\n",
> >     1124                                         channels[i]);
> > 
> > Heh.  I've never seen anyone use an IDR range of one value before...
> 
> Well, the choice was between wasting an hashtable or a radix-tree IDR for a
> few mapping channel--->q and I went for the 1-range IDR which is already
> used in SCMI stack to map various refs to channel numbers.
> (I avoid in general to put a simple plain 256 array on the stack that can
> lead to stack-size issues especially while compiling on armv7)

The "range of one" idiom is fairly frequently used, but generally it is
an indication that you want to use the XArray API instead of the IDR API,
which is deprecated in any case.

I've given up tilting at that windmill as I'm more concerned with the
folio work, but it'd be nice if you could convert from IDR to XArray here.



More information about the linux-arm-kernel mailing list