Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1400118 > unrolled thread
| Started by | <patrice.chotard@st.com> |
|---|---|
| First post | 2016-05-12 16:50 +0200 |
| Last post | 2016-05-24 13:20 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] pinctrl: stm32: .pin_config_dbg_show fixes <patrice.chotard@st.com> - 2016-05-12 16:50 +0200
[PATCH 2/2] pinctrl: stm32: factorize stm32_pconf_input/output_get() <patrice.chotard@st.com> - 2016-05-12 16:50 +0200
[PATCH 1/2] pinctrl: stm32: fix warning <patrice.chotard@st.com> - 2016-05-12 16:50 +0200
Re: [PATCH 0/2] pinctrl: stm32: .pin_config_dbg_show fixes Linus Walleij <linus.walleij@linaro.org> - 2016-05-24 13:10 +0200
Re: [PATCH 0/2] pinctrl: stm32: .pin_config_dbg_show fixes Patrice Chotard <patrice.chotard@st.com> - 2016-05-24 13:20 +0200
| From | <patrice.chotard@st.com> |
|---|---|
| Date | 2016-05-12 16:50 +0200 |
| Subject | [PATCH 0/2] pinctrl: stm32: .pin_config_dbg_show fixes |
| Message-ID | <ry066-7Wu-9@gated-at.bofh.it> |
From: Patrice Chotard <patrice.chotard@st.com> Patrice Chotard (2): pinctrl: stm32: fix warning pinctrl: stm32: factorize stm32_pconf_input/output_get() drivers/pinctrl/stm32/pinctrl-stm32.c | 39 +++++++++++++---------------------- 1 file changed, 14 insertions(+), 25 deletions(-) -- 1.9.1
[toc] | [next] | [standalone]
| From | <patrice.chotard@st.com> |
|---|---|
| Date | 2016-05-12 16:50 +0200 |
| Subject | [PATCH 2/2] pinctrl: stm32: factorize stm32_pconf_input/output_get() |
| Message-ID | <ry066-7Wu-7@gated-at.bofh.it> |
| In reply to | #1400118 |
From: Patrice Chotard <patrice.chotard@st.com>
As these 2 functions code are 95% similar, factorize them.
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 249da52..8b82d3e 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -661,8 +661,8 @@ static u32 stm32_pconf_get_bias(struct stm32_gpio_bank *bank,
return (val >> (offset * 2));
}
-static bool stm32_pconf_input_get(struct stm32_gpio_bank *bank,
- unsigned int offset)
+static bool stm32_pconf_get(struct stm32_gpio_bank *bank,
+ unsigned int offset, bool dir)
{
unsigned long flags;
u32 val;
@@ -670,23 +670,12 @@ static bool stm32_pconf_input_get(struct stm32_gpio_bank *bank,
clk_enable(bank->clk);
spin_lock_irqsave(&bank->lock, flags);
- val = !!(readl_relaxed(bank->base + STM32_GPIO_IDR) & BIT(offset));
-
- spin_unlock_irqrestore(&bank->lock, flags);
- clk_disable(bank->clk);
-
- return val;
-}
-
-static bool stm32_pconf_output_get(struct stm32_gpio_bank *bank,
- unsigned int offset)
-{
- unsigned long flags;
- u32 val;
-
- clk_enable(bank->clk);
- spin_lock_irqsave(&bank->lock, flags);
- val = !!(readl_relaxed(bank->base + STM32_GPIO_ODR) & BIT(offset));
+ if (dir)
+ val = !!(readl_relaxed(bank->base + STM32_GPIO_IDR) &
+ BIT(offset));
+ else
+ val = !!(readl_relaxed(bank->base + STM32_GPIO_ODR) &
+ BIT(offset));
spin_unlock_irqrestore(&bank->lock, flags);
clk_disable(bank->clk);
@@ -795,7 +784,7 @@ static void stm32_pconf_dbg_show(struct pinctrl_dev *pctldev,
switch (mode) {
/* input */
case 0:
- val = stm32_pconf_input_get(bank, offset);
+ val = stm32_pconf_get(bank, offset, true);
seq_printf(s, "- %s - %s",
val ? "high" : "low",
biasing[bias]);
@@ -805,7 +794,7 @@ static void stm32_pconf_dbg_show(struct pinctrl_dev *pctldev,
case 1:
drive = stm32_pconf_get_driving(bank, offset);
speed = stm32_pconf_get_speed(bank, offset);
- val = stm32_pconf_output_get(bank, offset);
+ val = stm32_pconf_get(bank, offset, false);
seq_printf(s, "- %s - %s - %s - %s speed",
val ? "high" : "low",
drive ? "open drain" : "push pull",
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | <patrice.chotard@st.com> |
|---|---|
| Date | 2016-05-12 16:50 +0200 |
| Subject | [PATCH 1/2] pinctrl: stm32: fix warning |
| Message-ID | <ry066-7Wu-13@gated-at.bofh.it> |
| In reply to | #1400118 |
From: Patrice Chotard <patrice.chotard@st.com>
fix compilation warning :
drivers/pinctrl/stm32/pinctrl-stm32.c:823:7: warning: too many arguments for format [-Wformat-extra-args]
speeds[speed], "speed");
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 1527740..249da52 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -806,21 +806,21 @@ static void stm32_pconf_dbg_show(struct pinctrl_dev *pctldev,
drive = stm32_pconf_get_driving(bank, offset);
speed = stm32_pconf_get_speed(bank, offset);
val = stm32_pconf_output_get(bank, offset);
- seq_printf(s, "- %s - %s - %s - %s %s",
+ seq_printf(s, "- %s - %s - %s - %s speed",
val ? "high" : "low",
drive ? "open drain" : "push pull",
biasing[bias],
- speeds[speed], "speed");
+ speeds[speed]);
break;
/* alternate */
case 2:
drive = stm32_pconf_get_driving(bank, offset);
speed = stm32_pconf_get_speed(bank, offset);
- seq_printf(s, "%d - %s -%s", alt,
+ seq_printf(s, "%d - %s -%s - %s speed", alt,
drive ? "open drain" : "push pull",
biasing[bias],
- speeds[speed], "speed");
+ speeds[speed]);
break;
/* analog */
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2016-05-24 13:10 +0200 |
| Message-ID | <rCinL-2ur-5@gated-at.bofh.it> |
| In reply to | #1400118 |
On Thu, May 12, 2016 at 4:46 PM, <patrice.chotard@st.com> wrote: > From: Patrice Chotard <patrice.chotard@st.com> > > Patrice Chotard (2): > pinctrl: stm32: fix warning > pinctrl: stm32: factorize stm32_pconf_input/output_get() Patrice, can you rebase these two on top of Torvalds' fix and resend? Yours, Linus Walleij
[toc] | [prev] | [next] | [standalone]
| From | Patrice Chotard <patrice.chotard@st.com> |
|---|---|
| Date | 2016-05-24 13:20 +0200 |
| Message-ID | <rCixs-2xY-11@gated-at.bofh.it> |
| In reply to | #1406060 |
On 05/24/2016 01:04 PM, Linus Walleij wrote: > On Thu, May 12, 2016 at 4:46 PM, <patrice.chotard@st.com> wrote: > >> From: Patrice Chotard <patrice.chotard@st.com> >> >> Patrice Chotard (2): >> pinctrl: stm32: fix warning >> pinctrl: stm32: factorize stm32_pconf_input/output_get() > Patrice, can you rebase these two on top of Torvalds' fix and > resend? Hi Linus Sure Patrice > > Yours, > Linus Walleij
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web