All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sc16is7xx: Defer probe if device read fails
       [not found] <20210329154013.408967-1-nh6z@nh6z.net>
@ 2021-03-29 15:40 ` Annaliese McDermond
  2021-03-29 18:18   ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Annaliese McDermond @ 2021-03-29 15:40 UTC (permalink / raw)
  To: linux-serial; +Cc: Annaliese McDermond, team, stable

A test was added to the probe function to ensure the device was
actually connected and working before successfully completing a
probe.  If the device was actually there, but the I2C bus was not
ready yet for whatever reason, the probe fails permanently.

Change the probe so that we defer the probe on a regmap read
failure so that we try the probe again when the dependent drivers
are potentially loaded.  This should not affect the case where the
device truly isn't present because the probe will never successfully
complete.

Fixes: 2aa916e ("sc16is7xx: Read the LSR register for basic device presence check")
Cc: stable@vger.kernel.org
Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index f86ec2d2635b..9adb8362578c 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1196,7 +1196,7 @@ static int sc16is7xx_probe(struct device *dev,
 	ret = regmap_read(regmap,
 			  SC16IS7XX_LSR_REG << SC16IS7XX_REG_SHIFT, &val);
 	if (ret < 0)
-		return ret;
+		return -EPROBE_DEFER;
 
 	/* Alloc port structure */
 	s = devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sc16is7xx: Defer probe if device read fails
  2021-03-29 15:40 ` [PATCH] sc16is7xx: Defer probe if device read fails Annaliese McDermond
@ 2021-03-29 18:18   ` Greg KH
       [not found]     ` <D3421B6F-AD12-4B5E-AF02-9EFF80E79473@nh6z.net>
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2021-03-29 18:18 UTC (permalink / raw)
  To: Annaliese McDermond; +Cc: linux-serial, team, stable

On Mon, Mar 29, 2021 at 03:40:35PM +0000, Annaliese McDermond wrote:
> A test was added to the probe function to ensure the device was
> actually connected and working before successfully completing a
> probe.  If the device was actually there, but the I2C bus was not
> ready yet for whatever reason, the probe fails permanently.
> 
> Change the probe so that we defer the probe on a regmap read
> failure so that we try the probe again when the dependent drivers
> are potentially loaded.  This should not affect the case where the
> device truly isn't present because the probe will never successfully
> complete.
> 
> Fixes: 2aa916e ("sc16is7xx: Read the LSR register for basic device presence check")

Please use the full 12 characters of the git commit id, as the
documentation asks for.  This should be:

Fixes: 2aa916e67db3 ("sc16is7xx: Read the LSR register for basic device presence check")

> Cc: stable@vger.kernel.org
> Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
> ---
>  drivers/tty/serial/sc16is7xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index f86ec2d2635b..9adb8362578c 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -1196,7 +1196,7 @@ static int sc16is7xx_probe(struct device *dev,
>  	ret = regmap_read(regmap,
>  			  SC16IS7XX_LSR_REG << SC16IS7XX_REG_SHIFT, &val);
>  	if (ret < 0)
> -		return ret;
> +		return -EPROBE_DEFER;
>  
>  	/* Alloc port structure */
>  	s = devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL);
> -- 
> 2.27.0

Any reason you did not cc: the tty maintainer with this change?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sc16is7xx: Defer probe if device read fails
       [not found]     ` <D3421B6F-AD12-4B5E-AF02-9EFF80E79473@nh6z.net>
@ 2021-03-29 18:35       ` Annaliese McDermond
  2021-03-29 18:59         ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Annaliese McDermond @ 2021-03-29 18:35 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-serial, team, stable



> On Mar 29, 2021, at 11:18 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> 
> On Mon, Mar 29, 2021 at 03:40:35PM +0000, Annaliese McDermond wrote:
>> A test was added to the probe function to ensure the device was
>> actually connected and working before successfully completing a
>> probe.  If the device was actually there, but the I2C bus was not
>> ready yet for whatever reason, the probe fails permanently.
>> 
>> Change the probe so that we defer the probe on a regmap read
>> failure so that we try the probe again when the dependent drivers
>> are potentially loaded.  This should not affect the case where the
>> device truly isn't present because the probe will never successfully
>> complete.
>> 
>> Fixes: 2aa916e ("sc16is7xx: Read the LSR register for basic device presence check")
> 
> Please use the full 12 characters of the git commit id, as the
> documentation asks for.  This should be:
> 
> Fixes: 2aa916e67db3 ("sc16is7xx: Read the LSR register for basic device presence check")

I’m sorry, I must have missed the section specifying that, and since I saw commits like
05962f95f9ac specifying 7 characters in their “fixes” line, I made the assumption that
this was the correct length.

Would you like me to post a v2 patch with the hash changed?

>> Cc: stable@vger.kernel.org
>> Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
>> ---
>> drivers/tty/serial/sc16is7xx.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
>> index f86ec2d2635b..9adb8362578c 100644
>> --- a/drivers/tty/serial/sc16is7xx.c
>> +++ b/drivers/tty/serial/sc16is7xx.c
>> @@ -1196,7 +1196,7 @@ static int sc16is7xx_probe(struct device *dev,
>> 	ret = regmap_read(regmap,
>> 			  SC16IS7XX_LSR_REG << SC16IS7XX_REG_SHIFT, &val);
>> 	if (ret < 0)
>> -		return ret;
>> +		return -EPROBE_DEFER;
>> 
>> 	/* Alloc port structure */
>> 	s = devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL);
>> -- 
>> 2.27.0
> 
> Any reason you did not cc: the tty maintainer with this change?

None other than I believed “serial drivers” to be more specific than “tty layer” when
looking at the maintainers.  I’m happy to Cc Jiri if needed.

> 
> thanks,
> 
> greg k-h

-- Anna

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sc16is7xx: Defer probe if device read fails
  2021-03-29 18:35       ` Annaliese McDermond
@ 2021-03-29 18:59         ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2021-03-29 18:59 UTC (permalink / raw)
  To: Annaliese McDermond; +Cc: linux-serial, team, stable

On Mon, Mar 29, 2021 at 06:35:38PM +0000, Annaliese McDermond wrote:
> 
> 
> > On Mar 29, 2021, at 11:18 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > 
> > On Mon, Mar 29, 2021 at 03:40:35PM +0000, Annaliese McDermond wrote:
> >> A test was added to the probe function to ensure the device was
> >> actually connected and working before successfully completing a
> >> probe.  If the device was actually there, but the I2C bus was not
> >> ready yet for whatever reason, the probe fails permanently.
> >> 
> >> Change the probe so that we defer the probe on a regmap read
> >> failure so that we try the probe again when the dependent drivers
> >> are potentially loaded.  This should not affect the case where the
> >> device truly isn't present because the probe will never successfully
> >> complete.
> >> 
> >> Fixes: 2aa916e ("sc16is7xx: Read the LSR register for basic device presence check")
> > 
> > Please use the full 12 characters of the git commit id, as the
> > documentation asks for.  This should be:
> > 
> > Fixes: 2aa916e67db3 ("sc16is7xx: Read the LSR register for basic device presence check")
> 
> I’m sorry, I must have missed the section specifying that, and since I saw commits like
> 05962f95f9ac specifying 7 characters in their “fixes” line, I made the assumption that
> this was the correct length.
> 
> Would you like me to post a v2 patch with the hash changed?

Please do.

> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
> >> ---
> >> drivers/tty/serial/sc16is7xx.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> >> index f86ec2d2635b..9adb8362578c 100644
> >> --- a/drivers/tty/serial/sc16is7xx.c
> >> +++ b/drivers/tty/serial/sc16is7xx.c
> >> @@ -1196,7 +1196,7 @@ static int sc16is7xx_probe(struct device *dev,
> >> 	ret = regmap_read(regmap,
> >> 			  SC16IS7XX_LSR_REG << SC16IS7XX_REG_SHIFT, &val);
> >> 	if (ret < 0)
> >> -		return ret;
> >> +		return -EPROBE_DEFER;
> >> 
> >> 	/* Alloc port structure */
> >> 	s = devm_kzalloc(dev, struct_size(s, p, devtype->nr_uart), GFP_KERNEL);
> >> -- 
> >> 2.27.0
> > 
> > Any reason you did not cc: the tty maintainer with this change?
> 
> None other than I believed “serial drivers” to be more specific than “tty layer” when
> looking at the maintainers.  I’m happy to Cc Jiri if needed.

The tool, scripts/get_maintainer.pl is your friend, always run it on
your patch.

You also forgot to send it to me :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-29 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210329154013.408967-1-nh6z@nh6z.net>
2021-03-29 15:40 ` [PATCH] sc16is7xx: Defer probe if device read fails Annaliese McDermond
2021-03-29 18:18   ` Greg KH
     [not found]     ` <D3421B6F-AD12-4B5E-AF02-9EFF80E79473@nh6z.net>
2021-03-29 18:35       ` Annaliese McDermond
2021-03-29 18:59         ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.