Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/imx: fix opencoded use of drm_panel_*

Use the drm_panel_get_modes() function to get the modes.

This patch leave one test for the function pointer:
panel->funcs->get_modes

This is used to check if the panel may have any modes.
There is no direct replacement.
We may be able to just check that drm_panel_get_modes() return > 0,
but as this is not the same functionality it is left for later.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://patchwork.freedesktop.org/patch/msgid/20190804201637.1240-5-sam@ravnborg.org

+8 -14
+4 -7
drivers/gpu/drm/imx/imx-ldb.c
··· 124 124 static int imx_ldb_connector_get_modes(struct drm_connector *connector) 125 125 { 126 126 struct imx_ldb_channel *imx_ldb_ch = con_to_imx_ldb_ch(connector); 127 - int num_modes = 0; 127 + int num_modes; 128 128 129 - if (imx_ldb_ch->panel && imx_ldb_ch->panel->funcs && 130 - imx_ldb_ch->panel->funcs->get_modes) { 131 - num_modes = imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel); 132 - if (num_modes > 0) 133 - return num_modes; 134 - } 129 + num_modes = drm_panel_get_modes(imx_ldb_ch->panel); 130 + if (num_modes > 0) 131 + return num_modes; 135 132 136 133 if (!imx_ldb_ch->edid && imx_ldb_ch->ddc) 137 134 imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc);
+4 -7
drivers/gpu/drm/imx/parallel-display.c
··· 47 47 { 48 48 struct imx_parallel_display *imxpd = con_to_imxpd(connector); 49 49 struct device_node *np = imxpd->dev->of_node; 50 - int num_modes = 0; 50 + int num_modes; 51 51 52 - if (imxpd->panel && imxpd->panel->funcs && 53 - imxpd->panel->funcs->get_modes) { 54 - num_modes = imxpd->panel->funcs->get_modes(imxpd->panel); 55 - if (num_modes > 0) 56 - return num_modes; 57 - } 52 + num_modes = drm_panel_get_modes(imxpd->panel); 53 + if (num_modes > 0) 54 + return num_modes; 58 55 59 56 if (imxpd->edid) { 60 57 drm_connector_update_edid_property(connector, imxpd->edid);