@@ -459,7 +459,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
-Werror=implicit-function-declaration -Werror=implicit-int \
-Wno-format-security \
- -std=gnu89
+ -std=gnu99
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
@@ -79,9 +79,9 @@ __efi_get_rsdp_addr(unsigned long config_tables, unsigned int nr_tables,
table = tbl->table;
}
- if (!(efi_guidcmp(guid, ACPI_TABLE_GUID)))
+ if (!(efi_guidcmp(guid, (guid_t)ACPI_TABLE_GUID)))
rsdp_addr = table;
- else if (!(efi_guidcmp(guid, ACPI_20_TABLE_GUID)))
+ else if (!(efi_guidcmp(guid, (guid_t)ACPI_20_TABLE_GUID)))
return table;
}
#endif
@@ -308,7 +308,7 @@ static const struct vm_operations_struct gate_vma_ops = {
static struct vm_area_struct gate_vma __ro_after_init = {
.vm_start = VSYSCALL_ADDR,
.vm_end = VSYSCALL_ADDR + PAGE_SIZE,
- .vm_page_prot = PAGE_READONLY_EXEC,
+ .vm_page_prot = { __PAGE_READONLY_EXEC },
.vm_flags = VM_READ | VM_EXEC,
.vm_ops = &gate_vma_ops,
};
@@ -150,21 +150,28 @@ enum page_cache_mode {
#define _PAGE_NOCACHE (cachemode2protval(_PAGE_CACHE_MODE_UC))
#define _PAGE_CACHE_WP (cachemode2protval(_PAGE_CACHE_MODE_WP))
-#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
-#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
+#define __PAGE_NONE (_PAGE_PROTNONE | _PAGE_ACCESSED)
+#define PAGE_NONE __pgprot(__PAGE_NONE)
+#define __PAGE_SHARED (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_NX)
+#define PAGE_SHARED __pgprot(__PAGE_SHARED)
-#define PAGE_SHARED_EXEC __pgprot(_PAGE_PRESENT | _PAGE_RW | \
+#define __PAGE_SHARED_EXEC (_PAGE_PRESENT | _PAGE_RW | \
_PAGE_USER | _PAGE_ACCESSED)
-#define PAGE_COPY_NOEXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
+#define PAGE_SHARED_EXEC __pgprot(__PAGE_SHARED_EXEC)
+#define __PAGE_COPY_NOEXEC (_PAGE_PRESENT | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_NX)
-#define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
+#define __PAGE_COPY_EXEC (_PAGE_PRESENT | _PAGE_USER | \
_PAGE_ACCESSED)
-#define PAGE_COPY PAGE_COPY_NOEXEC
-#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | \
+#define PAGE_COPY_EXEC __pgprot(__PAGE_COPY_EXEC)
+
+#define __PAGE_COPY __PAGE_COPY_NOEXEC
+#define PAGE_COPY __pgprot(__PAGE_COPY)
+#define __PAGE_READONLY (_PAGE_PRESENT | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_NX)
-#define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
- _PAGE_ACCESSED)
+#define PAGE_READONLY __pgprot(__PAGE_READONLY)
+#define __PAGE_READONLY_EXEC (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
+#define PAGE_READONLY_EXEC __pgprot(__PAGE_READONLY_EXEC)
#define __PAGE_KERNEL_EXEC \
(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
@@ -214,23 +221,23 @@ enum page_cache_mode {
#endif /* __ASSEMBLY__ */
/* xwr */
-#define __P000 PAGE_NONE
-#define __P001 PAGE_READONLY
-#define __P010 PAGE_COPY
-#define __P011 PAGE_COPY
-#define __P100 PAGE_READONLY_EXEC
-#define __P101 PAGE_READONLY_EXEC
-#define __P110 PAGE_COPY_EXEC
-#define __P111 PAGE_COPY_EXEC
-
-#define __S000 PAGE_NONE
-#define __S001 PAGE_READONLY
-#define __S010 PAGE_SHARED
-#define __S011 PAGE_SHARED
-#define __S100 PAGE_READONLY_EXEC
-#define __S101 PAGE_READONLY_EXEC
-#define __S110 PAGE_SHARED_EXEC
-#define __S111 PAGE_SHARED_EXEC
+#define __P000 {__PAGE_NONE}
+#define __P001 {__PAGE_READONLY}
+#define __P010 {__PAGE_COPY}
+#define __P011 {__PAGE_COPY}
+#define __P100 {__PAGE_READONLY_EXEC}
+#define __P101 {__PAGE_READONLY_EXEC}
+#define __P110 {__PAGE_COPY_EXEC}
+#define __P111 {__PAGE_COPY_EXEC}
+
+#define __S000 {__PAGE_NONE}
+#define __S001 {__PAGE_READONLY}
+#define __S010 {__PAGE_SHARED}
+#define __S011 {__PAGE_SHARED}
+#define __S100 {__PAGE_READONLY_EXEC}
+#define __S101 {__PAGE_READONLY_EXEC}
+#define __S110 {__PAGE_SHARED_EXEC}
+#define __S111 {__PAGE_SHARED_EXEC}
/*
* early identity mapping pte attrib macros.
@@ -842,7 +842,7 @@ static inline void spin_lock_prefetch(const void *x)
.sp0 = TOP_OF_INIT_STACK, \
.sysenter_cs = __KERNEL_CS, \
.io_bitmap_ptr = NULL, \
- .addr_limit = KERNEL_DS, \
+ .addr_limit = {__KERNEL_ADDR_LIMIT}, \
}
#define KSTK_ESP(task) (task_pt_regs(task)->sp)
@@ -887,7 +887,7 @@ static inline void spin_lock_prefetch(const void *x)
#define STACK_TOP_MAX TASK_SIZE_MAX
#define INIT_THREAD { \
- .addr_limit = KERNEL_DS, \
+ .addr_limit = {__KERNEL_ADDR_LIMIT}, \
}
extern unsigned long KSTK_ESP(struct task_struct *task);
@@ -22,7 +22,8 @@
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
-#define KERNEL_DS MAKE_MM_SEG(-1UL)
+#define __KERNEL_ADDR_LIMIT (-1UL)
+#define KERNEL_DS MAKE_MM_SEG(__KERNEL_ADDR_LIMIT)
#define USER_DS MAKE_MM_SEG(TASK_SIZE_MAX)
#define get_fs() (current->thread.addr_limit)
@@ -34,7 +34,7 @@
* memtype_lock protects the rbtree.
*/
-static struct rb_root memtype_rbroot = RB_ROOT;
+static struct rb_root memtype_rbroot = __RB_ROOT;
static int is_node_overlap(struct memtype *node, u64 start, u64 end)
{
@@ -20,8 +20,7 @@
#define EFI_MIN_RESERVE 5120
-#define EFI_DUMMY_GUID \
- EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9)
+static guid_t efi_dummy_guid = EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9);
#define QUARK_CSH_SIGNATURE 0x5f435348 /* _CSH */
#define QUARK_SECURITY_HEADER_SIZE 0x400
@@ -107,7 +106,7 @@ early_param("efi_no_storage_paranoia", setup_storage_paranoia);
void efi_delete_dummy_variable(void)
{
efi.set_variable_nonblocking((efi_char16_t *)efi_dummy_name,
- &EFI_DUMMY_GUID,
+ &efi_dummy_guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL);
@@ -184,7 +183,7 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size,
return EFI_OUT_OF_RESOURCES;
status = efi.set_variable((efi_char16_t *)efi_dummy_name,
- &EFI_DUMMY_GUID,
+ &efi_dummy_guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
@@ -545,7 +544,7 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
guid = ((efi_config_table_64_t *)p)->guid;
- if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID))
+ if (!efi_guidcmp(guid, (guid_t)SMBIOS_TABLE_GUID))
((efi_config_table_64_t *)p)->table = data->smbios;
p += sz;
}
@@ -462,7 +462,7 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
static inline int
is_pte_valid(const gpt_entry *pte, const u64 lastlba)
{
- if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) ||
+ if ((!efi_guidcmp(pte->partition_type_guid, (guid_t)NULL_GUID)) ||
le64_to_cpu(pte->starting_lba) > lastlba ||
le64_to_cpu(pte->ending_lba) > lastlba)
return 0;
@@ -704,7 +704,7 @@ int efi_partition(struct parsed_partitions *state)
put_partition(state, i+1, start * ssz, size * ssz);
/* If this is a RAID volume, tell md */
- if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_RAID_GUID))
+ if (!efi_guidcmp(ptes[i].partition_type_guid, (guid_t)PARTITION_LINUX_RAID_GUID))
state->parts[i + 1].flags = ADDPART_FLAG_RAID;
info = &state->parts[i + 1].info;
@@ -18,7 +18,7 @@
#include <linux/nodemask.h>
#include <linux/topology.h>
-static nodemask_t nodes_found_map = NODE_MASK_NONE;
+static nodemask_t nodes_found_map = __NODE_MASK_NONE;
/* maps to convert between proximity domain and logical node ID */
static int pxm_to_node_map[MAX_PXM_DOMAINS]
@@ -57,7 +57,7 @@ struct efi __read_mostly efi = {
EXPORT_SYMBOL(efi);
struct mm_struct efi_mm = {
- .mm_rb = RB_ROOT,
+ .mm_rb = __RB_ROOT,
.mm_users = ATOMIC_INIT(2),
.mm_count = ATOMIC_INIT(1),
.mmap_sem = __RWSEM_INITIALIZER(efi_mm.mmap_sem),
@@ -484,7 +484,7 @@ static __init int match_config_table(efi_guid_t *guid,
int i;
if (table_types) {
- for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) {
+ for (i = 0; efi_guidcmp(table_types[i].guid, (guid_t)NULL_GUID); i++) {
if (!efi_guidcmp(*guid, table_types[i].guid)) {
*(table_types[i].ptr) = table;
if (table_types[i].name)
@@ -365,7 +365,7 @@ void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size)
{
void *fdt;
- fdt = get_efi_config_table(sys_table, DEVICE_TREE_GUID);
+ fdt = get_efi_config_table(sys_table, (guid_t)DEVICE_TREE_GUID);
if (!fdt)
return NULL;
@@ -141,7 +141,7 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
* final events structure, and if so how much space they take up
*/
final_events_table = get_efi_config_table(sys_table_arg,
- LINUX_EFI_TPM_FINAL_LOG_GUID);
+ (guid_t)LINUX_EFI_TPM_FINAL_LOG_GUID);
if (final_events_table && final_events_table->nr_events) {
struct tcg_pcr_event2_head *header;
int offset;
@@ -61,7 +61,7 @@ struct adreno_rev {
};
#define ADRENO_REV(core, major, minor, patchid) \
- ((struct adreno_rev){ core, major, minor, patchid })
+ { core, major, minor, patchid }
struct adreno_gpu_funcs {
struct msm_gpu_funcs base;
@@ -1792,36 +1792,36 @@ static int elantech_create_smbus(struct psmouse *psmouse,
smbus_board.properties = i2c_props;
- i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-x",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("touchscreen-size-x",
info->x_max + 1);
- i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-y",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("touchscreen-size-y",
info->y_max + 1);
- i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-x",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("touchscreen-min-x",
info->x_min);
- i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("touchscreen-min-y",
info->y_min);
if (info->x_res)
- i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("touchscreen-x-mm",
(info->x_max + 1) / info->x_res);
if (info->y_res)
- i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-y-mm",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("touchscreen-y-mm",
(info->y_max + 1) / info->y_res);
if (info->has_trackpoint)
- i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,trackpoint");
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_BOOL("elan,trackpoint");
if (info->has_middle_button)
- i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,middle-button");
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_BOOL("elan,middle-button");
if (info->x_traces)
- i2c_props[idx++] = PROPERTY_ENTRY_U32("elan,x_traces",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("elan,x_traces",
info->x_traces);
if (info->y_traces)
- i2c_props[idx++] = PROPERTY_ENTRY_U32("elan,y_traces",
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_U32("elan,y_traces",
info->y_traces);
if (elantech_is_buttonpad(info))
- i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,clickpad");
+ i2c_props[idx++] = (struct property_entry)PROPERTY_ENTRY_BOOL("elan,clickpad");
return psmouse_smbus_init(psmouse, &smbus_board, NULL, 0, false,
leave_breadcrumbs);
@@ -472,7 +472,7 @@ static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
return NULL;
memcpy(&nvram_efivar->var.VariableName, name, sizeof(name));
- nvram_efivar->var.VendorGuid = EFI_GUID(0x74b00bd9, 0x805a, 0x4d61,
+ nvram_efivar->var.VendorGuid = (guid_t)EFI_GUID(0x74b00bd9, 0x805a, 0x4d61,
0xb5, 0x1f, 0x43, 0x26,
0x81, 0x23, 0xd1, 0x13);
@@ -2378,18 +2378,18 @@ static const u8 tegra124_cpu_powergates[] = {
};
#define TEGRA_IO_PAD(_id, _dpd, _voltage, _name) \
- ((struct tegra_io_pad_soc) { \
+ { \
.id = (_id), \
.dpd = (_dpd), \
.voltage = (_voltage), \
.name = (_name), \
- })
+ }
#define TEGRA_IO_PIN_DESC(_id, _dpd, _voltage, _name) \
- ((struct pinctrl_pin_desc) { \
+ { \
.number = (_id), \
.name = (_name) \
- })
+ }
#define TEGRA124_IO_PAD_TABLE(_pad) \
/* .id .dpd .voltage .name */ \
@@ -294,7 +294,7 @@ struct proc_dir_entry proc_root = {
.proc_iops = &proc_root_inode_operations,
.proc_fops = &proc_root_operations,
.parent = &proc_root,
- .subdir = RB_ROOT,
+ .subdir = __RB_ROOT,
.name = "/proc",
};
@@ -82,14 +82,19 @@ extern const kernel_cap_t __cap_init_eff_set;
#define CAP_LAST_U32 ((_KERNEL_CAPABILITY_U32S) - 1)
#define CAP_LAST_U32_VALID_MASK (CAP_TO_MASK(CAP_LAST_CAP + 1) -1)
-# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})
-# define CAP_FULL_SET ((kernel_cap_t){{ ~0, CAP_LAST_U32_VALID_MASK }})
-# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
+# define __CAP_EMPTY_SET {{ 0, 0 }}
+# define __CAP_FULL_SET {{ ~0, CAP_LAST_U32_VALID_MASK }}
+# define __CAP_FS_SET {{ CAP_FS_MASK_B0 \
| CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \
- CAP_FS_MASK_B1 } })
-# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
+ CAP_FS_MASK_B1 } }
+# define __CAP_NFSD_SET {{ CAP_FS_MASK_B0 \
| CAP_TO_MASK(CAP_SYS_RESOURCE), \
- CAP_FS_MASK_B1 } })
+ CAP_FS_MASK_B1 } }
+
+# define CAP_EMPTY_SET ((kernel_cap_t)__CAP_EMPTY_SET)
+# define CAP_FULL_SET ((kernel_cap_t)__CAP_FULL_SET)
+# define CAP_FS_SET ((kernel_cap_t)__CAP_FS_SET)
+# define CAP_NFSD_SET ((kernel_cap_t)__CAP_NFSD_SET)
#endif /* _KERNEL_CAPABILITY_U32S != 2 */
@@ -919,24 +919,24 @@ cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
#if NR_CPUS <= BITS_PER_LONG
#define CPU_MASK_ALL \
-(cpumask_t) { { \
+{ { \
[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS) \
} }
#else
#define CPU_MASK_ALL \
-(cpumask_t) { { \
+{ { \
[0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS) \
} }
#endif /* NR_CPUS > BITS_PER_LONG */
#define CPU_MASK_NONE \
-(cpumask_t) { { \
+{ { \
[0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
} }
#define CPU_MASK_CPU0 \
-(cpumask_t) { { \
+{ { \
[0] = 1UL \
} }
@@ -64,7 +64,7 @@ typedef void *efi_handle_t;
typedef guid_t efi_guid_t __aligned(__alignof__(u32));
#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
- GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
+ __GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
/*
* Generic EFI table header
@@ -45,7 +45,7 @@ union futex_key {
} both;
};
-#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
+#define FUTEX_KEY_INIT { .both = { .ptr = NULL } }
#ifdef CONFIG_FUTEX
extern void exit_robust_list(struct task_struct *curr);
@@ -351,8 +351,8 @@ struct static_key_false {
struct static_key key;
};
-#define STATIC_KEY_TRUE_INIT (struct static_key_true) { .key = STATIC_KEY_INIT_TRUE, }
-#define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
+#define STATIC_KEY_TRUE_INIT { .key = STATIC_KEY_INIT_TRUE, }
+#define STATIC_KEY_FALSE_INIT { .key = STATIC_KEY_INIT_FALSE, }
#define DEFINE_STATIC_KEY_TRUE(name) \
struct static_key_true name = STATIC_KEY_TRUE_INIT
@@ -306,25 +306,27 @@ static inline int __first_unset_node(const nodemask_t *maskp)
#if MAX_NUMNODES <= BITS_PER_LONG
-#define NODE_MASK_ALL \
-((nodemask_t) { { \
+#define __NODE_MASK_ALL \
+{ { \
[BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD \
-} })
+} }
#else
-#define NODE_MASK_ALL \
-((nodemask_t) { { \
+#define __NODE_MASK_ALL \
+{ { \
[0 ... BITS_TO_LONGS(MAX_NUMNODES)-2] = ~0UL, \
[BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD \
-} })
+} }
#endif
+#define NODE_MASK_ALL (((nodemask_t)__MODE_MASK_ALL)
-#define NODE_MASK_NONE \
-((nodemask_t) { { \
+#define __NODE_MASK_NONE \
+{ { \
[0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] = 0UL \
-} })
+} }
+#define NODE_MASK_NONE ((nodemask_t)__NODE_MASK_NONE)
#define nodes_addr(src) ((src).bits)
@@ -258,7 +258,7 @@ struct property_entry {
*/
#define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _Type_, _val_) \
-(struct property_entry) { \
+{ \
.name = _name_, \
.length = ARRAY_SIZE(_val_) * sizeof(_type_), \
.is_array = true, \
@@ -276,7 +276,7 @@ struct property_entry {
PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, U64, _val_)
#define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_) \
-(struct property_entry) { \
+{ \
.name = _name_, \
.length = ARRAY_SIZE(_val_) * sizeof(const char *), \
.is_array = true, \
@@ -285,7 +285,7 @@ struct property_entry {
}
#define PROPERTY_ENTRY_INTEGER(_name_, _type_, _Type_, _val_) \
-(struct property_entry) { \
+{ \
.name = _name_, \
.length = sizeof(_type_), \
.type = DEV_PROP_##_Type_, \
@@ -302,7 +302,7 @@ struct property_entry {
PROPERTY_ENTRY_INTEGER(_name_, u64, U64, _val_)
#define PROPERTY_ENTRY_STRING(_name_, _val_) \
-(struct property_entry) { \
+{ \
.name = _name_, \
.length = sizeof(const char *), \
.type = DEV_PROP_STRING, \
@@ -310,7 +310,7 @@ struct property_entry {
}
#define PROPERTY_ENTRY_BOOL(_name_) \
-(struct property_entry) { \
+{ \
.name = _name_, \
}
@@ -34,7 +34,9 @@ struct rb_root {
#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
-#define RB_ROOT (struct rb_root) { NULL, }
+#define __RB_ROOT { NULL, }
+#define RB_ROOT (struct rb_root) __RB_ROOT
+#define DEFINE_RB_ROOT(name) struct rb_root name = __RB_ROOT
#define rb_entry(ptr, type, member) container_of(ptr, type, member)
#define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL)
@@ -127,7 +129,8 @@ struct rb_root_cached {
struct rb_node *rb_leftmost;
};
-#define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
+#define __RB_ROOT_CACHED { {NULL, }, NULL }
+#define RB_ROOT_CACHED (struct rb_root_cached)__RB_ROOT_CACHED
/* Same as rb_first(), but O(1) */
#define rb_first_cached(root) (root)->rb_leftmost
@@ -25,7 +25,7 @@ do { \
} while (0)
#else
# define rwlock_init(lock) \
- do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0)
+ do { *(lock) = (rwlock_t)__RW_LOCK_UNLOCKED(lock); } while (0)
#endif
#ifdef CONFIG_DEBUG_SPINLOCK
@@ -29,14 +29,14 @@ typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
#define __RW_LOCK_UNLOCKED(lockname) \
- (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \
+ { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \
.magic = RWLOCK_MAGIC, \
.owner = SPINLOCK_OWNER_INIT, \
.owner_cpu = -1, \
RW_DEP_MAP_INIT(lockname) }
#else
#define __RW_LOCK_UNLOCKED(lockname) \
- (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \
+ { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \
RW_DEP_MAP_INIT(lockname) }
#endif
@@ -49,7 +49,7 @@ struct task_cputime_atomic {
};
#define INIT_CPUTIME_ATOMIC \
- (struct task_cputime_atomic) { \
+ { \
.utime = ATOMIC64_INIT(0), \
.stime = ATOMIC64_INIT(0), \
.sum_exec_runtime = ATOMIC64_INIT(0), \
@@ -103,7 +103,7 @@ do { \
#else
# define raw_spin_lock_init(lock) \
- do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0)
+ do { *(lock) = (raw_spinlock_t) __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0)
#endif
#define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock)
@@ -54,7 +54,7 @@ typedef struct raw_spinlock {
SPIN_DEP_MAP_INIT(lockname) }
#define __RAW_SPIN_LOCK_UNLOCKED(lockname) \
- (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)
+ __RAW_SPIN_LOCK_INITIALIZER(lockname)
#define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x)
@@ -76,7 +76,7 @@ typedef struct spinlock {
{ { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } }
#define __SPIN_LOCK_UNLOCKED(lockname) \
- (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
+ __SPIN_LOCK_INITIALIZER(lockname)
#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
@@ -27,8 +27,11 @@ typedef struct {
gid_t val;
} kgid_t;
-#define KUIDT_INIT(value) (kuid_t){ value }
-#define KGIDT_INIT(value) (kgid_t){ value }
+#define __KUIDT_INIT(value) { value }
+#define __KGIDT_INIT(value) { value }
+
+#define KUIDT_INIT(value) (kuid_t)__KUIDT_INIT(value)
+#define KGIDT_INIT(value) (kgid_t)__KGIDT_INIT(value)
#ifdef CONFIG_MULTIUSER
static inline uid_t __kuid_val(kuid_t uid)
@@ -52,6 +55,12 @@ static inline gid_t __kgid_val(kgid_t gid)
}
#endif
+#define __GLOBAL_ROOT_UID __KUIDT_INIT(0)
+#define __GLOBAL_ROOT_GID __KGIDT_INIT(0)
+
+#define __INVALID_UID __KUIDT_INIT(-1)
+#define __INVALID_GID __KGIDT_INIT(-1)
+
#define GLOBAL_ROOT_UID KUIDT_INIT(0)
#define GLOBAL_ROOT_GID KGIDT_INIT(0)
@@ -24,12 +24,14 @@ typedef struct {
__u8 b[16];
} guid_t;
-#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-((guid_t) \
+#define __GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
(b) & 0xff, ((b) >> 8) & 0xff, \
(c) & 0xff, ((c) >> 8) & 0xff, \
- (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
+
+#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+ __GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
/* backwards compatibility, don't use in new code */
typedef guid_t uuid_le;
@@ -122,7 +122,7 @@ struct task_struct init_task
.thread_group = LIST_HEAD_INIT(init_task.thread_group),
.thread_node = LIST_HEAD_INIT(init_signals.thread_head),
#ifdef CONFIG_AUDIT
- .loginuid = INVALID_UID,
+ .loginuid = __INVALID_UID,
.sessionid = AUDIT_SID_UNSET,
#endif
#ifdef CONFIG_PERF_EVENTS
@@ -144,7 +144,7 @@ struct task_struct init_task
.mems_allowed_seq = SEQCNT_ZERO(init_task.mems_allowed_seq),
#endif
#ifdef CONFIG_RT_MUTEXES
- .pi_waiters = RB_ROOT_CACHED,
+ .pi_waiters = __RB_ROOT_CACHED,
.pi_top_task = NULL,
#endif
INIT_PREV_CPUTIME(init_task)
@@ -122,7 +122,7 @@ static u32 audit_backlog_limit = 64;
static u32 audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
/* The identity of the user shutting down the audit system. */
-kuid_t audit_sig_uid = INVALID_UID;
+kuid_t audit_sig_uid = __INVALID_UID;
pid_t audit_sig_pid = -1;
u32 audit_sig_sid = 0;
@@ -24,7 +24,7 @@
* Leveraged for setting/resetting capabilities
*/
-const kernel_cap_t __cap_empty_set = CAP_EMPTY_SET;
+const kernel_cap_t __cap_empty_set = __CAP_EMPTY_SET;
EXPORT_SYMBOL(__cap_empty_set);
int file_caps_enabled = 1;
@@ -44,19 +44,19 @@ struct cred init_cred = {
.subscribers = ATOMIC_INIT(2),
.magic = CRED_MAGIC,
#endif
- .uid = GLOBAL_ROOT_UID,
- .gid = GLOBAL_ROOT_GID,
- .suid = GLOBAL_ROOT_UID,
- .sgid = GLOBAL_ROOT_GID,
- .euid = GLOBAL_ROOT_UID,
- .egid = GLOBAL_ROOT_GID,
- .fsuid = GLOBAL_ROOT_UID,
- .fsgid = GLOBAL_ROOT_GID,
+ .uid = __GLOBAL_ROOT_UID,
+ .gid = __GLOBAL_ROOT_GID,
+ .suid = __GLOBAL_ROOT_UID,
+ .sgid = __GLOBAL_ROOT_GID,
+ .euid = __GLOBAL_ROOT_UID,
+ .egid = __GLOBAL_ROOT_GID,
+ .fsuid = __GLOBAL_ROOT_UID,
+ .fsgid = __GLOBAL_ROOT_GID,
.securebits = SECUREBITS_DEFAULT,
- .cap_inheritable = CAP_EMPTY_SET,
- .cap_permitted = CAP_FULL_SET,
- .cap_effective = CAP_FULL_SET,
- .cap_bset = CAP_FULL_SET,
+ .cap_inheritable = __CAP_EMPTY_SET,
+ .cap_permitted = __CAP_FULL_SET,
+ .cap_effective = __CAP_FULL_SET,
+ .cap_bset = __CAP_FULL_SET,
.user = INIT_USER,
.user_ns = &init_user_ns,
.group_info = &init_groups,
@@ -33,7 +33,7 @@
#define UINSNS_PER_PAGE (PAGE_SIZE/UPROBE_XOL_SLOT_BYTES)
#define MAX_UPROBE_XOL_SLOTS UINSNS_PER_PAGE
-static struct rb_root uprobes_tree = RB_ROOT;
+static DEFINE_RB_ROOT(uprobes_tree);
/*
* allows us to skip the uprobe_mmap if there are no uprobe events active
* at this time. Probably a fine grained per inode count is better?
@@ -817,7 +817,7 @@ static int refill_pi_state_cache(void)
/* pi_mutex gets initialized later */
pi_state->owner = NULL;
refcount_set(&pi_state->refcount, 1);
- pi_state->key = FUTEX_KEY_INIT;
+ pi_state->key = (union futex_key)FUTEX_KEY_INIT;
current->pi_state_cache = pi_state;
@@ -125,7 +125,7 @@ struct swsusp_extent {
unsigned long end;
};
-static struct rb_root swsusp_extents = RB_ROOT;
+static DEFINE_RB_ROOT(swsusp_extents);
static int swsusp_extents_insert(unsigned long swap_offset)
{
@@ -88,7 +88,7 @@ static struct {
arch_spinlock_t lock;
} trace_clock_struct ____cacheline_aligned_in_smp =
{
- .lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED,
+ .lock = __ARCH_SPIN_LOCK_UNLOCKED,
};
u64 notrace trace_clock_global(void)
@@ -34,8 +34,8 @@
#define CAP_BSET (void *)1
#define CAP_PI (void *)2
-static kernel_cap_t usermodehelper_bset = CAP_FULL_SET;
-static kernel_cap_t usermodehelper_inheritable = CAP_FULL_SET;
+static kernel_cap_t usermodehelper_bset = __CAP_FULL_SET;
+static kernel_cap_t usermodehelper_inheritable = __CAP_FULL_SET;
static DEFINE_SPINLOCK(umh_sysctl_lock);
static DECLARE_RWSEM(umhelper_sem);
static LIST_HEAD(umh_list);
@@ -56,8 +56,8 @@ struct user_namespace init_user_ns = {
},
},
.count = ATOMIC_INIT(3),
- .owner = GLOBAL_ROOT_UID,
- .group = GLOBAL_ROOT_GID,
+ .owner = __GLOBAL_ROOT_UID,
+ .group = __GLOBAL_ROOT_GID,
.ns.inum = PROC_USER_INIT_INO,
#ifdef CONFIG_USER_NS
.ns.ops = &userns_operations,
@@ -101,7 +101,7 @@ struct user_struct root_user = {
.processes = ATOMIC_INIT(1),
.sigpending = ATOMIC_INIT(0),
.locked_shm = 0,
- .uid = GLOBAL_ROOT_UID,
+ .uid = __GLOBAL_ROOT_UID,
.ratelimit = RATELIMIT_STATE_INIT(root_user.ratelimit, 0, 0),
};
@@ -28,7 +28,7 @@ static struct class *bdi_class;
*/
DEFINE_SPINLOCK(bdi_lock);
static u64 bdi_id_cursor;
-static struct rb_root bdi_tree = RB_ROOT;
+static DEFINE_RB_ROOT(bdi_tree);
LIST_HEAD(bdi_list);
/* bdi_wq serves all asynchronous writeback tasks */
@@ -26,7 +26,7 @@
* and size this cpu_bitmask to NR_CPUS.
*/
struct mm_struct init_mm = {
- .mm_rb = RB_ROOT,
+ .mm_rb = __RB_ROOT,
.pgd = swapper_pg_dir,
.mm_users = ATOMIC_INIT(2),
.mm_count = ATOMIC_INIT(1),
@@ -115,7 +115,7 @@ EXPORT_SYMBOL(latent_entropy);
* Array of node states.
*/
nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
- [N_POSSIBLE] = NODE_MASK_ALL,
+ [N_POSSIBLE] = __NODE_MASK_ALL,
[N_ONLINE] = { { [0] = 1UL } },
#ifndef CONFIG_NUMA
[N_NORMAL_MEMORY] = { { [0] = 1UL } },
@@ -334,7 +334,7 @@ static DEFINE_SPINLOCK(vmap_area_lock);
/* Export for kexec only */
LIST_HEAD(vmap_area_list);
static LLIST_HEAD(vmap_purge_list);
-static struct rb_root vmap_area_root = RB_ROOT;
+static DEFINE_RB_ROOT(vmap_area_root);
static bool vmap_initialized __read_mostly;
/*
@@ -361,7 +361,7 @@ static LIST_HEAD(free_vmap_area_list);
* of its sub-tree, right or left. Therefore it is possible to
* find a lowest match of free area.
*/
-static struct rb_root free_vmap_area_root = RB_ROOT;
+static DEFINE_RB_ROOT(free_vmap_area_root);
/*
* Preload a CPU with one object for "no edge" split case. The
@@ -16,8 +16,8 @@
#include <net/ip_tunnels.h>
static const struct fib_kuid_range fib_kuid_range_unset = {
- KUIDT_INIT(0),
- KUIDT_INIT(~0),
+ __KUIDT_INIT(0),
+ __KUIDT_INIT(~0),
};
bool fib_rule_matchall(const struct fib_rule *rule)
@@ -99,7 +99,7 @@ static DEFINE_RWLOCK(rds_cong_monitor_lock);
* lock masks interrupts.
*/
static DEFINE_SPINLOCK(rds_cong_lock);
-static struct rb_root rds_cong_tree = RB_ROOT;
+static DEFINE_RB_ROOT(rds_cong_tree);
static struct rds_cong_map *rds_cong_tree_walk(const struct in6_addr *addr,
struct rds_cong_map *insert)
@@ -21,7 +21,7 @@
#include <linux/lsm_hooks.h>
#include "integrity.h"
-static struct rb_root integrity_iint_tree = RB_ROOT;
+static DEFINE_RB_ROOT(integrity_iint_tree);
static DEFINE_RWLOCK(integrity_iint_lock);
static struct kmem_cache *iint_cache __read_mostly;
@@ -29,7 +29,7 @@ struct key_user root_key_user = {
.lock = __SPIN_LOCK_UNLOCKED(root_key_user.lock),
.nkeys = ATOMIC_INIT(2),
.nikeys = ATOMIC_INIT(2),
- .uid = GLOBAL_ROOT_UID,
+ .uid = __GLOBAL_ROOT_UID,
};
/*
Any variable intialized statically to a gnu89 compound literal like static struct foo x = (struct foo){}; causes a build failure in --std=gnu99 with gcc-4.9 or earlier. Later gcc versions and clang accept it as an extension the same was with --std=gnu89. Change enough of the kernel to allow building a 'defconfig' kernel on x86 and arm, by turning the compound literals into struct initializers. As many compound literals are defined in macros, that means we now need two versions of them -- one with the cast for use in assignments, and one without the cast as a struct initializer. A lot of this does make the code uglier, and more changes are needed to fix the rest of the kernel, but this should give an overview of what is still needed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- Makefile | 2 +- arch/x86/boot/compressed/acpi.c | 4 +- arch/x86/entry/vsyscall/vsyscall_64.c | 2 +- arch/x86/include/asm/pgtable_types.h | 59 +++++++++++-------- arch/x86/include/asm/processor.h | 4 +- arch/x86/include/asm/uaccess.h | 3 +- arch/x86/mm/pat_rbtree.c | 2 +- arch/x86/platform/efi/quirks.c | 9 ++- block/partitions/efi.c | 4 +- drivers/acpi/numa.c | 2 +- drivers/firmware/efi/efi.c | 4 +- drivers/firmware/efi/libstub/fdt.c | 2 +- drivers/firmware/efi/libstub/tpm.c | 2 +- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 2 +- drivers/input/mouse/elantech.c | 22 +++---- .../broadcom/brcm80211/brcmfmac/firmware.c | 2 +- drivers/soc/tegra/pmc.c | 8 +-- fs/proc/root.c | 2 +- include/linux/capability.h | 17 ++++-- include/linux/cpumask.h | 8 +-- include/linux/efi.h | 2 +- include/linux/futex.h | 2 +- include/linux/jump_label.h | 4 +- include/linux/nodemask.h | 20 ++++--- include/linux/property.h | 10 ++-- include/linux/rbtree.h | 7 ++- include/linux/rwlock.h | 2 +- include/linux/rwlock_types.h | 4 +- include/linux/sched/signal.h | 2 +- include/linux/spinlock.h | 2 +- include/linux/spinlock_types.h | 4 +- include/linux/uidgid.h | 13 +++- include/uapi/linux/uuid.h | 8 ++- init/init_task.c | 4 +- kernel/audit.c | 2 +- kernel/capability.c | 2 +- kernel/cred.c | 24 ++++---- kernel/events/uprobes.c | 2 +- kernel/futex.c | 2 +- kernel/power/swap.c | 2 +- kernel/trace/trace_clock.c | 2 +- kernel/umh.c | 4 +- kernel/user.c | 6 +- mm/backing-dev.c | 2 +- mm/init-mm.c | 2 +- mm/page_alloc.c | 2 +- mm/vmalloc.c | 4 +- net/core/fib_rules.c | 4 +- net/rds/cong.c | 2 +- security/integrity/iint.c | 2 +- security/keys/process_keys.c | 2 +- 51 files changed, 169 insertions(+), 141 deletions(-)