Skip to content

Commit 280c7f9

Browse files
committed
Revert "test_firmware: Test platform fw loading on non-EFI systems"
This reverts commit 2d38dbf as it broke the build in linux-next Reported-by: Stephen Rothwell <[email protected]> Fixes: 2d38dbf ("test_firmware: Test platform fw loading on non-EFI systems") Cc: [email protected] Cc: Scott Branden <[email protected]> Cc: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4fb60b1 commit 280c7f9

File tree

4 files changed

+18
-40
lines changed

4 files changed

+18
-40
lines changed

drivers/firmware/efi/embedded-firmware.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,11 @@
1414
#include <linux/vmalloc.h>
1515
#include <crypto/sha.h>
1616

17-
#include "embedded-firmware.h"
18-
19-
#ifdef CONFIG_TEST_FIRMWARE
20-
# define EFI_EMBEDDED_FW_VISIBILITY
21-
#else
22-
# define EFI_EMBEDDED_FW_VISIBILITY static
23-
#endif
24-
25-
EFI_EMBEDDED_FW_VISIBILITY LIST_HEAD(efi_embedded_fw_list);
26-
EFI_EMBEDDED_FW_VISIBILITY bool efi_embedded_fw_checked;
27-
2817
/* Exported for use by lib/test_firmware.c only */
29-
#ifdef CONFIG_TEST_FIRMWARE
18+
LIST_HEAD(efi_embedded_fw_list);
3019
EXPORT_SYMBOL_GPL(efi_embedded_fw_list);
31-
EXPORT_SYMBOL_GPL(efi_embedded_fw_checked);
32-
#endif
20+
21+
static bool checked_for_fw;
3322

3423
static const struct dmi_system_id * const embedded_fw_table[] = {
3524
#ifdef CONFIG_TOUCHSCREEN_DMI
@@ -130,14 +119,14 @@ void __init efi_check_for_embedded_firmwares(void)
130119
}
131120
}
132121

133-
efi_embedded_fw_checked = true;
122+
checked_for_fw = true;
134123
}
135124

136125
int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size)
137126
{
138127
struct efi_embedded_fw *iter, *fw = NULL;
139128

140-
if (!efi_embedded_fw_checked) {
129+
if (!checked_for_fw) {
141130
pr_warn("Warning %s called while we did not check for embedded fw\n",
142131
__func__);
143132
return -ENOENT;

drivers/firmware/efi/embedded-firmware.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

include/linux/efi_embedded_fw.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77

88
#define EFI_EMBEDDED_FW_PREFIX_LEN 8
99

10+
/*
11+
* This struct and efi_embedded_fw_list are private to the efi-embedded fw
12+
* implementation they are in this header for use by lib/test_firmware.c only!
13+
*/
14+
struct efi_embedded_fw {
15+
struct list_head list;
16+
const char *name;
17+
const u8 *data;
18+
size_t length;
19+
};
20+
21+
extern struct list_head efi_embedded_fw_list;
22+
1023
/**
1124
* struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw
1225
* code to search for embedded firmwares.

lib/test_firmware.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ static ssize_t trigger_request_store(struct device *dev,
489489
static DEVICE_ATTR_WO(trigger_request);
490490

491491
#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
492-
#include "../drivers/firmware/efi/embedded-firmware.h"
493492
static ssize_t trigger_request_platform_store(struct device *dev,
494493
struct device_attribute *attr,
495494
const char *buf, size_t count)
@@ -502,7 +501,6 @@ static ssize_t trigger_request_platform_store(struct device *dev,
502501
};
503502
struct efi_embedded_fw efi_embedded_fw;
504503
const struct firmware *firmware = NULL;
505-
bool saved_efi_embedded_fw_checked;
506504
char *name;
507505
int rc;
508506

@@ -515,8 +513,6 @@ static ssize_t trigger_request_platform_store(struct device *dev,
515513
efi_embedded_fw.data = (void *)test_data;
516514
efi_embedded_fw.length = sizeof(test_data);
517515
list_add(&efi_embedded_fw.list, &efi_embedded_fw_list);
518-
saved_efi_embedded_fw_checked = efi_embedded_fw_checked;
519-
efi_embedded_fw_checked = true;
520516

521517
pr_info("loading '%s'\n", name);
522518
rc = firmware_request_platform(&firmware, name, dev);
@@ -534,7 +530,6 @@ static ssize_t trigger_request_platform_store(struct device *dev,
534530
rc = count;
535531

536532
out:
537-
efi_embedded_fw_checked = saved_efi_embedded_fw_checked;
538533
release_firmware(firmware);
539534
list_del(&efi_embedded_fw.list);
540535
kfree(name);

0 commit comments

Comments
 (0)