Message ID | 20190804201637.1240-2-sam@ravnborg.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: panel related updates | expand |
On Sun, 2019-08-04 at 22:16 +0200, Sam Ravnborg wrote: > Replace open coded version with call to drm_panel_get_modes(). > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Andrzej Hajda <a.hajda@samsung.com> > Cc: Neil Armstrong <narmstrong@baylibre.com> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > Cc: Jonas Karlman <jonas@kwiboo.se> > Cc: Jernej Skrabec <jernej.skrabec@siol.net> > --- > drivers/gpu/drm/bridge/tc358767.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 42f03a985ac0..cebc8e620820 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -1312,7 +1312,7 @@ static int tc_connector_get_modes(struct drm_connector *connector) > { > struct tc_data *tc = connector_to_tc(connector); > struct edid *edid; > - unsigned int count; > + int count; This looks like it also fixes a potential bug ... > int ret; > > ret = tc_get_display_props(tc); > @@ -1321,11 +1321,9 @@ static int tc_connector_get_modes(struct drm_connector *connector) > return 0; > } > > - if (tc->panel && tc->panel->funcs && tc->panel->funcs->get_modes) { > - count = tc->panel->funcs->get_modes(tc->panel); > - if (count > 0) ... when .get_modes returns a negative value. > - return count; > - } > + count = drm_panel_get_modes(tc->panel); > + if (count > 0) > + return count; > > edid = drm_get_edid(connector, &tc->aux.ddc); Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp
Hi Philipp. On Mon, Aug 05, 2019 at 11:35:56AM +0200, Philipp Zabel wrote: > On Sun, 2019-08-04 at 22:16 +0200, Sam Ravnborg wrote: > > Replace open coded version with call to drm_panel_get_modes(). > > > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > > Cc: Andrzej Hajda <a.hajda@samsung.com> > > Cc: Neil Armstrong <narmstrong@baylibre.com> > > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > > Cc: Jonas Karlman <jonas@kwiboo.se> > > Cc: Jernej Skrabec <jernej.skrabec@siol.net> > > --- > > drivers/gpu/drm/bridge/tc358767.c | 10 ++++------ > > 1 file changed, 4 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > > index 42f03a985ac0..cebc8e620820 100644 > > --- a/drivers/gpu/drm/bridge/tc358767.c > > +++ b/drivers/gpu/drm/bridge/tc358767.c > > @@ -1312,7 +1312,7 @@ static int tc_connector_get_modes(struct drm_connector *connector) > > { > > struct tc_data *tc = connector_to_tc(connector); > > struct edid *edid; > > - unsigned int count; > > + int count; > > This looks like it also fixes a potential bug ... get_modes() return either 0 or number of modes. The negative return values come into play in drm_panel_get_modes() when panel for example s NULL. I will add this to changelog before I apply to avoid any misunderstanding. Sam
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 42f03a985ac0..cebc8e620820 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1312,7 +1312,7 @@ static int tc_connector_get_modes(struct drm_connector *connector) { struct tc_data *tc = connector_to_tc(connector); struct edid *edid; - unsigned int count; + int count; int ret; ret = tc_get_display_props(tc); @@ -1321,11 +1321,9 @@ static int tc_connector_get_modes(struct drm_connector *connector) return 0; } - if (tc->panel && tc->panel->funcs && tc->panel->funcs->get_modes) { - count = tc->panel->funcs->get_modes(tc->panel); - if (count > 0) - return count; - } + count = drm_panel_get_modes(tc->panel); + if (count > 0) + return count; edid = drm_get_edid(connector, &tc->aux.ddc);
Replace open coded version with call to drm_panel_get_modes(). Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andrzej Hajda <a.hajda@samsung.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Jernej Skrabec <jernej.skrabec@siol.net> --- drivers/gpu/drm/bridge/tc358767.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)