mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
pinctrl: stm32: Fix the unit of the hwspinlock timeout
HWSPNLCK_TIMEOUT is passed to hwspin_lock_timeout_in_atomic(), whose
timeout argument is in milliseconds, not microseconds:
atomic_delay += HWSPINLOCK_RETRY_DELAY_US;
if (atomic_delay > to * 1000)
return -ETIMEDOUT;
The hwspinlock core documents this explicitly:
If the mode is HWLOCK_IN_ATOMIC (called from an atomic context) the
timeout is handled with busy-waiting delays, hence shall not exceed
few msecs.
Fixes: 290a9f937e ("pinctrl: stm32: use the hwspin_lock_timeout_in_atomic() API")
Signed-off-by: Ju Nan <junan76@163.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
c1cf10a889
commit
544b3f8042
|
|
@ -87,7 +87,7 @@
|
|||
#define gpio_range_to_bank(chip) \
|
||||
container_of(chip, struct stm32_gpio_bank, range)
|
||||
|
||||
#define HWSPNLCK_TIMEOUT 1000 /* usec */
|
||||
#define HWSPNLCK_TIMEOUT_MS 1
|
||||
|
||||
static const char * const stm32_gpio_functions[] = {
|
||||
"gpio", "af0", "af1",
|
||||
|
|
@ -609,7 +609,7 @@ static int stm32_gpio_domain_activate(struct irq_domain *d,
|
|||
|
||||
if (pctl->hwlock) {
|
||||
ret = hwspin_lock_timeout_in_atomic(pctl->hwlock,
|
||||
HWSPNLCK_TIMEOUT);
|
||||
HWSPNLCK_TIMEOUT_MS);
|
||||
if (ret) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
return ret;
|
||||
|
|
@ -946,7 +946,7 @@ static int stm32_pmx_set_mode(struct stm32_gpio_bank *bank,
|
|||
|
||||
if (pctl->hwlock) {
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
|
||||
HWSPNLCK_TIMEOUT);
|
||||
HWSPNLCK_TIMEOUT_MS);
|
||||
if (err) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
goto unlock;
|
||||
|
|
@ -1089,7 +1089,7 @@ static int stm32_pconf_set_driving(struct stm32_gpio_bank *bank,
|
|||
|
||||
if (pctl->hwlock) {
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
|
||||
HWSPNLCK_TIMEOUT);
|
||||
HWSPNLCK_TIMEOUT_MS);
|
||||
if (err) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
goto unlock;
|
||||
|
|
@ -1135,7 +1135,7 @@ static int stm32_pconf_set_speed(struct stm32_gpio_bank *bank,
|
|||
|
||||
if (pctl->hwlock) {
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
|
||||
HWSPNLCK_TIMEOUT);
|
||||
HWSPNLCK_TIMEOUT_MS);
|
||||
if (err) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
goto unlock;
|
||||
|
|
@ -1181,7 +1181,7 @@ static int stm32_pconf_set_bias(struct stm32_gpio_bank *bank,
|
|||
|
||||
if (pctl->hwlock) {
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
|
||||
HWSPNLCK_TIMEOUT);
|
||||
HWSPNLCK_TIMEOUT_MS);
|
||||
if (err) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
goto unlock;
|
||||
|
|
@ -1242,7 +1242,7 @@ static int stm32_pconf_set_advcfgr(struct stm32_gpio_bank *bank, int offset, u32
|
|||
spin_lock_irqsave(&bank->lock, flags);
|
||||
|
||||
if (pctl->hwlock) {
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock, HWSPNLCK_TIMEOUT);
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock, HWSPNLCK_TIMEOUT_MS);
|
||||
if (err) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
goto unlock;
|
||||
|
|
@ -1320,7 +1320,7 @@ stm32_pconf_set_skew_delay(struct stm32_gpio_bank *bank, int offset, u32 delay,
|
|||
spin_lock_irqsave(&bank->lock, flags);
|
||||
|
||||
if (pctl->hwlock) {
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock, HWSPNLCK_TIMEOUT);
|
||||
err = hwspin_lock_timeout_in_atomic(pctl->hwlock, HWSPNLCK_TIMEOUT_MS);
|
||||
if (err) {
|
||||
dev_err(pctl->dev, "Can't get hwspinlock\n");
|
||||
goto unlock;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user