Commit 1f760b87 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Wolfram Sang

i2c: i801: Call i801_check_pre() from i801_access()

This avoids code duplication, in a next step we'll call
i801_check_post() from i801_transaction() as well.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent a3989dc0
...@@ -462,10 +462,6 @@ static int i801_transaction(struct i801_priv *priv, int xact) ...@@ -462,10 +462,6 @@ static int i801_transaction(struct i801_priv *priv, int xact)
unsigned long result; unsigned long result;
const struct i2c_adapter *adap = &priv->adapter; const struct i2c_adapter *adap = &priv->adapter;
status = i801_check_pre(priv);
if (status < 0)
return status;
if (priv->features & FEATURE_IRQ) { if (priv->features & FEATURE_IRQ) {
reinit_completion(&priv->done); reinit_completion(&priv->done);
outb_p(xact | SMBHSTCNT_INTREN | SMBHSTCNT_START, outb_p(xact | SMBHSTCNT_INTREN | SMBHSTCNT_START,
...@@ -653,10 +649,6 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv, ...@@ -653,10 +649,6 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv,
if (command == I2C_SMBUS_BLOCK_PROC_CALL) if (command == I2C_SMBUS_BLOCK_PROC_CALL)
return -EOPNOTSUPP; return -EOPNOTSUPP;
status = i801_check_pre(priv);
if (status < 0)
return status;
len = data->block[0]; len = data->block[0];
if (read_write == I2C_SMBUS_WRITE) { if (read_write == I2C_SMBUS_WRITE) {
...@@ -891,6 +883,10 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, ...@@ -891,6 +883,10 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
pm_runtime_get_sync(&priv->pci_dev->dev); pm_runtime_get_sync(&priv->pci_dev->dev);
ret = i801_check_pre(priv);
if (ret)
goto out;
hwpec = (priv->features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC) hwpec = (priv->features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC)
&& size != I2C_SMBUS_QUICK && size != I2C_SMBUS_QUICK
&& size != I2C_SMBUS_I2C_BLOCK_DATA; && size != I2C_SMBUS_I2C_BLOCK_DATA;
...@@ -913,6 +909,7 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, ...@@ -913,6 +909,7 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
*/ */
if (hwpec) if (hwpec)
outb_p(inb_p(SMBAUXCTL(priv)) & ~SMBAUXCTL_CRC, SMBAUXCTL(priv)); outb_p(inb_p(SMBAUXCTL(priv)) & ~SMBAUXCTL_CRC, SMBAUXCTL(priv));
out:
/* /*
* Unlock the SMBus device for use by BIOS/ACPI, * Unlock the SMBus device for use by BIOS/ACPI,
* and clear status flags if not done already. * and clear status flags if not done already.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment