Re: [RFC PATCH 1/5] treewide: replace __inline__ by inline
From: Joe Perches
Date: Thu Aug 29 2019 - 12:29:42 EST
On Thu, 2019-08-29 at 10:32 +0200, Rasmus Villemoes wrote:
> Currently, compiler_types.h #defines __inline__ as inline. However,
> that defeats the purpose of gcc providing __inline__ as an alternate
> spelling of that keyword - namely, that it is always accessible under
> that name, even if one chooses to #define inline, which we also do in
> order to attach attribute(gnu_inline), and sometimes imply
> attribute(always_inline), etc.
>
> Note that it is quite possible that some header file defines a static
> inline function before the include chain has reached compiler_types.h,
> but in that case both the existing __inline__ as well as the new
> inline spelling refer to gcc's keyword, and the redefinitions in
> compiler_types.h have no effect anyway.
>
> For those static inline definitions that appear after compiler_types.h
> has been processed, this is obviously a no-op due to the #define
> __inline__ inline.
>
> We will need to be able to use the __inline__ keyword to make use of
> the "asm inline()" feature from gcc 9. This is preparation for
> removing the #define.
>
> Generated by
>
> git grep --files-with-matches -w __inline__ | \
> grep -vE '^(usr|Documentation|scripts)/' | \
> grep -v /uapi/ | \
> xargs sed -i -e 's/static *__inline__/static inline/'
bikeshed: Perhaps better to use
xargs sed -i -e 's/\b__inline__\b/inline/g'
As static and __inline__ do not have to be on the same line.
for instance: (and I didn't look thoroughly)
This misses one of the uses of __static__ in
drivers/scsi/qla2xx/qla_os.c
The patch has:
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
[]
> @@ -342,7 +342,7 @@ qla2x00_restart_timer(scsi_qla_host_t *vha, unsigned long interval)
> mod_timer(&vha->timer, jiffies + interval * HZ);
> }
>
> -static __inline__ void
> +static inline void
> qla2x00_stop_timer(scsi_qla_host_t *vha)
> {
> del_timer_sync(&vha->timer);
But the code is:
drivers/scsi/qla2xxx/qla_os.c-318-/* TODO Convert to inlines
drivers/scsi/qla2xxx/qla_os.c-319- *
drivers/scsi/qla2xxx/qla_os.c-320- * Timer routines
drivers/scsi/qla2xxx/qla_os.c-321- */
drivers/scsi/qla2xxx/qla_os.c-322-
drivers/scsi/qla2xxx/qla_os.c:323:__inline__ void
drivers/scsi/qla2xxx/qla_os.c-324-qla2x00_start_timer(scsi_qla_host_t *vha, unsigned long interval)
drivers/scsi/qla2xxx/qla_os.c-325-{
drivers/scsi/qla2xxx/qla_os.c-326- timer_setup(&vha->timer, qla2x00_timer, 0);
drivers/scsi/qla2xxx/qla_os.c-327- vha->timer.expires = jiffies + interval * HZ;
drivers/scsi/qla2xxx/qla_os.c-328- add_timer(&vha->timer);
--
drivers/scsi/qla2xxx/qla_os.c-340- }
drivers/scsi/qla2xxx/qla_os.c-341-
drivers/scsi/qla2xxx/qla_os.c-342- mod_timer(&vha->timer, jiffies + interval * HZ);
drivers/scsi/qla2xxx/qla_os.c-343-}
drivers/scsi/qla2xxx/qla_os.c-344-
drivers/scsi/qla2xxx/qla_os.c:345:static __inline__ void
drivers/scsi/qla2xxx/qla_os.c-346-qla2x00_stop_timer(scsi_qla_host_t *vha)
drivers/scsi/qla2xxx/qla_os.c-347-{
drivers/scsi/qla2xxx/qla_os.c-348- del_timer_sync(&vha->timer);
drivers/scsi/qla2xxx/qla_os.c-349- vha->timer_active = 0;
drivers/scsi/qla2xxx/qla_os.c-350-}
The possible impacted files using 's/\b__inline__\b/inline/'
$ git grep -w '__inline__' -- '*.[ch]' | grep -vP 'static\s+__inline__'
(only hand selected matches)
arch/alpha/include/asm/compiler.h:#undef __inline__
arch/alpha/include/asm/floppy.h:__inline__ void virtual_dma_init(void)
arch/ia64/hp/common/sba_iommu.c:#define SBA_INLINE __inline__
drivers/parisc/sba_iommu.c:#define SBA_INLINE __inline__
drivers/scsi/qla2xxx/qla_os.c:__inline__ void
drivers/video/fbdev/intelfb/intelfbdrv.c:__inline__ int intelfb_var_to_depth(const struct fb_var_screeninfo *var)