ACPI: Introduce has_acpi_companion()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 16 Mar 2015 22:49:08 +0000 (23:49 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 16 Mar 2015 22:49:08 +0000 (23:49 +0100)
Now that the ACPI companions of devices are represented by pointers
to struct fwnode_handle, it is not quite efficient to check whether
or not an ACPI companion of a device is present by evaluating the
ACPI_COMPANION() macro.

For this reason, introduce a special static inline routine for that,
has_acpi_companion(), and update the code to use it where applicable.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/glue.c
drivers/i2c/busses/i2c-designware-platdrv.c
drivers/iommu/intel-iommu.c
include/linux/acpi.h

index f774c65..39c485b 100644 (file)
@@ -168,7 +168,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
        unsigned int node_id;
        int retval = -EINVAL;
 
-       if (ACPI_COMPANION(dev)) {
+       if (has_acpi_companion(dev)) {
                if (acpi_dev) {
                        dev_warn(dev, "ACPI companion already set\n");
                        return -EINVAL;
@@ -220,7 +220,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
        list_add(&physical_node->node, physnode_list);
        acpi_dev->physical_node_count++;
 
-       if (!ACPI_COMPANION(dev))
+       if (!has_acpi_companion(dev))
                ACPI_COMPANION_SET(dev, acpi_dev);
 
        acpi_physnode_link_name(physical_node_name, node_id);
Simple merge
Simple merge