Message ID | 1500435259-5838-1-git-send-email-festevam@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Jul 19, 2017 at 12:34:18AM -0300, Fabio Estevam wrote: > From: Fabio Estevam <fabio.estevam@nxp.com> > > When devm_clk_get() fails the real error code should be propagated, > instead of always returning -EPROBE_DEFER. > > Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Hi Fabio, I don't think -EPROBE_DEFER is returned by clk_get() if the clock can't be found. The clock providers often are e.g. ISP drivers that may well be loaded after the sensor driver. In that case this change would prevent successful initialisation of the drivers. > --- > drivers/media/i2c/ov7670.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c > index 7270c68..552a881 100644 > --- a/drivers/media/i2c/ov7670.c > +++ b/drivers/media/i2c/ov7670.c > @@ -1614,7 +1614,7 @@ static int ov7670_probe(struct i2c_client *client, > > info->clk = devm_clk_get(&client->dev, "xclk"); > if (IS_ERR(info->clk)) > - return -EPROBE_DEFER; > + return PTR_ERR(info->clk); > clk_prepare_enable(info->clk); > > ret = ov7670_init_gpio(client, info); > -- > 2.7.4 >
Hi Sakari, On Tue, Aug 8, 2017 at 8:24 AM, Sakari Ailus <sakari.ailus@iki.fi> wrote: > I don't think -EPROBE_DEFER is returned by clk_get() if the clock can't be > found. The clock providers often are e.g. ISP drivers that may well be Yes, it is. Please check: commit a34cd4666f3da84228a82f70c94b8d9b692034ea Author: Jean-Francois Moine <moinejf@free.fr> Date: Mon Nov 25 19:47:04 2013 +0100 clk: return probe defer when DT clock not yet ready At probe time, a clock device may not be ready when some other device wants to use it. This patch lets the functions clk_get/devm_clk_get return a probe defer when the clock is defined in the DT but not yet available. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
On Tue, Aug 08, 2017 at 08:56:14AM -0300, Fabio Estevam wrote: > Hi Sakari, > > On Tue, Aug 8, 2017 at 8:24 AM, Sakari Ailus <sakari.ailus@iki.fi> wrote: > > > I don't think -EPROBE_DEFER is returned by clk_get() if the clock can't be > > found. The clock providers often are e.g. ISP drivers that may well be > > Yes, it is. > > Please check: > > commit a34cd4666f3da84228a82f70c94b8d9b692034ea > Author: Jean-Francois Moine <moinejf@free.fr> > Date: Mon Nov 25 19:47:04 2013 +0100 > > clk: return probe defer when DT clock not yet ready > > At probe time, a clock device may not be ready when some other device > wants to use it. > > This patch lets the functions clk_get/devm_clk_get return a probe defer > when the clock is defined in the DT but not yet available. Nice! I'll apply both then. Thanks!
diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c index 7270c68..552a881 100644 --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -1614,7 +1614,7 @@ static int ov7670_probe(struct i2c_client *client, info->clk = devm_clk_get(&client->dev, "xclk"); if (IS_ERR(info->clk)) - return -EPROBE_DEFER; + return PTR_ERR(info->clk); clk_prepare_enable(info->clk); ret = ov7670_init_gpio(client, info);