Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'i2c-for-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fix from Wolfram Sang:
"A revert for the i801 driver restoring old locking behaviour"

* tag 'i2c-for-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: i801: Revert "i2c: i801: replace acpi_lock with I2C bus lock"

+10 -4
+10 -4
drivers/i2c/busses/i2c-i801.c
··· 310 310 311 311 /* 312 312 * If set to true the host controller registers are reserved for 313 - * ACPI AML use. 313 + * ACPI AML use. Needs extra protection by acpi_lock. 314 314 */ 315 315 bool acpi_reserved; 316 + struct mutex acpi_lock; 316 317 }; 317 318 318 319 #define FEATURE_SMBUS_PEC BIT(0) ··· 895 894 int hwpec, ret; 896 895 struct i801_priv *priv = i2c_get_adapdata(adap); 897 896 898 - if (priv->acpi_reserved) 897 + mutex_lock(&priv->acpi_lock); 898 + if (priv->acpi_reserved) { 899 + mutex_unlock(&priv->acpi_lock); 899 900 return -EBUSY; 901 + } 900 902 901 903 pm_runtime_get_sync(&priv->pci_dev->dev); 902 904 ··· 939 935 iowrite8(SMBHSTSTS_INUSE_STS | STATUS_FLAGS, SMBHSTSTS(priv)); 940 936 941 937 pm_runtime_put_autosuspend(&priv->pci_dev->dev); 938 + mutex_unlock(&priv->acpi_lock); 942 939 return ret; 943 940 } 944 941 ··· 1470 1465 * further access from the driver itself. This device is now owned 1471 1466 * by the system firmware. 1472 1467 */ 1473 - i2c_lock_bus(&priv->adapter, I2C_LOCK_SEGMENT); 1468 + mutex_lock(&priv->acpi_lock); 1474 1469 1475 1470 if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) { 1476 1471 priv->acpi_reserved = true; ··· 1490 1485 else 1491 1486 status = acpi_os_write_port(address, (u32)*value, bits); 1492 1487 1493 - i2c_unlock_bus(&priv->adapter, I2C_LOCK_SEGMENT); 1488 + mutex_unlock(&priv->acpi_lock); 1494 1489 1495 1490 return status; 1496 1491 } ··· 1550 1545 priv->adapter.dev.parent = &dev->dev; 1551 1546 acpi_use_parent_companion(&priv->adapter.dev); 1552 1547 priv->adapter.retries = 3; 1548 + mutex_init(&priv->acpi_lock); 1553 1549 1554 1550 priv->pci_dev = dev; 1555 1551 priv->features = id->driver_data;