Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1398025

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

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] pinctrl: stm32: Implement .pin_config_dbg_show()
Date 2016-05-10 14:00 +0200
Message-ID <rxeuu-1FZ-35@gated-at.bofh.it> (permalink)
References <rthAB-7vA-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Apr 29, 2016 at 4:25 PM,  <patrice.chotard@st.com> wrote:

> From: Patrice Chotard <patrice.chotard@st.com>
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] pinctrl: stm32: Implement .pin_config_dbg_show() <patrice.chotard@st.com> - 2016-04-29 16:30 +0200
  Re: [PATCH] pinctrl: stm32: Implement .pin_config_dbg_show() Linus Walleij <linus.walleij@linaro.org> - 2016-05-10 14:00 +0200
    Re: [PATCH] pinctrl: stm32: Implement .pin_config_dbg_show() Patrice Chotard <patrice.chotard@st.com> - 2016-05-10 14:10 +0200

csiph-web