i2c: piix4: Fix SB800 locking
authorJean Delvare <jdelvare@suse.de>
Fri, 22 Jan 2016 13:12:02 +0000 (14:12 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 26 Jan 2016 05:46:26 +0000 (06:46 +0100)
commita28e35171cb1ff84197e8d271b65aaeb8c404827
tree914ea2b08777a71c1a1c719851044787eccf086e
parent92e963f50fc74041b5e9e744c330dca48e04f08d
i2c: piix4: Fix SB800 locking

We need a single mutex for all 4 shared SMBus ports on the SB800. A
per-port mutex doesn't protect us from concurrent access.

In theory the mutex should be per PCI device, however in practice we
know that there's only ever a single instance of the device in a given
system so we can use a global.

Also take the mutex during initialization, as first port may be already
in use when second port is initialized.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Christian Fetzer <fetzer.ch@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
[wsa: made mutex static]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-piix4.c