From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55722 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbcKIGKr (ORCPT ); Wed, 9 Nov 2016 01:10:47 -0500 Date: Wed, 9 Nov 2016 07:10:54 +0100 From: Greg KH To: Stefan Agner Cc: stable@vger.kernel.org, Wolfram Sang , stable@kernel.org Subject: Re: [PATCH] i2c: imx: defer probe if bus recovery GPIOs are not ready Message-ID: <20161109061054.GA2739@kroah.com> References: <20161109003239.16940-1-stefan@agner.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161109003239.16940-1-stefan@agner.ch> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Nov 08, 2016 at 04:32:39PM -0800, Stefan Agner wrote: > commit 533169d164c6b4c8571d0d48779f6ff6be593d72 upstream. > > Some SoC might load the GPIO driver after the I2C driver and > using the I2C bus recovery mechanism via GPIOs. In this case > it is crucial to defer probing if the GPIO request functions > do so, otherwise the I2C driver gets loaded without recovery > mechanisms enabled. > > Signed-off-by: Stefan Agner > Acked-by: Uwe Kleine-K�nig > Acked-by: Li Yang > Signed-off-by: Wolfram Sang > Cc: stable@kernel.org > --- > drivers/i2c/busses/i2c-imx.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index d4d8536..32fae2c 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -1002,10 +1002,13 @@ static void i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx, > rinfo->scl_gpio = of_get_named_gpio_flags(pdev->dev.of_node, > "scl-gpios", 0, NULL); > > - if (!gpio_is_valid(rinfo->sda_gpio) || > - !gpio_is_valid(rinfo->scl_gpio) || > - IS_ERR(i2c_imx->pinctrl_pins_default) || > - IS_ERR(i2c_imx->pinctrl_pins_gpio)) { > + if (rinfo->sda_gpio == -EPROBE_DEFER || > + rinfo->scl_gpio == -EPROBE_DEFER) { > + return -EPROBE_DEFER; Ok, but... > + } else if (!gpio_is_valid(rinfo->sda_gpio) || > + !gpio_is_valid(rinfo->scl_gpio) || > + IS_ERR(i2c_imx->pinctrl_pins_default) || > + IS_ERR(i2c_imx->pinctrl_pins_gpio)) { > dev_dbg(&pdev->dev, "recovery information incomplete\n"); > return; Hm. I don't think you built this patch :( Same goes for 4.8-stable... greg k-h