mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 13:23:18 +00:00
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
This commit is contained in:
commit
e8c3c7f97a
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -184,8 +184,7 @@ bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *s
|
||||
if (acpi_match_device_ids(adev, override_status_ids[i].hid))
|
||||
continue;
|
||||
|
||||
if (!adev->pnp.unique_id ||
|
||||
strcmp(adev->pnp.unique_id, override_status_ids[i].uid))
|
||||
if (!acpi_dev_uid_match(adev, override_status_ids[i].uid))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ static int arm_cspmu_request_irq(struct arm_cspmu *cspmu)
|
||||
|
||||
static inline int arm_cspmu_find_cpu_container(int cpu, u32 container_uid)
|
||||
{
|
||||
u32 acpi_uid;
|
||||
u64 acpi_uid;
|
||||
struct device *cpu_dev;
|
||||
struct acpi_device *acpi_dev;
|
||||
|
||||
@ -1071,10 +1071,8 @@ static inline int arm_cspmu_find_cpu_container(int cpu, u32 container_uid)
|
||||
|
||||
acpi_dev = ACPI_COMPANION(cpu_dev);
|
||||
while (acpi_dev) {
|
||||
if (!strcmp(acpi_device_hid(acpi_dev),
|
||||
ACPI_PROCESSOR_CONTAINER_HID) &&
|
||||
!kstrtouint(acpi_device_uid(acpi_dev), 0, &acpi_uid) &&
|
||||
acpi_uid == container_uid)
|
||||
if (acpi_dev_hid_uid_match(acpi_dev, ACPI_PROCESSOR_CONTAINER_HID, NULL) &&
|
||||
!acpi_dev_uid_to_integer(acpi_dev, &acpi_uid) && acpi_uid == container_uid)
|
||||
return 0;
|
||||
|
||||
acpi_dev = acpi_dev_parent(acpi_dev);
|
||||
|
@ -742,8 +742,8 @@ static int qcom_l3_cache_pmu_probe(struct platform_device *pdev)
|
||||
|
||||
l3pmu = devm_kzalloc(&pdev->dev, sizeof(*l3pmu), GFP_KERNEL);
|
||||
name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "l3cache_%s_%s",
|
||||
acpi_dev_parent(acpi_dev)->pnp.unique_id,
|
||||
acpi_dev->pnp.unique_id);
|
||||
acpi_device_uid(acpi_dev_parent(acpi_dev)),
|
||||
acpi_device_uid(acpi_dev));
|
||||
if (!l3pmu || !name)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -1694,7 +1694,7 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; table[i]; i++) {
|
||||
if (!strcmp(adev->pnp.unique_id, table[i]->uid)) {
|
||||
if (acpi_dev_uid_match(adev, table[i]->uid)) {
|
||||
data = table[i];
|
||||
break;
|
||||
}
|
||||
|
@ -763,6 +763,7 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
|
||||
adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
|
||||
}
|
||||
|
||||
bool acpi_dev_uid_match(struct acpi_device *adev, const char *uid2);
|
||||
bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2);
|
||||
int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer);
|
||||
|
||||
|
@ -787,6 +787,11 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
|
||||
|
||||
struct acpi_device;
|
||||
|
||||
static inline bool acpi_dev_uid_match(struct acpi_device *adev, const char *uid2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user