aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-03-16 18:49:08 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-03-16 18:49:08 -0400
commitca5b74d2675a44f54aacb919c1cf022463e2f738 (patch)
tree08081e436bfed580e7f5a059faa1c77da3dbd58e /drivers/i2c
parentce793486e23e0162a732c605189c8028e0910e86 (diff)
ACPI: Introduce has_acpi_companion()
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>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index c270f5f9a8f9..538d6910b550 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -166,7 +166,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
166 /* fast mode by default because of legacy reasons */ 166 /* fast mode by default because of legacy reasons */
167 clk_freq = 400000; 167 clk_freq = 400000;
168 168
169 if (ACPI_COMPANION(&pdev->dev)) { 169 if (has_acpi_companion(&pdev->dev)) {
170 dw_i2c_acpi_configure(pdev); 170 dw_i2c_acpi_configure(pdev);
171 } else if (pdev->dev.of_node) { 171 } else if (pdev->dev.of_node) {
172 of_property_read_u32(pdev->dev.of_node, 172 of_property_read_u32(pdev->dev.of_node,
@@ -286,7 +286,7 @@ static int dw_i2c_remove(struct platform_device *pdev)
286 pm_runtime_put(&pdev->dev); 286 pm_runtime_put(&pdev->dev);
287 pm_runtime_disable(&pdev->dev); 287 pm_runtime_disable(&pdev->dev);
288 288
289 if (ACPI_COMPANION(&pdev->dev)) 289 if (has_acpi_companion(&pdev->dev))
290 dw_i2c_acpi_unconfigure(pdev); 290 dw_i2c_acpi_unconfigure(pdev);
291 291
292 return 0; 292 return 0;