Re: [PATCH v3 1/9] driver core: Don't let a device probe until it's ready

From: Greg Kroah-Hartman

Date: Fri Apr 03 2026 - 13:24:09 EST


On Fri, Apr 03, 2026 at 09:26:58AM -0700, Doug Anderson wrote:
> Hi,
>
> On Fri, Apr 3, 2026 at 8:44 AM Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > > If you wish, I can turn this into something like:
> > >
> > > #define DEV_FLAG_READY_TO_PROBE 0
> > > #define DEV_FLAG_CAN_MATCH 1
> > > #define DEV_FLAG_DMA_IOMMU 2
> > > ...
> > >
> > > ...but that seemed worse (to me) than the enum. Please shout if I
> > > misunderstood or you disagree.
> >
> > If you make it a numbered enum, that's fine (I hate unnumbered ones),
>
> Sounds like a plan.
>
>
> > and a comment somewhere saying we will "max out" at 63, or have a
> > DEV_FLAG_MAX_BIT entry in there.
>
> Sure. To be compatible across all architectures, it should probably
> max at 31, right? Atomic bitops works with an "unsigned long" which
> might be only 32-bits. Oh, actually I should just add "DEV_FLAG_COUNT"
> at the end of the enum and declare flags with DECLARE_BITMAP(). Then
> there is no max.
>
> In total, I've now got this:
>
> enum struct_device_flags {
> DEV_FLAG_READY_TO_PROBE = 0,
> DEV_FLAG_CAN_MATCH = 1,
> DEV_FLAG_DMA_IOMMU = 2,
> DEV_FLAG_DMA_SKIP_SYNC = 3,
> DEV_FLAG_DMA_OPS_BYPASS = 4,
> DEV_FLAG_STATE_SYNCED = 5,
> DEV_FLAG_DMA_COHERENT = 6,
> DEV_FLAG_OF_NODE_REUSED = 7,
> DEV_FLAG_OFFLINE_DISABLED = 8,
> DEV_FLAG_OFFLINE = 9,
>
> DEV_FLAG_COUNT
> };
>
> ...and "flags" is now:
>
> DECLARE_BITMAP(flags, DEV_FLAG_COUNT);
>
> Yell if you want anything changed. I'll restart my allmodconfig
> compile tests now.

That looks much better, thanks!

greg k-h