i2c: designware: remove redundant lock
The per adapter bus_lock already projects from concurrent calls to the master_xfer callback. No need to add a driver internal lock. Also, rephrase a comment to drop mention of this lock. Reported-by: Rongrong Zou <zourongrong@gmail.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
f74187932d
commit
e3c9765008
@ -634,7 +634,6 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
|
|||||||
|
|
||||||
dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
|
dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
|
||||||
|
|
||||||
mutex_lock(&dev->lock);
|
|
||||||
pm_runtime_get_sync(dev->dev);
|
pm_runtime_get_sync(dev->dev);
|
||||||
|
|
||||||
reinit_completion(&dev->cmd_complete);
|
reinit_completion(&dev->cmd_complete);
|
||||||
@ -673,11 +672,12 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must disable the adapter before unlocking the &dev->lock mutex
|
* We must disable the adapter before returning and signaling the end
|
||||||
* below. Otherwise the hardware might continue generating interrupts
|
* of the current transfer. Otherwise the hardware might continue
|
||||||
* which in turn causes a race condition with the following transfer.
|
* generating interrupts which in turn causes a race condition with
|
||||||
* Needs some more investigation if the additional interrupts are
|
* the following transfer. Needs some more investigation if the
|
||||||
* a hardware bug or this driver doesn't handle them correctly yet.
|
* additional interrupts are a hardware bug or this driver doesn't
|
||||||
|
* handle them correctly yet.
|
||||||
*/
|
*/
|
||||||
__i2c_dw_enable(dev, false);
|
__i2c_dw_enable(dev, false);
|
||||||
|
|
||||||
@ -706,7 +706,6 @@ done:
|
|||||||
done_nolock:
|
done_nolock:
|
||||||
pm_runtime_mark_last_busy(dev->dev);
|
pm_runtime_mark_last_busy(dev->dev);
|
||||||
pm_runtime_put_autosuspend(dev->dev);
|
pm_runtime_put_autosuspend(dev->dev);
|
||||||
mutex_unlock(&dev->lock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -860,7 +859,6 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
|
|||||||
int r;
|
int r;
|
||||||
|
|
||||||
init_completion(&dev->cmd_complete);
|
init_completion(&dev->cmd_complete);
|
||||||
mutex_init(&dev->lock);
|
|
||||||
|
|
||||||
r = i2c_dw_init(dev);
|
r = i2c_dw_init(dev);
|
||||||
if (r)
|
if (r)
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
* @dev: driver model device node
|
* @dev: driver model device node
|
||||||
* @base: IO registers pointer
|
* @base: IO registers pointer
|
||||||
* @cmd_complete: tx completion indicator
|
* @cmd_complete: tx completion indicator
|
||||||
* @lock: protect this struct and IO registers
|
|
||||||
* @clk: input reference clock
|
* @clk: input reference clock
|
||||||
* @cmd_err: run time hadware error code
|
* @cmd_err: run time hadware error code
|
||||||
* @msgs: points to an array of messages currently being transfered
|
* @msgs: points to an array of messages currently being transfered
|
||||||
@ -73,7 +72,6 @@ struct dw_i2c_dev {
|
|||||||
struct device *dev;
|
struct device *dev;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
struct completion cmd_complete;
|
struct completion cmd_complete;
|
||||||
struct mutex lock;
|
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev);
|
u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev);
|
||||||
struct dw_pci_controller *controller;
|
struct dw_pci_controller *controller;
|
||||||
|
Loading…
Reference in New Issue
Block a user