mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
i2c-host-fixes for v7.1-rc4
- tegra: - drop runtime PM reference when exiting on mutex_lock failure - preserve transfer errors when releasing the mutex -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQScDfrjQa34uOld1VLaeAVmJtMtbgUCagbyLwAKCRDaeAVmJtMt bu7nAQCvlINIxjjP8xHbD1IEzI/DMZP2fEdvqUgEqNjRQwYCaQD+OOD3D63q/c93 t4pvPCAdueFWfK1+MWOYsXPKVkHglQE= =IYx9 -----END PGP SIGNATURE----- Merge tag 'i2c-host-fixes-7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux into i2c/for-current i2c-host-fixes for v7.1-rc4 - tegra: - drop runtime PM reference when exiting on mutex_lock failure - preserve transfer errors when releasing the mutex
This commit is contained in:
commit
24214ad405
|
|
@ -589,25 +589,22 @@ static int tegra_i2c_mutex_lock(struct tegra_i2c_dev *i2c_dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int tegra_i2c_mutex_unlock(struct tegra_i2c_dev *i2c_dev)
|
||||
static void tegra_i2c_mutex_unlock(struct tegra_i2c_dev *i2c_dev)
|
||||
{
|
||||
unsigned int reg = i2c_dev->hw->regs->sw_mutex;
|
||||
u32 val, id;
|
||||
|
||||
if (!i2c_dev->hw->has_mutex)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
val = readl(i2c_dev->base + reg);
|
||||
|
||||
id = FIELD_GET(I2C_SW_MUTEX_GRANT, val);
|
||||
if (id && id != I2C_SW_MUTEX_ID_CCPLEX) {
|
||||
dev_warn(i2c_dev->dev, "unable to unlock mutex, mutex is owned by: %u\n", id);
|
||||
return -EPERM;
|
||||
}
|
||||
if (WARN(id && id != I2C_SW_MUTEX_ID_CCPLEX,
|
||||
"unable to unlock mutex, mutex is owned by: %u\n", id))
|
||||
return;
|
||||
|
||||
writel(0, i2c_dev->base + reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tegra_i2c_mask_irq(struct tegra_i2c_dev *i2c_dev, u32 mask)
|
||||
|
|
@ -1666,8 +1663,10 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
|||
}
|
||||
|
||||
ret = tegra_i2c_mutex_lock(i2c_dev);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
pm_runtime_put(i2c_dev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
enum msg_end_type end_type = MSG_END_STOP;
|
||||
|
|
@ -1698,7 +1697,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
|||
break;
|
||||
}
|
||||
|
||||
ret = tegra_i2c_mutex_unlock(i2c_dev);
|
||||
tegra_i2c_mutex_unlock(i2c_dev);
|
||||
pm_runtime_put(i2c_dev->dev);
|
||||
|
||||
return ret ?: i;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user