Skip to content

Commit 6796355

Browse files
committed
Merge tag 'efi-core-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI updates from Ingo Molnar: "Two driver API cleanups, and a log message tweak" * tag 'efi-core-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/efi: Log 32/64-bit mismatch with kernel as an error efi/dev-path-parser: Switch to use for_each_acpi_dev_match() efi/apple-properties: Handle device properties with software node API
2 parents d04f7de + 267be9d commit 6796355

3 files changed

Lines changed: 20 additions & 33 deletions

File tree

arch/x86/platform/efi/efi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ void __init efi_init(void)
468468
*/
469469

470470
if (!efi_runtime_supported())
471-
pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
471+
pr_err("No EFI runtime due to 32/64-bit mismatch with kernel\n");
472472

473473
if (!efi_runtime_supported() || efi_runtime_disabled()) {
474474
efi_memmap_unmap();

drivers/firmware/efi/apple-properties.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int __init unmarshal_devices(struct properties_header *properties)
157157
if (!entry[0].name)
158158
goto skip_device;
159159

160-
ret = device_add_properties(dev, entry); /* makes deep copy */
160+
ret = device_create_managed_software_node(dev, entry, NULL);
161161
if (ret)
162162
dev_err(dev, "error %d assigning properties\n", ret);
163163

drivers/firmware/efi/dev-path-parser.c

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,39 @@
1212
#include <linux/efi.h>
1313
#include <linux/pci.h>
1414

15-
struct acpi_hid_uid {
16-
struct acpi_device_id hid[2];
17-
char uid[11]; /* UINT_MAX + null byte */
18-
};
19-
20-
static int __init match_acpi_dev(struct device *dev, const void *data)
21-
{
22-
struct acpi_hid_uid hid_uid = *(const struct acpi_hid_uid *)data;
23-
struct acpi_device *adev = to_acpi_device(dev);
24-
25-
if (acpi_match_device_ids(adev, hid_uid.hid))
26-
return 0;
27-
28-
if (adev->pnp.unique_id)
29-
return !strcmp(adev->pnp.unique_id, hid_uid.uid);
30-
else
31-
return !strcmp("0", hid_uid.uid);
32-
}
33-
3415
static long __init parse_acpi_path(const struct efi_dev_path *node,
3516
struct device *parent, struct device **child)
3617
{
37-
struct acpi_hid_uid hid_uid = {};
18+
char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */
19+
struct acpi_device *adev;
3820
struct device *phys_dev;
3921

4022
if (node->header.length != 12)
4123
return -EINVAL;
4224

43-
sprintf(hid_uid.hid[0].id, "%c%c%c%04X",
25+
sprintf(hid, "%c%c%c%04X",
4426
'A' + ((node->acpi.hid >> 10) & 0x1f) - 1,
4527
'A' + ((node->acpi.hid >> 5) & 0x1f) - 1,
4628
'A' + ((node->acpi.hid >> 0) & 0x1f) - 1,
4729
node->acpi.hid >> 16);
48-
sprintf(hid_uid.uid, "%u", node->acpi.uid);
49-
50-
*child = bus_find_device(&acpi_bus_type, NULL, &hid_uid,
51-
match_acpi_dev);
52-
if (!*child)
30+
sprintf(uid, "%u", node->acpi.uid);
31+
32+
for_each_acpi_dev_match(adev, hid, NULL, -1) {
33+
if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
34+
break;
35+
if (!adev->pnp.unique_id && node->acpi.uid == 0)
36+
break;
37+
acpi_dev_put(adev);
38+
}
39+
if (!adev)
5340
return -ENODEV;
5441

55-
phys_dev = acpi_get_first_physical_node(to_acpi_device(*child));
42+
phys_dev = acpi_get_first_physical_node(adev);
5643
if (phys_dev) {
57-
get_device(phys_dev);
58-
put_device(*child);
59-
*child = phys_dev;
60-
}
44+
*child = get_device(phys_dev);
45+
acpi_dev_put(adev);
46+
} else
47+
*child = &adev->dev;
6148

6249
return 0;
6350
}

0 commit comments

Comments
 (0)