Commit d052db11 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: mux: demux-pinctrl: make drivers with no pinctrl work again

Some drivers like i2c-gpio do not have dedicated pinctrl states. They
broke when error checking for pinctrl was added. Detect them now, and in
their case, simply skip over pinctrl configuration.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent bc33b0ca
...@@ -69,9 +69,27 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne ...@@ -69,9 +69,27 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne
goto err_with_revert; goto err_with_revert;
} }
p = devm_pinctrl_get_select(adap->dev.parent, priv->bus_name); /*
* Check if there are pinctrl states at all. Note: we cant' use
* devm_pinctrl_get_select() because we need to distinguish between
* the -ENODEV from devm_pinctrl_get() and pinctrl_lookup_state().
*/
p = devm_pinctrl_get(adap->dev.parent);
if (IS_ERR(p)) { if (IS_ERR(p)) {
ret = PTR_ERR(p); ret = PTR_ERR(p);
/* continue if just no pinctrl states (e.g. i2c-gpio), otherwise exit */
if (ret != -ENODEV)
goto err_with_put;
} else {
/* there are states. check and use them */
struct pinctrl_state *s = pinctrl_lookup_state(p, priv->bus_name);
if (IS_ERR(s)) {
ret = PTR_ERR(s);
goto err_with_put;
}
ret = pinctrl_select_state(p, s);
if (ret < 0)
goto err_with_put; goto err_with_put;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment