All of lore.kernel.org
 help / color / mirror / Atom feed
From: patrice.chotard@st.com (Patrice Chotard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: stm32: Implement .pin_config_dbg_show()
Date: Tue, 10 May 2016 14:00:01 +0200	[thread overview]
Message-ID: <5731CD41.60506@st.com> (raw)
In-Reply-To: <CACRpkdZ=KsPL1mBS1bLi=jYsv=Vb1QNBi8XPAJW50doPcwBuZg@mail.gmail.com>



On 05/10/2016 01:50 PM, Linus Walleij wrote:
> 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;
>> +}
Hi Linus

> Don't you think these two look very similar for example.

You 're right, i will rework this in a separate patch

Thanks

Patrice

>
> But that can be fixed later, debuggability is more important.
>
> Yours,
> Linus Walleij

WARNING: multiple messages have this Message-ID (diff)
From: Patrice Chotard <patrice.chotard@st.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>
Subject: Re: [PATCH] pinctrl: stm32: Implement .pin_config_dbg_show()
Date: Tue, 10 May 2016 14:00:01 +0200	[thread overview]
Message-ID: <5731CD41.60506@st.com> (raw)
In-Reply-To: <CACRpkdZ=KsPL1mBS1bLi=jYsv=Vb1QNBi8XPAJW50doPcwBuZg@mail.gmail.com>



On 05/10/2016 01:50 PM, Linus Walleij wrote:
> 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;
>> +}
Hi Linus

> Don't you think these two look very similar for example.

You 're right, i will rework this in a separate patch

Thanks

Patrice

>
> But that can be fixed later, debuggability is more important.
>
> Yours,
> Linus Walleij

  reply	other threads:[~2016-05-10 12:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 14:25 [PATCH] pinctrl: stm32: Implement .pin_config_dbg_show() patrice.chotard at st.com
2016-04-29 14:25 ` patrice.chotard
2016-05-10 11:50 ` Linus Walleij
2016-05-10 11:50   ` Linus Walleij
2016-05-10 12:00   ` Patrice Chotard [this message]
2016-05-10 12:00     ` Patrice Chotard
     [not found]   ` <5733364A.3090606@st.com>
2016-05-12 13:40     ` Linus Walleij
2016-05-12 13:40       ` Linus Walleij
2016-05-12 14:47       ` Patrice Chotard
2016-05-12 14:47         ` Patrice Chotard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5731CD41.60506@st.com \
    --to=patrice.chotard@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.