Message ID | 20240513212836.292589-3-thorsten.blum@toblux.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Combine identical if/elif code blocks | expand |
Hi, On Tue, 14 May 2024 at 19:37, Thorsten Blum <thorsten.blum@toblux.com> wrote: > > Merge the identical if/elif code blocks and remove the following two > warnings reported by make includecheck: > > asm/ioctl.h is included more than once > linux/types.h is included more than once > > Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> > --- > include/uapi/drm/drm.h | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h > index 16122819edfe..315af7b19c97 100644 > --- a/include/uapi/drm/drm.h > +++ b/include/uapi/drm/drm.h > @@ -35,13 +35,7 @@ > #ifndef _DRM_H_ > #define _DRM_H_ > > -#if defined(__KERNEL__) > - > -#include <linux/types.h> > -#include <asm/ioctl.h> > -typedef unsigned int drm_handle_t; > - > -#elif defined(__linux__) I think it is intentionally like that. Please see https://patchwork.freedesktop.org/patch/78747/ > +#if defined(__KERNEL__) || defined(__linux__) > > #include <linux/types.h> > #include <asm/ioctl.h> > -- > 2.45.0 > Regards, Luc
On 15. May 2024, at 09:43, Luc Ma <onion0709@gmail.com> wrote: > On Tue, 14 May 2024 at 19:37, Thorsten Blum <thorsten.blum@toblux.com> wrote: >> >> Merge the identical if/elif code blocks and remove the following two >> warnings reported by make includecheck: >> >> asm/ioctl.h is included more than once >> linux/types.h is included more than once >> >> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> >> --- >> include/uapi/drm/drm.h | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h >> index 16122819edfe..315af7b19c97 100644 >> --- a/include/uapi/drm/drm.h >> +++ b/include/uapi/drm/drm.h >> @@ -35,13 +35,7 @@ >> #ifndef _DRM_H_ >> #define _DRM_H_ >> >> -#if defined(__KERNEL__) >> - >> -#include <linux/types.h> >> -#include <asm/ioctl.h> >> -typedef unsigned int drm_handle_t; >> - >> -#elif defined(__linux__) > > I think it is intentionally like that. Please see > https://patchwork.freedesktop.org/patch/78747/ Thank you for the link. Does anyone know if the reason for the change from 2016 ("make headers_install can't handle fancy conditions, ...") is still valid? Other headers use the same #if directive: fs/ext4/ext4.h:948:#if defined(__KERNEL__) || defined(__linux__) include/uapi/sound/asound.h:11:#if defined(__KERNEL__) || defined(__linux__) And there are many others using similar conditions: arch/arm/include/uapi/asm/swab.h:27:#if !defined(__KERNEL__) || __LINUX_ARM_ARCH__ < 6 arch/sparc/include/uapi/asm/signal.h:92:#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) arch/sparc/include/uapi/asm/termios.h:8:#if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS) include/uapi/linux/soundcard.h:1040:#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS) include/uapi/linux/stat.h:7:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) include/uapi/sound/asound.h:11:#if defined(__KERNEL__) || defined(__linux__) ... Thanks, Thorsten
On 15. May 2024, at 11:22, Thorsten Blum <thorsten.blum@toblux.com> wrote: > On 15. May 2024, at 09:43, Luc Ma <onion0709@gmail.com> wrote: >> On Tue, 14 May 2024 at 19:37, Thorsten Blum <thorsten.blum@toblux.com> wrote: >>> >>> Merge the identical if/elif code blocks and remove the following two >>> warnings reported by make includecheck: >>> >>> asm/ioctl.h is included more than once >>> linux/types.h is included more than once >>> >>> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> >>> --- >>> include/uapi/drm/drm.h | 8 +------- >>> 1 file changed, 1 insertion(+), 7 deletions(-) >>> >>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h >>> index 16122819edfe..315af7b19c97 100644 >>> --- a/include/uapi/drm/drm.h >>> +++ b/include/uapi/drm/drm.h >>> @@ -35,13 +35,7 @@ >>> #ifndef _DRM_H_ >>> #define _DRM_H_ >>> >>> -#if defined(__KERNEL__) >>> - >>> -#include <linux/types.h> >>> -#include <asm/ioctl.h> >>> -typedef unsigned int drm_handle_t; >>> - >>> -#elif defined(__linux__) >> >> I think it is intentionally like that. Please see >> https://patchwork.freedesktop.org/patch/78747/ > > Thank you for the link. > > Does anyone know if the reason for the change from 2016 ("make > headers_install can't handle fancy conditions, ...") is still valid? > > Other headers use the same #if directive: > > fs/ext4/ext4.h:948:#if defined(__KERNEL__) || defined(__linux__) > include/uapi/sound/asound.h:11:#if defined(__KERNEL__) || defined(__linux__) > > And there are many others using similar conditions: > > arch/arm/include/uapi/asm/swab.h:27:#if !defined(__KERNEL__) || __LINUX_ARM_ARCH__ < 6 > arch/sparc/include/uapi/asm/signal.h:92:#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) > arch/sparc/include/uapi/asm/termios.h:8:#if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS) > include/uapi/linux/soundcard.h:1040:#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS) > include/uapi/linux/stat.h:7:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) > include/uapi/sound/asound.h:11:#if defined(__KERNEL__) || defined(__linux__) > ... > > Thanks, > Thorsten Re-sending this to linux-kernel@vger.kernel.org because the mailing list somehow got lost in Luc's reply.
Hi, On Wed, 15 May 2024 at 17:31, Thorsten Blum <thorsten.blum@toblux.com> wrote: > > On 15. May 2024, at 11:22, Thorsten Blum <thorsten.blum@toblux.com> wrote: > > On 15. May 2024, at 09:43, Luc Ma <onion0709@gmail.com> wrote: > >> On Tue, 14 May 2024 at 19:37, Thorsten Blum <thorsten.blum@toblux.com> wrote: > >>> > >>> Merge the identical if/elif code blocks and remove the following two > >>> warnings reported by make includecheck: > >>> > >>> asm/ioctl.h is included more than once > >>> linux/types.h is included more than once > >>> > >>> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> > >>> --- > >>> include/uapi/drm/drm.h | 8 +------- > >>> 1 file changed, 1 insertion(+), 7 deletions(-) > >>> > >>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h > >>> index 16122819edfe..315af7b19c97 100644 > >>> --- a/include/uapi/drm/drm.h > >>> +++ b/include/uapi/drm/drm.h > >>> @@ -35,13 +35,7 @@ > >>> #ifndef _DRM_H_ > >>> #define _DRM_H_ > >>> > >>> -#if defined(__KERNEL__) > >>> - > >>> -#include <linux/types.h> > >>> -#include <asm/ioctl.h> > >>> -typedef unsigned int drm_handle_t; > >>> - > >>> -#elif defined(__linux__) > >> > >> I think it is intentionally like that. Please see > >> https://patchwork.freedesktop.org/patch/78747/ > > > > Thank you for the link. > > > > Does anyone know if the reason for the change from 2016 ("make > > headers_install can't handle fancy conditions, ...") is still valid? I guess it is. If you can try ./scripts/unifdef as below[1], you might find out the thing. [1]https://elixir.bootlin.com/linux/v6.9/source/scripts/headers_install.sh#L41 > > > > Other headers use the same #if directive: > > > > fs/ext4/ext4.h:948:#if defined(__KERNEL__) || defined(__linux__) > > include/uapi/sound/asound.h:11:#if defined(__KERNEL__) || defined(__linux__) > > > > And there are many others using similar conditions: > > > > arch/arm/include/uapi/asm/swab.h:27:#if !defined(__KERNEL__) || __LINUX_ARM_ARCH__ < 6 > > arch/sparc/include/uapi/asm/signal.h:92:#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) > > arch/sparc/include/uapi/asm/termios.h:8:#if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS) > > include/uapi/linux/soundcard.h:1040:#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS) > > include/uapi/linux/stat.h:7:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) > > include/uapi/sound/asound.h:11:#if defined(__KERNEL__) || defined(__linux__) > > ... > > > > Thanks, > > Thorsten > > Re-sending this to linux-kernel@vger.kernel.org because the mailing list > somehow got lost in Luc's reply. Sorry about that. Regards, Luc
On 16. May 2024, at 03:24, Luc Ma <onion0709@gmail.com> wrote: > On Wed, 15 May 2024 at 17:31, Thorsten Blum <thorsten.blum@toblux.com> wrote: >> On 15. May 2024, at 11:22, Thorsten Blum <thorsten.blum@toblux.com> wrote: >>> On 15. May 2024, at 09:43, Luc Ma <onion0709@gmail.com> wrote: >>>> On Tue, 14 May 2024 at 19:37, Thorsten Blum <thorsten.blum@toblux.com> wrote: >>>>> >>>>> Merge the identical if/elif code blocks and remove the following two >>>>> warnings reported by make includecheck: >>>>> >>>>> asm/ioctl.h is included more than once >>>>> linux/types.h is included more than once >>>>> >>>>> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> >>>>> --- >>>>> include/uapi/drm/drm.h | 8 +------- >>>>> 1 file changed, 1 insertion(+), 7 deletions(-) >>>>> >>>>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h >>>>> index 16122819edfe..315af7b19c97 100644 >>>>> --- a/include/uapi/drm/drm.h >>>>> +++ b/include/uapi/drm/drm.h >>>>> @@ -35,13 +35,7 @@ >>>>> #ifndef _DRM_H_ >>>>> #define _DRM_H_ >>>>> >>>>> -#if defined(__KERNEL__) >>>>> - >>>>> -#include <linux/types.h> >>>>> -#include <asm/ioctl.h> >>>>> -typedef unsigned int drm_handle_t; >>>>> - >>>>> -#elif defined(__linux__) >>>> >>>> I think it is intentionally like that. Please see >>>> https://patchwork.freedesktop.org/patch/78747/ >>> >>> Thank you for the link. >>> >>> Does anyone know if the reason for the change from 2016 ("make >>> headers_install can't handle fancy conditions, ...") is still valid? > > I guess it is. If you can try ./scripts/unifdef as below[1], you might > find out the thing. > > [1]https://elixir.bootlin.com/linux/v6.9/source/scripts/headers_install.sh#L41 I just tested it with make headers_install and it worked fine. Thorsten
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 16122819edfe..315af7b19c97 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -35,13 +35,7 @@ #ifndef _DRM_H_ #define _DRM_H_ -#if defined(__KERNEL__) - -#include <linux/types.h> -#include <asm/ioctl.h> -typedef unsigned int drm_handle_t; - -#elif defined(__linux__) +#if defined(__KERNEL__) || defined(__linux__) #include <linux/types.h> #include <asm/ioctl.h>
Merge the identical if/elif code blocks and remove the following two warnings reported by make includecheck: asm/ioctl.h is included more than once linux/types.h is included more than once Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> --- include/uapi/drm/drm.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)