list: drop unneeded const to fix -Wcast-qual

Fixes:

  device.c: In function ‘device_info’:
  list.h:39:26: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
     39 |                 (type *)((char *)__mptr - offsetof(type, member)); \
        |                          ^
  list.h:85:9: note: in expansion of macro ‘container_of’
     85 |         container_of((list)->next, type, member)
        |         ^~~~~~~~~~~~
  list.h:91:21: note: in expansion of macro ‘list_entry_first’
     91 |         for (item = list_entry_first(list, typeof(*(item)), member); \
        |                     ^~~~~~~~~~~~~~~~
  device.c:303:9: note: in expansion of macro ‘list_for_each_entry’
    303 |         list_for_each_entry(device, &devices, node) {
        |         ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
Krzysztof Kozlowski
2023-05-07 11:44:45 +02:00
committed by Bjorn Andersson
parent 88c3196473
commit 2af3911be5

2
list.h
View File

@@ -35,7 +35,7 @@
#include <stddef.h>
#define container_of(ptr, type, member) ({ \
const typeof(((type *)0)->member)*__mptr = (ptr); \
typeof(((type *)0)->member)*__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); \
})