From: Tony Lindgren <tony@atomide.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Christ van Willegen <cvwillegen@gmail.com>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
"H . Nikolaus Schaller" <hns@goldelico.com>,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
Paul Cercueil <paul@crapouillou.net>,
Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH 2/5] pinctrl: pinmux: Return selector to the pinctrl driver
Date: Thu, 5 Jul 2018 02:10:15 -0700 [thread overview]
Message-ID: <20180705091018.60524-3-tony@atomide.com> (raw)
In-Reply-To: <20180705091018.60524-1-tony@atomide.com>
We must return the selector from pinmux_generic_add_function() so
pin controller device drivers can remove the right group if needed
for deferred probe for example. And we now must make sure that a
proper name is passed so we can use it to check if the entry already
exists.
Note that fixes are also needed for the pin controller drivers to
use the selector value.
Fixes: a76edc89b100 ("pinctrl: core: Add generic pinctrl functions for
managing groups")
Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Christ van Willegen <cvwillegen@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/pinctrl/pinmux.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -307,7 +307,6 @@ static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
selector++;
}
- dev_err(pctldev->dev, "function '%s' not supported\n", function);
return -EINVAL;
}
@@ -774,6 +773,16 @@ int pinmux_generic_add_function(struct pinctrl_dev *pctldev,
void *data)
{
struct function_desc *function;
+ int selector;
+
+ if (!name)
+ return -EINVAL;
+
+ selector = pinmux_func_name_to_selector(pctldev, name);
+ if (selector >= 0)
+ return selector;
+
+ selector = pctldev->num_functions;
function = devm_kzalloc(pctldev->dev, sizeof(*function), GFP_KERNEL);
if (!function)
@@ -784,12 +793,11 @@ int pinmux_generic_add_function(struct pinctrl_dev *pctldev,
function->num_group_names = num_groups;
function->data = data;
- radix_tree_insert(&pctldev->pin_function_tree, pctldev->num_functions,
- function);
+ radix_tree_insert(&pctldev->pin_function_tree, selector, function);
pctldev->num_functions++;
- return 0;
+ return selector;
}
EXPORT_SYMBOL_GPL(pinmux_generic_add_function);
--
2.17.1
next prev parent reply other threads:[~2018-07-05 9:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 9:10 [PATCHv3 0/5] pinctrl fixes for generic functions and groups Tony Lindgren
2018-07-05 9:10 ` [PATCH 1/5] pinctrl: core: Return selector to the pinctrl driver Tony Lindgren
2018-07-05 9:10 ` Tony Lindgren [this message]
2018-07-05 9:10 ` [PATCH 3/5] pinctrl: single: Fix group and function selector use Tony Lindgren
2018-07-05 9:10 ` [PATCH 4/5] pinctrl: rza1: Fix selector use for groups and functions Tony Lindgren
2018-07-05 9:10 ` [PATCH 5/5] pinctrl: core: Remove broken remove_last group and pinmux functions Tony Lindgren
2018-07-05 13:28 ` [PATCHv3 0/5] pinctrl fixes for generic functions and groups H. Nikolaus Schaller
2018-07-05 13:55 ` Andy Shevchenko
2018-07-09 12:59 ` Linus Walleij
2018-07-09 13:11 ` Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2018-06-19 9:31 [PATCHv2 " Tony Lindgren
2018-06-19 9:31 ` [PATCH 2/5] pinctrl: pinmux: Return selector to the pinctrl driver Tony Lindgren
2018-06-15 11:11 [PATCH 0/5] pinctrl fixes for generic functions and groups Tony Lindgren
2018-06-15 11:11 ` [PATCH 2/5] pinctrl: pinmux: Return selector to the pinctrl driver Tony Lindgren
2018-06-17 16:51 ` Andy Shevchenko
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=20180705091018.60524-3-tony@atomide.com \
--to=tony@atomide.com \
--cc=andy.shevchenko@gmail.com \
--cc=cvwillegen@gmail.com \
--cc=haojian.zhuang@linaro.org \
--cc=hns@goldelico.com \
--cc=jacopo+renesas@jmondi.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=sean.wang@mediatek.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
Powered by JetHome