Re: [PATCH V2] rust: uapi: replace direct asm-generic/ioctl.h include with linux/ioctl.h

Miguel Ojeda <[email protected]>
Newsgroups dev.linux.lists.llvm,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <CANiq72kVXHSKO2xEp9m3thexiXc8z0kg+hc8RUM2ZS=xfO2wuA@mail.gmail.com>
On Tue, Aug 11, 2026 at 8:34 AM Mukesh Kumar Chaurasiya (IBM)
<[email protected]> wrote:
>
> rust/uapi/uapi_helper.h was directly including <uapi/asm-generic/ioctl.h>
> instead of the proper <uapi/linux/ioctl.h>.
>
> On powerpc, <uapi/linux/ioctl.h> pulls in <uapi/asm/ioctl.h> first, which
> defines _IOC_SIZEBITS, _IOC_DIRBITS, _IOC_NONE, and _IOC_WRITE with the
> arch-specific values, before falling through to <asm-generic/ioctl.h>.
> By bypassing that chain and including <asm-generic/ioctl.h> directly,
> the arch-specific overrides never ran first, so when other headers in
> the compilation later brought in the full arch-aware chain, Clang saw
> those four macros being defined a second time and emitted:
>
> clang diag: arch/powerpc/include/uapi/asm/ioctl.h:5:9: warning: '_IOC_SIZEBITS' macro redefined [-Wmacro-redefined]
> clang diag: arch/powerpc/include/uapi/asm/ioctl.h:6:9: warning: '_IOC_DIRBITS' macro redefined [-Wmacro-redefined]
> clang diag: arch/powerpc/include/uapi/asm/ioctl.h:8:9: warning: '_IOC_NONE' macro redefined [-Wmacro-redefined]
> clang diag: arch/powerpc/include/uapi/asm/ioctl.h:10:9: warning: '_IOC_WRITE' macro redefined [-Wmacro-redefined]
>
> Fix this by replacing the direct include of <uapi/asm-generic/ioctl.h>
> with <uapi/linux/ioctl.h>, which is the correct arch-aware entry point
> and already maintains the intended include order.
>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]>

Applied to `rust-next` -- thanks!

    Fixes: 4e1746656839 ("rust: uapi: Add UAPI crate")

We could, in principle, backport it if you think there may be
downstream users that may backport powerpc -- I wanted to at least
have the Fixes: tag even if not the Cc: stable@ so that they could
find this commit if needed.

Cheers,
Miguel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.