Re: [PATCH] drm/panthor: Convert IOCTL defines to an enum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 5, 2025 at 8:17 AM Erik Faye-Lund
<erik.faye-lund@xxxxxxxxxxxxx> wrote:
>
> On Wed, 2025-02-05 at 11:53 +0100, Erik Faye-Lund wrote:
> > On Tue, 2025-02-04 at 17:28 -0600, Rob Herring (Arm) wrote:
> > > Use an enum instead of #defines for panthor IOCTLs. This allows the
> > > header to be used with Rust code as bindgen can't handle complex
> > > defines.
> > >
> >
> >
> > Unfortunately, this goes in the opposite direction than what I was
> > asked to do here:
> >
> > https://lore.kernel.org/dri-devel/20241029140125.0607c26f@xxxxxxxxxxxxx/
> >
> > ...I still intend to get around to doing that, because we have
> > problems
> > with C enum and large values. I don't know if we can solve that while
> > making Rust happy without requiring C23 (which allows to specify the
> > underlying type of an enum), unfortunately...
> >
>
> Seems I misunderstood Boris, and he was referring to flags. The enums
> are of course fine to make into real enums.

Maybe we're relying on compiler specific behavior, but that's nothing
new in the kernel. This worked fine for me with both gcc and clang:

#include <stdio.h>

enum foo {
        BAR = (1UL << 63),
};

int main(void)
{
        printf("%lx\n", BAR);
        return 0;
}

Rob




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux