summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-03-15 17:05:07 -0700
committerKhem Raj <raj.khem@gmail.com>2020-03-15 18:05:25 -0700
commit802f9127b17e730032803adefdc2237426adbd8b (patch)
treede991a70e73551922b963ca895d6d1660eb0f043 /meta-oe
parent7f673e2133623a43f307c70444a2de74b40ce53c (diff)
downloadmeta-openembedded-802f9127b17e730032803adefdc2237426adbd8b.tar.gz
flashrom: Fix build with clang
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch69
-rw-r--r--meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch b/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch
new file mode 100644
index 000000000..7ac53650f
--- /dev/null
+++ b/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch
@@ -0,0 +1,69 @@
1From 8a236330f2af56bde21e9f69208ea3e59f529f0c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 15 Mar 2020 17:02:30 -0700
4Subject: [PATCH] typecast enum conversions explicitly
5
6clang complains like below
7
8libflashrom.c:191:43: error: implicit conversion from enumeration type 'const enum test_state' to different enumeration type 'enum flashrom_test_state' [-Werror,-Wenum-conversion]
9 supported_boards[i].working = binfo[i].working;
10 ~ ~~~~~~~~~^~~~~~~
11libflashrom.c:229:46: error: implicit conversion from enumeration type 'const enum test_state' to different enumeration type 'enum flashrom_test_state' [-Werror,-Wenum-conversion]
12 supported_chipsets[i].status = chipset[i].status;
13 ~ ~~~~~~~~~~~^~~~~~
14
15However these enums are exactly same so they can be typecasted
16
17libflashrom.h
18
19/** @ingroup flashrom-query */
20enum flashrom_test_state {
21 FLASHROM_TESTED_OK = 0,
22 FLASHROM_TESTED_NT = 1,
23 FLASHROM_TESTED_BAD = 2,
24 FLASHROM_TESTED_DEP = 3,
25 FLASHROM_TESTED_NA = 4,
26};
27
28flash.h
29
30enum test_state {
31 OK = 0,
32 NT = 1, /* Not tested */
33 BAD, /* Known to not work */
34 DEP, /* Support depends on configuration (e.g. Intel flash descriptor) */
35 NA, /* Not applicable (e.g. write support on ROM chips) */
36 };
37
38Upstream-Status: Pending
39
40Signed-off-by: Khem Raj <raj.khem@gmail.com>
41---
42 libflashrom.c | 4 ++--
43 1 file changed, 2 insertions(+), 2 deletions(-)
44
45diff --git a/libflashrom.c b/libflashrom.c
46index 0dec22e..7956685 100644
47--- a/libflashrom.c
48+++ b/libflashrom.c
49@@ -188,7 +188,7 @@ struct flashrom_board_info *flashrom_supported_boards(void)
50 for (; i < boards_known_size; ++i) {
51 supported_boards[i].vendor = binfo[i].vendor;
52 supported_boards[i].name = binfo[i].name;
53- supported_boards[i].working = binfo[i].working;
54+ supported_boards[i].working = (enum flashrom_test_state)binfo[i].working;
55 }
56 } else {
57 msg_gerr("Memory allocation error!\n");
58@@ -226,7 +226,7 @@ struct flashrom_chipset_info *flashrom_supported_chipsets(void)
59 supported_chipsets[i].chipset = chipset[i].device_name;
60 supported_chipsets[i].vendor_id = chipset[i].vendor_id;
61 supported_chipsets[i].chipset_id = chipset[i].device_id;
62- supported_chipsets[i].status = chipset[i].status;
63+ supported_chipsets[i].status = (enum flashrom_test_state)chipset[i].status;
64 }
65 } else {
66 msg_gerr("Memory allocation error!\n");
67--
682.25.1
69
diff --git a/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb b/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb
index 17445ac2d..642cec159 100644
--- a/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb
+++ b/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
6DEPENDS = "pciutils libusb libusb-compat" 6DEPENDS = "pciutils libusb libusb-compat"
7 7
8SRC_URI = "https://download.flashrom.org/releases/flashrom-v${PV}.tar.bz2 \ 8SRC_URI = "https://download.flashrom.org/releases/flashrom-v${PV}.tar.bz2 \
9 file://0001-typecast-enum-conversions-explicitly.patch \
9 " 10 "
10SRC_URI[md5sum] = "7f8e4b87087eb12ecee0fcc5445b4956" 11SRC_URI[md5sum] = "7f8e4b87087eb12ecee0fcc5445b4956"
11SRC_URI[sha256sum] = "e1f8d95881f5a4365dfe58776ce821dfcee0f138f75d0f44f8a3cd032d9ea42b" 12SRC_URI[sha256sum] = "e1f8d95881f5a4365dfe58776ce821dfcee0f138f75d0f44f8a3cd032d9ea42b"