All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ast: Zero is missing in detect function
@ 2021-07-16  1:56 ainux.wang
  2021-07-16  6:29 ` Thomas Zimmermann
  2021-07-20  8:57 ` Thomas Zimmermann
  0 siblings, 2 replies; 4+ messages in thread
From: ainux.wang @ 2021-07-16  1:56 UTC (permalink / raw)
  To: airlied, tzimmermann, airlied, daniel, ainux.wang
  Cc: sterlingteng, chenhuacai, dri-devel

From: "Ainux.Wang" <ainux.wang@gmail.com>

The function ast_get_modes() will also return 0, when it try to get the
edid, but it also do not get the edid.

Signed-off-by: Ainux.Wang <ainux.wang@gmail.com>
---
 drivers/gpu/drm/ast/ast_mode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index e5996ae03c49..b7dcf7821ec6 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
 	int r;
 
 	r = ast_get_modes(connector);
-	if (r < 0)
+	if (r <= 0)
 		return connector_status_disconnected;
 
 	return connector_status_connected;
-- 
2.18.1


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

* Re: [PATCH] drm/ast: Zero is missing in detect function
  2021-07-16  1:56 [PATCH] drm/ast: Zero is missing in detect function ainux.wang
@ 2021-07-16  6:29 ` Thomas Zimmermann
  2021-07-16  9:45   ` Ainux Wang
  2021-07-20  8:57 ` Thomas Zimmermann
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Zimmermann @ 2021-07-16  6:29 UTC (permalink / raw)
  To: ainux.wang, airlied, airlied, daniel; +Cc: sterlingteng, chenhuacai, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1530 bytes --]

Hi

Am 16.07.21 um 03:56 schrieb ainux.wang@gmail.com:
> From: "Ainux.Wang" <ainux.wang@gmail.com>
> 
> The function ast_get_modes() will also return 0, when it try to get the
> edid, but it also do not get the edid.
> 
> Signed-off-by: Ainux.Wang <ainux.wang@gmail.com>
> ---
>   drivers/gpu/drm/ast/ast_mode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index e5996ae03c49..b7dcf7821ec6 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
>   	int r;
>   
>   	r = ast_get_modes(connector);
> -	if (r < 0)
> +	if (r <= 0)
>   		return connector_status_disconnected;

Thanks for caring.

I thought about the case of (r == 0) when reviewing the patch that added 
it, but found it to be correct. If (r < 0) it's clearly an error and we 
should return 'disconnected'. If (r == 0), we were able to retrieve the 
EDID, but could not find any meaningful modes. Still, it's 'connected'.

Unless there is a concrete bug where the status is mis-detected, I think 
that the current code is correct.

Best regards
Thomas

>   
>   	return connector_status_connected;
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH] drm/ast: Zero is missing in detect function
  2021-07-16  6:29 ` Thomas Zimmermann
@ 2021-07-16  9:45   ` Ainux Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Ainux Wang @ 2021-07-16  9:45 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: airlied, teng sterling, Huacai Chen, dri-devel, airlied

Thomas Zimmermann <tzimmermann@suse.de> 于2021年7月16日周五 下午2:29写道:
>
> Hi
>
> Am 16.07.21 um 03:56 schrieb ainux.wang@gmail.com:
> > From: "Ainux.Wang" <ainux.wang@gmail.com>
> >
> > The function ast_get_modes() will also return 0, when it try to get the
> > edid, but it also do not get the edid.
> >
> > Signed-off-by: Ainux.Wang <ainux.wang@gmail.com>
> > ---
> >   drivers/gpu/drm/ast/ast_mode.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> > index e5996ae03c49..b7dcf7821ec6 100644
> > --- a/drivers/gpu/drm/ast/ast_mode.c
> > +++ b/drivers/gpu/drm/ast/ast_mode.c
> > @@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
> >       int r;
> >
> >       r = ast_get_modes(connector);
> > -     if (r < 0)
> > +     if (r <= 0)
> >               return connector_status_disconnected;
>
> Thanks for caring.
>
> I thought about the case of (r == 0) when reviewing the patch that added
> it, but found it to be correct. If (r < 0) it's clearly an error and we
> should return 'disconnected'. If (r == 0), we were able to retrieve the
> EDID, but could not find any meaningful modes. Still, it's 'connected'.
>
Hi,Thomas
Thanks review.
I see, the drm_add_edid_modes() will retrun0 in ast_get_modes().
Best regards,
Ainux Wang.
> Unless there is a concrete bug where the status is mis-detected, I think
> that the current code is correct.
>
> Best regards
> Thomas
>
> >
> >       return connector_status_connected;
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>

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

* Re: [PATCH] drm/ast: Zero is missing in detect function
  2021-07-16  1:56 [PATCH] drm/ast: Zero is missing in detect function ainux.wang
  2021-07-16  6:29 ` Thomas Zimmermann
@ 2021-07-20  8:57 ` Thomas Zimmermann
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Zimmermann @ 2021-07-20  8:57 UTC (permalink / raw)
  To: ainux.wang, airlied, airlied, daniel; +Cc: sterlingteng, chenhuacai, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1244 bytes --]

Hi

Am 16.07.21 um 03:56 schrieb ainux.wang@gmail.com:
> From: "Ainux.Wang" <ainux.wang@gmail.com>
> 
> The function ast_get_modes() will also return 0, when it try to get the
> edid, but it also do not get the edid.
> 
> Signed-off-by: Ainux.Wang <ainux.wang@gmail.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

after the issue has been discussed a bit. I'll merge the patch into 
drm-misc-next soon.

Best regards
Thomas

> ---
>   drivers/gpu/drm/ast/ast_mode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index e5996ae03c49..b7dcf7821ec6 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -1299,7 +1299,7 @@ static enum drm_connector_status ast_connector_detect(struct drm_connector
>   	int r;
>   
>   	r = ast_get_modes(connector);
> -	if (r < 0)
> +	if (r <= 0)
>   		return connector_status_disconnected;
>   
>   	return connector_status_connected;
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

end of thread, other threads:[~2021-07-20  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16  1:56 [PATCH] drm/ast: Zero is missing in detect function ainux.wang
2021-07-16  6:29 ` Thomas Zimmermann
2021-07-16  9:45   ` Ainux Wang
2021-07-20  8:57 ` Thomas Zimmermann

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.