Thread (3 messages) 3 messages, 2 authors, 2016-05-10

[PATCH] pinctrl: stm32: Implement .pin_config_dbg_show()

From: Linus Walleij <hidden>
Date: 2016-05-10 11:50:15
Also in: lkml

On Fri, Apr 29, 2016 at 4:25 PM,  [off-list ref] wrote:
From: Patrice Chotard <redacted>

Signed-off-by: Patrice Chotard <redacted>
Patch applied! Because this gives good debuggability.

But think about refactorings:
+static bool stm32_pconf_input_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_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));
+
+       spin_unlock_irqrestore(&bank->lock, flags);
+       clk_disable(bank->clk);
+
+       return val;
+}
Don't you think these two look very similar for example.

But that can be fixed later, debuggability is more important.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help