Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 362940f8 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Greg Kroah-Hartman
Browse files

drm/panel: Initialise panel dev and funcs through drm_panel_init()



[ Upstream commit 6dbe0c4b0fc0646442b2b1580d022404e582fd7b ]

Instead of requiring all drivers to set the dev and funcs fields of
drm_panel manually after calling drm_panel_init(), pass the data as
arguments to the function. This simplifies the panel drivers, and will
help future refactoring when adding new arguments to drm_panel_init().

The panel drivers have been updated with the following Coccinelle
semantic patch, with manual inspection to verify that no call to
drm_panel_init() with a single argument still exists.

@@
expression panel;
expression device;
identifier ops;
@@
 drm_panel_init(&panel
+	, device, &ops
 );
 ...
(
-panel.dev = device;
-panel.funcs = &ops;
|
-panel.funcs = &ops;
-panel.dev = device;
)

Suggested-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190823193245.23876-3-laurent.pinchart@ideasonboard.com


Stable-dep-of: 2c56a751845d ("drm/panel: simple: Add connector_type for innolux_at043tn24")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6d5172a3
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -44,13 +44,18 @@ static LIST_HEAD(panel_list);
/**
 * drm_panel_init - initialize a panel
 * @panel: DRM panel
 * @dev: parent device of the panel
 * @funcs: panel operations
 *
 * Sets up internal fields of the panel so that it can subsequently be added
 * to the registry.
 * Initialize the panel structure for subsequent registration with
 * drm_panel_add().
 */
void drm_panel_init(struct drm_panel *panel)
void drm_panel_init(struct drm_panel *panel, struct device *dev,
		    const struct drm_panel_funcs *funcs)
{
	INIT_LIST_HEAD(&panel->list);
	panel->dev = dev;
	panel->funcs = funcs;
}
EXPORT_SYMBOL(drm_panel_init);

+1 −3
Original line number Diff line number Diff line
@@ -350,9 +350,7 @@ static int versatile_panel_probe(struct platform_device *pdev)
			dev_info(dev, "panel mounted on IB2 daughterboard\n");
	}

	drm_panel_init(&vpanel->panel);
	vpanel->panel.dev = dev;
	vpanel->panel.funcs = &versatile_panel_drm_funcs;
	drm_panel_init(&vpanel->panel, dev, &versatile_panel_drm_funcs);

	return drm_panel_add(&vpanel->panel);
}
+1 −3
Original line number Diff line number Diff line
@@ -204,9 +204,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
	mipi_dsi_set_drvdata(dsi, ctx);
	ctx->dsi = dsi;

	drm_panel_init(&ctx->panel);
	ctx->panel.dev = &dsi->dev;
	ctx->panel.funcs = &feiyang_funcs;
	drm_panel_init(&ctx->panel, &dsi->dev, &feiyang_funcs);

	ctx->dvdd = devm_regulator_get(&dsi->dev, "dvdd");
	if (IS_ERR(ctx->dvdd)) {
+1 −3
Original line number Diff line number Diff line
@@ -895,9 +895,7 @@ static int ili9322_probe(struct spi_device *spi)
		ili->input = ili->conf->input;
	}

	drm_panel_init(&ili->panel);
	ili->panel.dev = dev;
	ili->panel.funcs = &ili9322_drm_funcs;
	drm_panel_init(&ili->panel, dev, &ili9322_drm_funcs);

	return drm_panel_add(&ili->panel);
}
+1 −3
Original line number Diff line number Diff line
@@ -433,9 +433,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
	mipi_dsi_set_drvdata(dsi, ctx);
	ctx->dsi = dsi;

	drm_panel_init(&ctx->panel);
	ctx->panel.dev = &dsi->dev;
	ctx->panel.funcs = &ili9881c_funcs;
	drm_panel_init(&ctx->panel, &dsi->dev, &ili9881c_funcs);

	ctx->power = devm_regulator_get(&dsi->dev, "power");
	if (IS_ERR(ctx->power)) {
Loading