From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Nicolas Ferre <nicolas.ferre@atmel.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] pinctrl: at91: initialize config parameter to 0
Date: Mon, 09 Dec 2013 10:55:26 +0100 [thread overview]
Message-ID: <52A5938E.40201@free-electrons.com> (raw)
In-Reply-To: <52A57E55.40808@atmel.com>
Hi,
On 09/12/2013 09:24, Nicolas Ferre wrote:
> On 07/12/2013 14:08, Alexandre Belloni :
>> When passing a not initialized config parameter, at91_pinconf_get()
>> would return
>> a bogus value. Fix that by initializing it to zero before using it.
>>
>> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> ---
>> drivers/pinctrl/pinctrl-at91.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-at91.c
>> b/drivers/pinctrl/pinctrl-at91.c
>> index 6446dc804aa7..b0b78f3468ae 100644
>> --- a/drivers/pinctrl/pinctrl-at91.c
>> +++ b/drivers/pinctrl/pinctrl-at91.c
>> @@ -722,7 +722,8 @@ static int at91_pinconf_get(struct pinctrl_dev
>> *pctldev,
>> unsigned pin;
>> int div;
>>
>> - dev_dbg(info->dev, "%s:%d, pin_id=%d, config=0x%lx", __func__,
>> __LINE__, pin_id, *config);
>> + *config = 0;
>> + dev_dbg(info->dev, "%s:%d, pin_id=%d", __func__, __LINE__, pin_id);
>> pio = pin_to_controller(info, pin_to_bank(pin_id));
>> pin = pin_id % MAX_NB_GPIO_PER_BANK;
>
> Beyond this patch, I must say that I am puzzled by this function.
>
> What I read from the prototype documentation and what I see in
> different implementations is different...
>
> Linus, can we have a review of this function because it seems not in
> line with what is used for u300 (but on the other hand looks like the
> what is returned by pinctrl-exynos5440.c driver for example).
>
> What would be the consequences if we change this function's behavior:
> I mean use of -EINVAL for pin configuration "available but disabled"
> as said in include/linux/pinctrl/pinconf.h?
>
>From what I understand, it doesn't really matter because that function
is never used. I guess the best implementation is the tegra one ;)
It is only called in one specific case:
- you have ops->is_generic == true (that is only true for a few
implmentations)
- and you are dumping the pinconf state using debugfs
I'm actually wondering if the checks for the ops->pin_config_get are not
a bit overkill. We check for that function in:
- pinconf_check_ops()
- before calling it in pin_config_get_for_pin() which is only used
once, in the same path : dump using debugfs and having ops->is_generic
== true
- in pinconf_pins_show() which is the function calling also in the same
path
What I would do is:
- remove all the checks in pinconf_check_ops() and pinconf_pins_show()
so that people are not pressured to implement a function that is simply
never used.
- modify pin_config_get_for_pin() by removing the dev_err() call and
returning -ENOTSUPP instead of -EINVAL (it doesn't change the behaviour
but I feel -ENOTSUPP is more appropriate)
I have a patch ready but I can't test it as I don't own any of the
is_generic platforms.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2013-12-09 9:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-07 13:08 [PATCH 1/3] pinctrl: at91: correct a few typos Alexandre Belloni
2013-12-07 13:08 ` [PATCH 2/3] pinctrl: at91: initialize config parameter to 0 Alexandre Belloni
2013-12-09 8:24 ` Nicolas Ferre
2013-12-09 9:55 ` Alexandre Belloni [this message]
2013-12-12 14:40 ` Linus Walleij
2013-12-12 15:33 ` Alexandre Belloni
2013-12-12 14:38 ` Linus Walleij
2013-12-12 14:44 ` Linus Walleij
2013-12-07 13:08 ` [PATCH 3/3] pinctrl: at91: implement at91_pinconf_dbg_show Alexandre Belloni
2013-12-12 14:45 ` Linus Walleij
2013-12-12 15:50 ` Alexandre Belloni
2013-12-12 16:04 ` Laurent Pinchart
2013-12-12 21:14 ` Linus Walleij
2013-12-13 8:50 ` Nicolas Ferre
2013-12-13 9:34 ` Linus Walleij
2013-12-12 14:42 ` [PATCH 1/3] pinctrl: at91: correct a few typos Linus Walleij
2013-12-12 14:47 ` Laurent Pinchart
2013-12-12 21:13 ` Linus Walleij
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=52A5938E.40201@free-electrons.com \
--to=alexandre.belloni@free-electrons.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox