[Intel-gfx] [drm-tip:drm-tip 3/8] include/linux/container_of.h:19:54: error: invalid use of undefined type 'struct drm_buddy_block'

kernel test robot lkp at intel.com
Sat Jul 9 01:24:56 UTC 2022


tree:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
head:   36d2ac0e15af4dfb942279e8097ab831661859e6
commit: cf07f850c0483b3314eb69fd8c810e461cef4035 [3/8] Merge remote-tracking branch 'drm/drm-next' into drm-tip
config: microblaze-randconfig-r011-20220707 (https://download.01.org/0day-ci/archive/20220709/202207090946.Xujb0GPO-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add drm-tip git://anongit.freedesktop.org/drm/drm-tip
        git fetch --no-tags drm-tip drm-tip
        git checkout cf07f850c0483b3314eb69fd8c810e461cef4035
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/bits.h:22,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/ratelimit.h:5,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function 'amdgpu_vram_mgr_first_block':
>> include/linux/container_of.h:19:54: error: invalid use of undefined type 'struct drm_buddy_block'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                                                      ^~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:555:27: note: in expansion of macro 'list_entry'
     555 |         pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
         |                           ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:54:16: note: in expansion of macro 'list_first_entry_or_null'
      54 |         return list_first_entry_or_null(list, struct drm_buddy_block, link);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:293:27: error: expression in static assertion is not an integer
     293 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:555:27: note: in expansion of macro 'list_entry'
     555 |         pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
         |                           ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:54:16: note: in expansion of macro 'list_first_entry_or_null'
      54 |         return list_first_entry_or_null(list, struct drm_buddy_block, link);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from ./arch/microblaze/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:248,
                    from include/linux/string.h:5,
                    from include/linux/dma-mapping.h:6,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> include/linux/stddef.h:16:33: error: invalid use of undefined type 'struct drm_buddy_block'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:22:28: note: in expansion of macro 'offsetof'
      22 |         ((type *)(__mptr - offsetof(type, member))); })
         |                            ^~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:555:27: note: in expansion of macro 'list_entry'
     555 |         pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
         |                           ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:54:16: note: in expansion of macro 'list_first_entry_or_null'
      54 |         return list_first_entry_or_null(list, struct drm_buddy_block, link);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function 'amdgpu_is_vram_mgr_blocks_contiguous':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:66:29: error: invalid use of undefined type 'struct drm_buddy_block'
      66 |         while (head != block->link.next) {
         |                             ^~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:67:25: error: implicit declaration of function 'amdgpu_vram_mgr_block_start'; did you mean 'amdgpu_vram_mgr_alloc_sgt'? [-Werror=implicit-function-declaration]
      67 |                 start = amdgpu_vram_mgr_block_start(block);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         amdgpu_vram_mgr_alloc_sgt
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:68:24: error: implicit declaration of function 'amdgpu_vram_mgr_block_size'; did you mean 'amdgpu_vram_mgr_alloc_sgt'? [-Werror=implicit-function-declaration]
      68 |                 size = amdgpu_vram_mgr_block_size(block);
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |                        amdgpu_vram_mgr_alloc_sgt
   In file included from include/linux/list.h:5,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:41: error: invalid use of undefined type 'struct drm_buddy_block'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                                         ^~
   include/linux/container_of.h:18:33: note: in definition of macro 'container_of'
      18 |         void *__mptr = (void *)(ptr);                                   \
         |                                 ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:25: note: in expansion of macro 'list_entry'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                         ^~~~~~~~~~
   In file included from include/linux/bits.h:22,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/ratelimit.h:5,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:41: error: invalid use of undefined type 'struct drm_buddy_block'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                                         ^~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:25: note: in expansion of macro 'list_entry'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                         ^~~~~~~~~~
>> include/linux/container_of.h:19:54: error: invalid use of undefined type 'struct drm_buddy_block'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                                                      ^~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:25: note: in expansion of macro 'list_entry'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                         ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:41: error: invalid use of undefined type 'struct drm_buddy_block'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                                         ^~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:20:23: note: in expansion of macro '__same_type'
      20 |                       __same_type(*(ptr), void),                        \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:25: note: in expansion of macro 'list_entry'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                         ^~~~~~~~~~
   include/linux/compiler_types.h:293:27: error: expression in static assertion is not an integer
     293 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:25: note: in expansion of macro 'list_entry'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                         ^~~~~~~~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from ./arch/microblaze/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:248,
                    from include/linux/string.h:5,
                    from include/linux/dma-mapping.h:6,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> include/linux/stddef.h:16:33: error: invalid use of undefined type 'struct drm_buddy_block'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:22:28: note: in expansion of macro 'offsetof'
      22 |         ((type *)(__mptr - offsetof(type, member))); })
         |                            ^~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:70:25: note: in expansion of macro 'list_entry'
      70 |                 block = list_entry(block->link.next, struct drm_buddy_block, link);
         |                         ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function 'amdgpu_vram_mgr_new':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:488:13: error: 'cur_size' undeclared (first use in this function)
     488 |         if (cur_size != size) {
         |             ^~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:488:13: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:488:25: error: 'size' undeclared (first use in this function); did you mean 'ksize'?
     488 |         if (cur_size != size) {
         |                         ^~~~
         |                         ksize
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:30: error: 'vres' undeclared (first use in this function); did you mean 'res'?
     494 |                 trim_list = &vres->blocks;
         |                              ^~~~
         |                              res
   In file included from include/linux/bits.h:22,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/ratelimit.h:5,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> include/linux/container_of.h:19:54: error: invalid use of undefined type 'struct drm_buddy_block'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                                                      ^~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:542:9: note: in expansion of macro 'list_entry'
     542 |         list_entry((ptr)->prev, type, member)
         |         ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:33: note: in expansion of macro 'list_last_entry'
     502 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
         |                                 ^~~~~~~~~~~~~~~
   include/linux/compiler_types.h:293:27: error: expression in static assertion is not an integer
     293 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:542:9: note: in expansion of macro 'list_entry'
     542 |         list_entry((ptr)->prev, type, member)
         |         ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:33: note: in expansion of macro 'list_last_entry'
     502 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
         |                                 ^~~~~~~~~~~~~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from ./arch/microblaze/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:248,
                    from include/linux/string.h:5,
                    from include/linux/dma-mapping.h:6,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> include/linux/stddef.h:16:33: error: invalid use of undefined type 'struct drm_buddy_block'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:22:28: note: in expansion of macro 'offsetof'
      22 |         ((type *)(__mptr - offsetof(type, member))); })
         |                            ^~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:542:9: note: in expansion of macro 'list_entry'
     542 |         list_entry((ptr)->prev, type, member)
         |         ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:33: note: in expansion of macro 'list_last_entry'
     502 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
         |                                 ^~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:503:46: error: invalid use of undefined type 'struct drm_buddy_block'
     503 |                         list_move_tail(&block->link, &temp);
         |                                              ^~
   In file included from include/linux/rhashtable-types.h:14,
                    from include/linux/ipc.h:7,
                    from include/uapi/linux/sem.h:5,
                    from include/linux/sem.h:5,
                    from include/linux/sched.h:15,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:512:28: error: passing argument 1 of 'mutex_lock_nested' from incompatible pointer type [-Werror=incompatible-pointer-types]
     512 |                 mutex_lock(&mgr->lock);
         |                            ^~~~~~~~~~
         |                            |
         |                            spinlock_t * {aka struct spinlock *}
   include/linux/mutex.h:187:44: note: in definition of macro 'mutex_lock'
     187 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
         |                                            ^~~~
   include/linux/mutex.h:178:45: note: expected 'struct mutex *' but argument is of type 'spinlock_t *' {aka 'struct spinlock *'}
     178 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
         |                               ~~~~~~~~~~~~~~^~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:513:17: error: implicit declaration of function 'drm_buddy_block_trim' [-Werror=implicit-function-declaration]
     513 |                 drm_buddy_block_trim(mm,
         |                 ^~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:516:30: error: passing argument 1 of 'mutex_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
     516 |                 mutex_unlock(&mgr->lock);
         |                              ^~~~~~~~~~
         |                              |
         |                              spinlock_t * {aka struct spinlock *}
   In file included from include/linux/rhashtable-types.h:14,
                    from include/linux/ipc.h:7,
                    from include/uapi/linux/sem.h:5,
                    from include/linux/sem.h:5,
                    from include/linux/sched.h:15,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
   include/linux/mutex.h:218:40: note: expected 'struct mutex *' but argument is of type 'spinlock_t *' {aka 'struct spinlock *'}
     218 | extern void mutex_unlock(struct mutex *lock);
         |                          ~~~~~~~~~~~~~~^~~~
   In file included from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:523:29: error: 'block' undeclared (first use in this function); did you mean 'flock'?
     523 |         list_for_each_entry(block, &vres->blocks, link) {
         |                             ^~~~~
   include/linux/list.h:674:14: note: in definition of macro 'list_for_each_entry'
     674 |         for (pos = list_first_entry(head, typeof(*pos), member);        \
         |              ^~~
   In file included from include/linux/bits.h:22,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/ratelimit.h:5,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
   include/linux/compiler_types.h:293:27: error: expression in static assertion is not an integer
     293 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:531:9: note: in expansion of macro 'list_entry'
     531 |         list_entry((ptr)->next, type, member)
         |         ^~~~~~~~~~
   include/linux/list.h:674:20: note: in expansion of macro 'list_first_entry'
     674 |         for (pos = list_first_entry(head, typeof(*pos), member);        \
         |                    ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:523:9: note: in expansion of macro 'list_for_each_entry'
     523 |         list_for_each_entry(block, &vres->blocks, link) {
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:293:27: error: expression in static assertion is not an integer
     293 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   include/linux/container_of.h:19:9: note: in expansion of macro 'static_assert'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |         ^~~~~~~~~~~~~
   include/linux/container_of.h:19:23: note: in expansion of macro '__same_type'
      19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
         |                       ^~~~~~~~~~~
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
     520 |         container_of(ptr, type, member)
         |         ^~~~~~~~~~~~
   include/linux/list.h:564:9: note: in expansion of macro 'list_entry'
     564 |         list_entry((pos)->member.next, typeof(*(pos)), member)
         |         ^~~~~~~~~~
   include/linux/list.h:676:20: note: in expansion of macro 'list_next_entry'
     676 |              pos = list_next_entry(pos, member))
         |                    ^~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:523:9: note: in expansion of macro 'list_for_each_entry'
     523 |         list_for_each_entry(block, &vres->blocks, link) {
         |         ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kernel.h:26,
                    from include/linux/cpumask.h:10,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/rcupdate.h:29,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
>> include/linux/minmax.h:36:9: error: first argument to '__builtin_choose_expr' not a constant
      36 |         __builtin_choose_expr(__safe_cmp(x, y), \
         |         ^~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:52:25: note: in expansion of macro '__careful_cmp'
      52 | #define max(x, y)       __careful_cmp(x, y, >)
         |                         ^~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:534:36: note: in expansion of macro 'max'
     534 |                 vres->base.start = max(vres->base.start, start);
         |                                    ^~~
   cc1: some warnings being treated as errors


vim +19 include/linux/container_of.h

d2a8ebbf8192b84 Andy Shevchenko  2021-11-08   9  
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  10  /**
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  11   * container_of - cast a member of a structure out to the containing structure
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  12   * @ptr:	the pointer to the member.
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  13   * @type:	the type of the container struct this is embedded in.
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  14   * @member:	the name of the member within the struct.
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  15   *
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  16   */
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  17  #define container_of(ptr, type, member) ({				\
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  18  	void *__mptr = (void *)(ptr);					\
e1edc277e6f6dfb Rasmus Villemoes 2021-11-08 @19  	static_assert(__same_type(*(ptr), ((type *)0)->member) ||	\
e1edc277e6f6dfb Rasmus Villemoes 2021-11-08  20  		      __same_type(*(ptr), void),			\
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  21  		      "pointer type mismatch in container_of()");	\
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  22  	((type *)(__mptr - offsetof(type, member))); })
d2a8ebbf8192b84 Andy Shevchenko  2021-11-08  23  

:::::: The code at line 19 was first introduced by commit
:::::: e1edc277e6f6dfb372216522dfc57f9381c39e35 linux/container_of.h: switch to static_assert

:::::: TO: Rasmus Villemoes <linux at rasmusvillemoes.dk>
:::::: CC: Linus Torvalds <torvalds at linux-foundation.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


More information about the Intel-gfx mailing list