drivers: Introduce device lookup variants by ACPI_COMPANION device
Add a generic helper to match a device by the ACPI_COMPANION device and provide wrappers for the device lookup APIs. Cc: Len Brown <lenb@kernel.org> Cc: linux-acpi@vger.kernel.org Cc: linux-spi@vger.kernel.org Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: linux-i2c@vger.kernel.org Cc: "Rafael J. Wysocki" <rafael@kernel.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Wolfram Sang <wsa@the-dreams.de> # I2C parts Link: https://lore.kernel.org/r/20190723221838.12024-6-suzuki.poulose@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
4495dfdd61
commit
00500147cb
@@ -3741,11 +3741,6 @@ static int spi_acpi_controller_match(struct device *dev, const void *data)
|
||||
return ACPI_COMPANION(dev->parent) == data;
|
||||
}
|
||||
|
||||
static int spi_acpi_device_match(struct device *dev, const void *data)
|
||||
{
|
||||
return ACPI_COMPANION(dev) == data;
|
||||
}
|
||||
|
||||
static struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
|
||||
{
|
||||
struct device *dev;
|
||||
@@ -3765,8 +3760,7 @@ static struct spi_device *acpi_spi_find_device_by_adev(struct acpi_device *adev)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = bus_find_device(&spi_bus_type, NULL, adev, spi_acpi_device_match);
|
||||
|
||||
dev = bus_find_device_by_acpi_dev(&spi_bus_type, adev);
|
||||
return dev ? to_spi_device(dev) : NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user