Commit e8c3c7f9 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpi-ec', 'acpi-sysfs', 'acpi-misc' and 'acpi-uid'

Merge ACPI EC driver updates, ACPI sysfs interface updates, misc updates
related to ACPI and changes related to ACPI _UID handling for 6.7-rc1:

 - Add EC GPE detection quirk for HP 250 G7 Notebook PC (Jonathan
   Denose).

 - Fix and clean up create_pnp_modalias() and create_of_modalias()
   (Christophe JAILLET).

 - Modify 2 pieces of code to use acpi_evaluate_dsm_typed() (Andy
   Shevchenko).

 - Define acpi_dev_uid_match() for matching _UID and use it in several
   places (Raag Jadav).

 - Use acpi_device_uid() for fetching _UID in 2 places (Raag Jadav).

* acpi-ec:
  ACPI: EC: Add quirk for HP 250 G7 Notebook PC

* acpi-sysfs:
  ACPI: sysfs: Clean up create_pnp_modalias() and create_of_modalias()
  ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()

* acpi-misc:
  ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed()
  ACPI: PCI: Switch to use acpi_evaluate_dsm_typed()

* acpi-uid:
  perf: arm_cspmu: use acpi_dev_hid_uid_match() for matching _HID and _UID
  ACPI: x86: use acpi_dev_uid_match() for matching _UID
  ACPI: utils: use acpi_dev_uid_match() for matching _UID
  pinctrl: intel: use acpi_dev_uid_match() for matching _UID
  ACPI: utils: Introduce acpi_dev_uid_match() for matching _UID
  perf: qcom: use acpi_device_uid() for fetching _UID
  ACPI: sysfs: use acpi_device_uid() for fetching _UID
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -158,8 +158,8 @@ static int create_pnp_modalias(const struct acpi_device *acpi_dev, char *modalia
		return 0;

	len = snprintf(modalias, size, "acpi:");
	if (len <= 0)
		return len;
	if (len >= size)
		return -ENOMEM;

	size -= len;

@@ -168,8 +168,6 @@ static int create_pnp_modalias(const struct acpi_device *acpi_dev, char *modalia
			continue;

		count = snprintf(&modalias[len], size, "%s:", id->id);
		if (count < 0)
			return -EINVAL;

		if (count >= size)
			return -ENOMEM;
@@ -177,7 +175,7 @@ static int create_pnp_modalias(const struct acpi_device *acpi_dev, char *modalia
		len += count;
		size -= count;
	}
	modalias[len] = '\0';

	return len;
}

@@ -212,8 +210,10 @@ static int create_of_modalias(const struct acpi_device *acpi_dev, char *modalias
	len = snprintf(modalias, size, "of:N%sT", (char *)buf.pointer);
	ACPI_FREE(buf.pointer);

	if (len <= 0)
		return len;
	if (len >= size)
		return -ENOMEM;

	size -= len;

	of_compatible = acpi_dev->data.of_compatible;
	if (of_compatible->type == ACPI_TYPE_PACKAGE) {
@@ -226,8 +226,6 @@ static int create_of_modalias(const struct acpi_device *acpi_dev, char *modalias
	for (i = 0; i < nval; i++, obj++) {
		count = snprintf(&modalias[len], size, "C%s",
				 obj->string.pointer);
		if (count < 0)
			return -EINVAL;

		if (count >= size)
			return -ENOMEM;
@@ -235,7 +233,7 @@ static int create_of_modalias(const struct acpi_device *acpi_dev, char *modalias
		len += count;
		size -= count;
	}
	modalias[len] = '\0';

	return len;
}

@@ -410,7 +408,7 @@ static ssize_t uid_show(struct device *dev,
{
	struct acpi_device *acpi_dev = to_acpi_device(dev);

	return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id);
	return sprintf(buf, "%s\n", acpi_device_uid(acpi_dev));
}
static DEVICE_ATTR_RO(uid);

@@ -554,7 +552,7 @@ int acpi_device_setup_files(struct acpi_device *dev)

	if (dev->pnp.type.bus_address)
		result = device_create_file(&dev->dev, &dev_attr_adr);
	if (dev->pnp.unique_id)
	if (acpi_device_uid(dev))
		result = device_create_file(&dev->dev, &dev_attr_uid);

	if (acpi_has_method(dev->handle, "_SUN")) {
@@ -635,7 +633,7 @@ void acpi_device_remove_files(struct acpi_device *dev)
	if (acpi_has_method(dev->handle, "_HRV"))
		device_remove_file(&dev->dev, &dev_attr_hrv);

	if (dev->pnp.unique_id)
	if (acpi_device_uid(dev))
		device_remove_file(&dev->dev, &dev_attr_uid);
	if (dev->pnp.type.bus_address)
		device_remove_file(&dev->dev, &dev_attr_adr);
+10 −0
Original line number Diff line number Diff line
@@ -1924,6 +1924,16 @@ static const struct dmi_system_id ec_dmi_table[] __initconst = {
			DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Gaming Laptop 15-dk1xxx"),
		},
	},
	{
		/*
		 * HP 250 G7 Notebook PC
		 */
		.callback = ec_honor_dsdt_gpe,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
			DMI_MATCH(DMI_PRODUCT_NAME, "HP 250 G7 Notebook PC"),
		},
	},
	{
		/*
		 * Samsung hardware
+3 −3
Original line number Diff line number Diff line
@@ -1055,9 +1055,9 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
	 * exists and returns 0, we must preserve any PCI resource
	 * assignments made by firmware for this host bridge.
	 */
	obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
				DSM_PCI_PRESERVE_BOOT_CONFIG, NULL);
	if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0)
	obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
				      DSM_PCI_PRESERVE_BOOT_CONFIG, NULL, ACPI_TYPE_INTEGER);
	if (obj && obj->integer.value == 0)
		host_bridge->preserve_config = 1;
	ACPI_FREE(obj);

+28 −6
Original line number Diff line number Diff line
@@ -824,20 +824,43 @@ bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs)
}
EXPORT_SYMBOL(acpi_check_dsm);

/**
 * acpi_dev_uid_match - Match device by supplied UID
 * @adev: ACPI device to match.
 * @uid2: Unique ID of the device.
 *
 * Matches UID in @adev with given @uid2.
 *
 * Returns:
 *  - %true if matches.
 *  - %false otherwise.
 */
bool acpi_dev_uid_match(struct acpi_device *adev, const char *uid2)
{
	const char *uid1 = acpi_device_uid(adev);

	return uid1 && uid2 && !strcmp(uid1, uid2);
}
EXPORT_SYMBOL_GPL(acpi_dev_uid_match);

/**
 * acpi_dev_hid_uid_match - Match device by supplied HID and UID
 * @adev: ACPI device to match.
 * @hid2: Hardware ID of the device.
 * @uid2: Unique ID of the device, pass NULL to not check _UID.
 *
 * Matches HID and UID in @adev with given @hid2 and @uid2.
 * Returns true if matches.
 * Matches HID and UID in @adev with given @hid2 and @uid2. Absence of @uid2
 * will be treated as a match. If user wants to validate @uid2, it should be
 * done before calling this function.
 *
 * Returns:
 *  - %true if matches or @uid2 is NULL.
 *  - %false otherwise.
 */
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
			    const char *hid2, const char *uid2)
{
	const char *hid1 = acpi_device_hid(adev);
	const char *uid1 = acpi_device_uid(adev);

	if (strcmp(hid1, hid2))
		return false;
@@ -845,7 +868,7 @@ bool acpi_dev_hid_uid_match(struct acpi_device *adev,
	if (!uid2)
		return true;

	return uid1 && !strcmp(uid1, uid2);
	return acpi_dev_uid_match(adev, uid2);
}
EXPORT_SYMBOL(acpi_dev_hid_uid_match);

@@ -919,8 +942,7 @@ static int acpi_dev_match_cb(struct device *dev, const void *data)
	if (acpi_match_device_ids(adev, match->hid))
		return 0;

	if (match->uid && (!adev->pnp.unique_id ||
	    strcmp(adev->pnp.unique_id, match->uid)))
	if (match->uid && !acpi_dev_uid_match(adev, match->uid))
		return 0;

	if (match->hrv == -1)
+2 −3
Original line number Diff line number Diff line
@@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d
	int ret = -EINVAL;

	guid_parse(uuid, dsm_guid);
	obj = acpi_evaluate_dsm(handle, dsm_guid, rev, 0, NULL);

	/* Check if the _DSM is present and as expected. */
	if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length == 0 ||
	    obj->buffer.length > sizeof(u32)) {
	obj = acpi_evaluate_dsm_typed(handle, dsm_guid, rev, 0, NULL, ACPI_TYPE_BUFFER);
	if (!obj || obj->buffer.length == 0 || obj->buffer.length > sizeof(u32)) {
		acpi_handle_debug(handle,
				"_DSM UUID %s rev %d function 0 evaluation failed\n", uuid, rev);
		goto out;
Loading