aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <[email protected]>2017-02-10 11:27:57 +0100
committerDaniel Vetter <[email protected]>2017-03-02 15:46:34 +0100
commit519e23a7f51e853dbe5dc4abb193c0c0db303b3a (patch)
tree3e2a2bef7630cfc4fcee7e4d5dc42040b5bfdd5c
parent086cb4afef45262806ee5bf26c34244e5867712c (diff)
i2c: designware-baytrail: Fix race when resetting the semaphore
Use iosf_mbi_modify instead of iosf_mbi_read + iosf_mbi_write so that we keep the iosf_mbi_lock locked during the read-modify-write done to reset the semaphore. Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/i2c/busses/i2c-designware-baytrail.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c
index 650a700f215e..8df529c04f8e 100644
--- a/drivers/i2c/busses/i2c-designware-baytrail.c
+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
@@ -47,15 +47,8 @@ static int get_sem(struct dw_i2c_dev *dev, u32 *sem)
static void reset_semaphore(struct dw_i2c_dev *dev)
{
- u32 data;
-
- if (iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data)) {
- dev_err(dev->dev, "iosf failed to reset punit semaphore during read\n");
- return;
- }
-
- data &= ~PUNIT_SEMAPHORE_BIT;
- if (iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, data))
+ if (iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE,
+ 0, PUNIT_SEMAPHORE_BIT))
dev_err(dev->dev, "iosf failed to reset punit semaphore during write\n");
pm_qos_update_request(&dev->pm_qos, PM_QOS_DEFAULT_VALUE);