Skip to contentSkip to conversation

usb: typec: intel_pmc_mux: Use the helper acpi_dev_get_memory_resources()

PATCH Applied Heikki Krogerus 2 participants 2 messages Sep 7, 2022 – Sep 10, 2022

Subsystems (4)
lore
Share & tools
lore

Heikki Krogerus

author maintainer
#0 lore raw

PATCH 1/1 usb: typec: intel_pmc_mux: Use the helper acpi_dev_get_memory_resources()

It removes the need to check the resource data type separately.

---
Hi Rafael,

Now resending this [1]. It applies on top of -rc4 (not -rc3). The other patches from that series you already picked.

thanks,

[1] https://lore.kernel.org/linux-acpi/[email protected]/

---
 drivers/usb/typec/mux/intel_pmc_mux.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +1 -10
index a8e273fe204ab..e1f4df7238bf4 100644
@@ -569,15 +569,6 @@ static int pmc_usb_register_port(struct pmc_usb *pmc, int index,
 	return ret;
 }
 
-static int is_memory(struct acpi_resource *res, void *data)
-{
-	struct resource_win win = {};
-	struct resource *r = &win.res;
-
-	return !(acpi_dev_resource_memory(res, r) ||
-		 acpi_dev_resource_address_space(res, &win));
-}
-
 /* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */
 static const struct acpi_device_id iom_acpi_ids[] = {
 	/* TigerLake */
@@ -611,7 +602,7 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)
 		return -ENODEV;
 
 	INIT_LIST_HEAD(&resource_list);
-	ret = acpi_dev_get_resources(adev, &resource_list, is_memory, NULL);
+	ret = acpi_dev_get_memory_resources(adev, &resource_list);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.35.1
maintainer Applied
#1 lore raw
Quoted 8 lines · Heikki Krogerus

It removes the need to check the resource data type separately.

---
Hi Rafael,

Quoted 6 lines

Now resending this [1]. It applies on top of -rc4 (not -rc3). The other patches from that series you already picked.

thanks,

[1] https://lore.kernel.org/linux-acpi/[email protected]/

Applied, thanks!

Note that I rebased the other commits from this series on top of -rc4 too, but that will become visible when the rebased ones go into my linux-next branch.

Thanks!

Quoted 36 lines
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +1 -11
index a8e273fe204ab..e1f4df7238bf4 100644
@@ -569,15 +569,6 @@ static int pmc_usb_register_port(struct pmc_usb *pmc, int index,
        return ret;
 }
 
-static int is_memory(struct acpi_resource *res, void *data)
-{
-       struct resource_win win = {};
-       struct resource *r = &win.res;
-
-       return !(acpi_dev_resource_memory(res, r) ||
-                acpi_dev_resource_address_space(res, &win));
-}
-
 /* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */
 static const struct acpi_device_id iom_acpi_ids[] = {
        /* TigerLake */
@@ -611,7 +602,7 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)
                return -ENODEV;
 
        INIT_LIST_HEAD(&resource_list);
-       ret = acpi_dev_get_resources(adev, &resource_list, is_memory, NULL);
+       ret = acpi_dev_get_memory_resources(adev, &resource_list);
        if (ret < 0)
                return ret;
 
--

2.35.1