Skip to content

Commit 59df285

Browse files
committed
x86/DMI: adjustments to comply with Misra C:2012 Rule 9.3
The rule demands that all array elements be initialized (or dedicated initializers be used). Introduce a small set of macros to allow doing so without unduly affecting use sites (in particular in terms of how many elements .matches[] actually has; right now there's no use of DMI_MATCH4(), so we could even consider reducing the array size to 3). Note that DMI_MATCH() needs adjustment because of the comma included in its expansion, which - due to being unparenthesized - would otherwise cause macro arguments in the "further replacement" step to be wrong. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
1 parent e4c0489 commit 59df285

File tree

6 files changed

+117
-161
lines changed

6 files changed

+117
-161
lines changed

xen/arch/x86/genapic/bigsmp.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ static int __init cf_check force_bigsmp(const struct dmi_system_id *d)
1919

2020

2121
static const struct dmi_system_id __initconstrel bigsmp_dmi_table[] = {
22-
{ force_bigsmp, "UNISYS ES7000-ONE", {
23-
DMI_MATCH(DMI_PRODUCT_NAME, "ES7000-ONE")
24-
}},
22+
{
23+
.ident = "UNISYS ES7000-ONE",
24+
.callback = force_bigsmp,
25+
DMI_MATCH1(
26+
DMI_MATCH(DMI_PRODUCT_NAME, "ES7000-ONE")),
27+
},
2528

26-
{ }
29+
{ }
2730
};
2831

2932

xen/arch/x86/hvm/quirks.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,42 +36,37 @@ static int __init cf_check check_port80(void)
3636
{
3737
.callback = dmi_hvm_deny_port80,
3838
.ident = "Compaq Presario V6000",
39-
.matches = {
39+
DMI_MATCH2(
4040
DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
41-
DMI_MATCH(DMI_BOARD_NAME, "30B7")
42-
}
41+
DMI_MATCH(DMI_BOARD_NAME, "30B7")),
4342
},
4443
{
4544
.callback = dmi_hvm_deny_port80,
4645
.ident = "HP Pavilion dv9000z",
47-
.matches = {
46+
DMI_MATCH2(
4847
DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
49-
DMI_MATCH(DMI_BOARD_NAME, "30B9")
50-
}
48+
DMI_MATCH(DMI_BOARD_NAME, "30B9")),
5149
},
5250
{
5351
.callback = dmi_hvm_deny_port80,
5452
.ident = "HP Pavilion dv6000",
55-
.matches = {
53+
DMI_MATCH2(
5654
DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
57-
DMI_MATCH(DMI_BOARD_NAME, "30B8")
58-
}
55+
DMI_MATCH(DMI_BOARD_NAME, "30B8")),
5956
},
6057
{
6158
.callback = dmi_hvm_deny_port80,
6259
.ident = "HP Pavilion tx1000",
63-
.matches = {
60+
DMI_MATCH2(
6461
DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
65-
DMI_MATCH(DMI_BOARD_NAME, "30BF")
66-
}
62+
DMI_MATCH(DMI_BOARD_NAME, "30BF")),
6763
},
6864
{
6965
.callback = dmi_hvm_deny_port80,
7066
.ident = "Presario F700",
71-
.matches = {
67+
DMI_MATCH2(
7268
DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
73-
DMI_MATCH(DMI_BOARD_NAME, "30D3")
74-
}
69+
DMI_MATCH(DMI_BOARD_NAME, "30D3")),
7570
},
7671
{ }
7772
};

xen/arch/x86/ioport_emulate.c

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,59 +43,51 @@ static const struct dmi_system_id __initconstrel ioport_quirks_tbl[] = {
4343
*/
4444
{
4545
.ident = "HP ProLiant DL3xx",
46-
.matches = {
46+
DMI_MATCH2(
4747
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
48-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL3"),
49-
},
48+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL3")),
5049
},
5150
{
5251
.ident = "HP ProLiant DL5xx",
53-
.matches = {
52+
DMI_MATCH2(
5453
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
55-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL5"),
56-
},
54+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL5")),
5755
},
5856
{
5957
.ident = "HP ProLiant DL7xx",
60-
.matches = {
58+
DMI_MATCH2(
6159
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
62-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL7"),
63-
},
60+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL7")),
6461
},
6562
{
6663
.ident = "HP ProLiant ML3xx",
67-
.matches = {
64+
DMI_MATCH2(
6865
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
69-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant ML3"),
70-
},
66+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant ML3")),
7167
},
7268
{
7369
.ident = "HP ProLiant ML5xx",
74-
.matches = {
70+
DMI_MATCH2(
7571
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
76-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant ML5"),
77-
},
72+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant ML5")),
7873
},
7974
{
8075
.ident = "HP ProLiant BL2xx",
81-
.matches = {
76+
DMI_MATCH2(
8277
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
83-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL2"),
84-
},
78+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL2")),
8579
},
8680
{
8781
.ident = "HP ProLiant BL4xx",
88-
.matches = {
82+
DMI_MATCH2(
8983
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
90-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL4"),
91-
},
84+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL4")),
9285
},
9386
{
9487
.ident = "HP ProLiant BL6xx",
95-
.matches = {
88+
DMI_MATCH2(
9689
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
97-
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL6"),
98-
},
90+
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL6")),
9991
},
10092
{ }
10193
};

0 commit comments

Comments
 (0)