aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-i801.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2021-08-06 23:16:33 +0200
committerWolfram Sang <wsa@kernel.org>2021-09-29 21:37:24 +0200
commit4811a411a92913e5327e4b32d4bb783823348537 (patch)
treeb5aaa72ee6e2e7966a7e5e33498f2a488c49dfc0 /drivers/i2c/busses/i2c-i801.c
parenti2c: i801: Remove not needed check for PCI_COMMAND_INTX_DISABLE (diff)
downloadlinux-dev-4811a411a92913e5327e4b32d4bb783823348537.tar.xz
linux-dev-4811a411a92913e5327e4b32d4bb783823348537.zip
i2c: i801: Improve i801_acpi_probe/remove functions
By using ACPI_HANDLE() the handler argument can be retrieved directly. Both address space handler functions check the handler argument and return an error if it's NULL. This allows to further simplify the code. Reviewed-by: Jean Delvare <jdelvare@suse.de> Tested-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-i801.c')
-rw-r--r--drivers/i2c/busses/i2c-i801.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 7fa06b85fa97..bd1db0f0aa19 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1635,31 +1635,22 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
static int i801_acpi_probe(struct i801_priv *priv)
{
- struct acpi_device *adev;
+ acpi_handle ah = ACPI_HANDLE(&priv->pci_dev->dev);
acpi_status status;
- adev = ACPI_COMPANION(&priv->pci_dev->dev);
- if (adev) {
- status = acpi_install_address_space_handler(adev->handle,
- ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler,
- NULL, priv);
- if (ACPI_SUCCESS(status))
- return 0;
- }
+ status = acpi_install_address_space_handler(ah, ACPI_ADR_SPACE_SYSTEM_IO,
+ i801_acpi_io_handler, NULL, priv);
+ if (ACPI_SUCCESS(status))
+ return 0;
return acpi_check_resource_conflict(&priv->pci_dev->resource[SMBBAR]);
}
static void i801_acpi_remove(struct i801_priv *priv)
{
- struct acpi_device *adev;
-
- adev = ACPI_COMPANION(&priv->pci_dev->dev);
- if (!adev)
- return;
+ acpi_handle ah = ACPI_HANDLE(&priv->pci_dev->dev);
- acpi_remove_address_space_handler(adev->handle,
- ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler);
+ acpi_remove_address_space_handler(ah, ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler);
}
#else
static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; }