[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Sep 2016 22:59:26 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Stefan Agner <stefan@...er.ch>
Cc: Leo Li <pku.leo@...il.com>, Gao Pan <pandy.gao@....com>,
Wolfram Sang <wsa@...-dreams.de>,
lkml <linux-kernel@...r.kernel.org>,
Li Yang <leoyang.li@....com>, linux-gpio@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v5] i2c: imx: make bus recovery through pinctrl optional
Hello,
On Fri, Sep 09, 2016 at 01:34:31PM -0700, Stefan Agner wrote:
> Yeah it is a bit a wording thing: In my understanding, pinctrl is
> required on SoC's witch have a pin controller... It is just that the
> driver does not need to get the pinctrl by itself because the stack is
> taking care of it implicitly. And yes, that makes the particular example
> not a real world example.
At first I thought, too, that it's a fatal problem if getting the
pinctrl stuff fails. IMHO that shows that the comments (or the code) are
still not good enough.
Maybe we should do something like that:
/*
* As the IP doesn't support bus recovery, we have to switch SCL and SDA
* to their GPIO function and do some bitbanging. These alternative
* pinmux settings can be described in the device tree by a separate
* pinctrl state "gpio". If this is missing this is not a big problem,
* the only implication is that we can't do bus recovery.
*/
static void i2c_imx_init_recovery_info(...)
{
...
and then put
i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev);
if (IS_ERR(i2c_imx->pinctrl))
return;
into this function (and remove it from i2c_imx_probe). This makes it
more obvious that .pinctrl is only ever used for recovery and as
i2c_imx_init_recovery_info is void there is no error to propagate.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Powered by blists - more mailing lists