Commit f07bedc3 authored by John Keeping's avatar John Keeping Committed by Linus Walleij

pinctrl: rockchip: remove unnecessary locking

regmap_update_bits does its own locking and everything else accessed
here is a local variable so there is no need to lock around it.
Signed-off-by: default avatarJohn Keeping <john@metanate.com>
Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 35099234
...@@ -652,7 +652,6 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) ...@@ -652,7 +652,6 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
int iomux_num = (pin / 8); int iomux_num = (pin / 8);
struct regmap *regmap; struct regmap *regmap;
int reg, ret, mask, mux_type; int reg, ret, mask, mux_type;
unsigned long flags;
u8 bit; u8 bit;
u32 data, rmask; u32 data, rmask;
...@@ -701,15 +700,11 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) ...@@ -701,15 +700,11 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
if (ctrl->iomux_recalc && (mux_type & IOMUX_RECALCED)) if (ctrl->iomux_recalc && (mux_type & IOMUX_RECALCED))
ctrl->iomux_recalc(bank->bank_num, pin, &reg, &bit, &mask); ctrl->iomux_recalc(bank->bank_num, pin, &reg, &bit, &mask);
spin_lock_irqsave(&bank->slock, flags);
data = (mask << (bit + 16)); data = (mask << (bit + 16));
rmask = data | (data >> 16); rmask = data | (data >> 16);
data |= (mux & mask) << bit; data |= (mux & mask) << bit;
ret = regmap_update_bits(regmap, reg, rmask, data); ret = regmap_update_bits(regmap, reg, rmask, data);
spin_unlock_irqrestore(&bank->slock, flags);
return ret; return ret;
} }
...@@ -1135,7 +1130,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1135,7 +1130,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct regmap *regmap; struct regmap *regmap;
unsigned long flags;
int reg, ret, i; int reg, ret, i;
u32 data, rmask, rmask_bits, temp; u32 data, rmask, rmask_bits, temp;
u8 bit; u8 bit;
...@@ -1163,8 +1157,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1163,8 +1157,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
return ret; return ret;
} }
spin_lock_irqsave(&bank->slock, flags);
switch (drv_type) { switch (drv_type) {
case DRV_TYPE_IO_1V8_3V0_AUTO: case DRV_TYPE_IO_1V8_3V0_AUTO:
case DRV_TYPE_IO_3V3_ONLY: case DRV_TYPE_IO_3V3_ONLY:
...@@ -1185,17 +1177,14 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1185,17 +1177,14 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
rmask = BIT(15) | BIT(31); rmask = BIT(15) | BIT(31);
data |= BIT(31); data |= BIT(31);
ret = regmap_update_bits(regmap, reg, rmask, data); ret = regmap_update_bits(regmap, reg, rmask, data);
if (ret) { if (ret)
spin_unlock_irqrestore(&bank->slock, flags);
return ret; return ret;
}
rmask = 0x3 | (0x3 << 16); rmask = 0x3 | (0x3 << 16);
temp |= (0x3 << 16); temp |= (0x3 << 16);
reg += 0x4; reg += 0x4;
ret = regmap_update_bits(regmap, reg, rmask, temp); ret = regmap_update_bits(regmap, reg, rmask, temp);
spin_unlock_irqrestore(&bank->slock, flags);
return ret; return ret;
case 18 ... 21: case 18 ... 21:
/* setting fully enclosed in the second register */ /* setting fully enclosed in the second register */
...@@ -1203,7 +1192,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1203,7 +1192,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
bit -= 16; bit -= 16;
break; break;
default: default:
spin_unlock_irqrestore(&bank->slock, flags);
dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n",
bit, drv_type); bit, drv_type);
return -EINVAL; return -EINVAL;
...@@ -1215,7 +1203,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1215,7 +1203,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
rmask_bits = RK3288_DRV_BITS_PER_PIN; rmask_bits = RK3288_DRV_BITS_PER_PIN;
break; break;
default: default:
spin_unlock_irqrestore(&bank->slock, flags);
dev_err(info->dev, "unsupported pinctrl drive type: %d\n", dev_err(info->dev, "unsupported pinctrl drive type: %d\n",
drv_type); drv_type);
return -EINVAL; return -EINVAL;
...@@ -1227,7 +1214,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, ...@@ -1227,7 +1214,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
data |= (ret << bit); data |= (ret << bit);
ret = regmap_update_bits(regmap, reg, rmask, data); ret = regmap_update_bits(regmap, reg, rmask, data);
spin_unlock_irqrestore(&bank->slock, flags);
return ret; return ret;
} }
...@@ -1294,7 +1280,6 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -1294,7 +1280,6 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct regmap *regmap; struct regmap *regmap;
int reg, ret, i, pull_type; int reg, ret, i, pull_type;
unsigned long flags;
u8 bit; u8 bit;
u32 data, rmask; u32 data, rmask;
...@@ -1309,14 +1294,10 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -1309,14 +1294,10 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
switch (ctrl->type) { switch (ctrl->type) {
case RK2928: case RK2928:
spin_lock_irqsave(&bank->slock, flags);
data = BIT(bit + 16); data = BIT(bit + 16);
if (pull == PIN_CONFIG_BIAS_DISABLE) if (pull == PIN_CONFIG_BIAS_DISABLE)
data |= BIT(bit); data |= BIT(bit);
ret = regmap_write(regmap, reg, data); ret = regmap_write(regmap, reg, data);
spin_unlock_irqrestore(&bank->slock, flags);
break; break;
case RV1108: case RV1108:
case RK3188: case RK3188:
...@@ -1339,16 +1320,12 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -1339,16 +1320,12 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
return ret; return ret;
} }
spin_lock_irqsave(&bank->slock, flags);
/* enable the write to the equivalent lower bits */ /* enable the write to the equivalent lower bits */
data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16);
rmask = data | (data >> 16); rmask = data | (data >> 16);
data |= (ret << bit); data |= (ret << bit);
ret = regmap_update_bits(regmap, reg, rmask, data); ret = regmap_update_bits(regmap, reg, rmask, data);
spin_unlock_irqrestore(&bank->slock, flags);
break; break;
default: default:
dev_err(info->dev, "unsupported pinctrl type\n"); dev_err(info->dev, "unsupported pinctrl type\n");
...@@ -1408,7 +1385,6 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, ...@@ -1408,7 +1385,6 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank,
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct regmap *regmap; struct regmap *regmap;
int reg, ret; int reg, ret;
unsigned long flags;
u8 bit; u8 bit;
u32 data, rmask; u32 data, rmask;
...@@ -1419,16 +1395,11 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, ...@@ -1419,16 +1395,11 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank,
if (ret) if (ret)
return ret; return ret;
spin_lock_irqsave(&bank->slock, flags);
/* enable the write to the equivalent lower bits */ /* enable the write to the equivalent lower bits */
data = BIT(bit + 16) | (enable << bit); data = BIT(bit + 16) | (enable << bit);
rmask = BIT(bit + 16) | BIT(bit); rmask = BIT(bit + 16) | BIT(bit);
ret = regmap_update_bits(regmap, reg, rmask, data); return regmap_update_bits(regmap, reg, rmask, data);
spin_unlock_irqrestore(&bank->slock, flags);
return ret;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment