EFI changes: two driver API cleanups, and a log message tweak.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmDZYEQRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1g9vxAAj2OHH1E1aFsGhnN9aIwK+H560PtziW/2
 CDtu36IxE1cpdNulwXukKt+MG/pvXuEED3UJxsy0zIzuXJ7ggAj+Z4RwWHp4jTwW
 YMrHSxJtACXvVuTdvJEpW14AVxgkpUnfbRKPTuap+f7/hwJqwr7Av75PROUjMIZw
 hqjnoJAR36oyYOfR2MGqZKt4TxS8/LPt5zLaapxxfjjqTQGAM9BGsTXW3cnDDCBg
 m1dyYGKZtyRRe1nZfk7Dszs5Gyull4gNxsOSZhqKCNKn72MlxdtqidHujde60lH4
 ++ccsjsouCF6nLKpfgo0V7uv+4Q0xFn5ndFL3e7GT1GiU3b9lxrM6fmd+NHiJOdr
 3P6bHr45J/zIno0mYDirHc0l8C/3p0QDTA/0+cp3FWJ+xS2y9Fctbw/QTeDxIDzn
 5hTK0FlrRZPmyuMR2yXQSGexqQy8xdeEu7SvaoxdLvVgYDOBhjWRM37NeT2K3AaR
 CTBftFGH4kQ51g1P2wDaQlBcfQOnmb4C1fO9M/e6StNbyDr4SiHdH0qf4Eq4A+ab
 sCSXJA4kIz2T/7e4BJES5YDlsTGmdVDS4ajxtHWlId2OllTCFz8gd3LaqrYg+5Wn
 yg62fT+A2phesZOYhOpNXqQo5F9fYxQ82xqnV82ACjltFbF54VMpS7Sv7GJHky8D
 0EKLYvCOOLk=
 =xSer
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2021-06-28 11:34:16 -07:00
commit 6796355bc4
3 changed files with 19 additions and 32 deletions

View File

@ -468,7 +468,7 @@ void __init efi_init(void)
*/
if (!efi_runtime_supported())
pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
pr_err("No EFI runtime due to 32/64-bit mismatch with kernel\n");
if (!efi_runtime_supported() || efi_runtime_disabled()) {
efi_memmap_unmap();

View File

@ -157,7 +157,7 @@ static int __init unmarshal_devices(struct properties_header *properties)
if (!entry[0].name)
goto skip_device;
ret = device_add_properties(dev, entry); /* makes deep copy */
ret = device_create_managed_software_node(dev, entry, NULL);
if (ret)
dev_err(dev, "error %d assigning properties\n", ret);

View File

@ -12,52 +12,39 @@
#include <linux/efi.h>
#include <linux/pci.h>
struct acpi_hid_uid {
struct acpi_device_id hid[2];
char uid[11]; /* UINT_MAX + null byte */
};
static int __init match_acpi_dev(struct device *dev, const void *data)
{
struct acpi_hid_uid hid_uid = *(const struct acpi_hid_uid *)data;
struct acpi_device *adev = to_acpi_device(dev);
if (acpi_match_device_ids(adev, hid_uid.hid))
return 0;
if (adev->pnp.unique_id)
return !strcmp(adev->pnp.unique_id, hid_uid.uid);
else
return !strcmp("0", hid_uid.uid);
}
static long __init parse_acpi_path(const struct efi_dev_path *node,
struct device *parent, struct device **child)
{
struct acpi_hid_uid hid_uid = {};
char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */
struct acpi_device *adev;
struct device *phys_dev;
if (node->header.length != 12)
return -EINVAL;
sprintf(hid_uid.hid[0].id, "%c%c%c%04X",
sprintf(hid, "%c%c%c%04X",
'A' + ((node->acpi.hid >> 10) & 0x1f) - 1,
'A' + ((node->acpi.hid >> 5) & 0x1f) - 1,
'A' + ((node->acpi.hid >> 0) & 0x1f) - 1,
node->acpi.hid >> 16);
sprintf(hid_uid.uid, "%u", node->acpi.uid);
sprintf(uid, "%u", node->acpi.uid);
*child = bus_find_device(&acpi_bus_type, NULL, &hid_uid,
match_acpi_dev);
if (!*child)
for_each_acpi_dev_match(adev, hid, NULL, -1) {
if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
break;
if (!adev->pnp.unique_id && node->acpi.uid == 0)
break;
acpi_dev_put(adev);
}
if (!adev)
return -ENODEV;
phys_dev = acpi_get_first_physical_node(to_acpi_device(*child));
phys_dev = acpi_get_first_physical_node(adev);
if (phys_dev) {
get_device(phys_dev);
put_device(*child);
*child = phys_dev;
}
*child = get_device(phys_dev);
acpi_dev_put(adev);
} else
*child = &adev->dev;
return 0;
}