Skip to content

Commit f6faebc

Browse files
committed
drm/panel: panel-simple: get rid of panel_dpi hack
The empty panel_dpi struct was only ever used as a discriminant, but it's kind of a hack, and with the reworks done in the previous patches, we shouldn't need it anymore. Let's get rid of it. Reviewed-by: Javier Martinez Canillas <[email protected]> Tested-by: Francesco Dolcini <[email protected]> # Toradex Colibri iMX6 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
1 parent 47c0826 commit f6faebc

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

drivers/gpu/drm/panel/panel-simple.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,6 @@ static const struct drm_panel_funcs panel_simple_funcs = {
439439
.get_timings = panel_simple_get_timings,
440440
};
441441

442-
static struct panel_desc panel_dpi;
443-
444442
static struct panel_desc *panel_dpi_probe(struct device *dev)
445443
{
446444
struct display_timing *timing;
@@ -593,11 +591,17 @@ static const struct panel_desc *panel_simple_get_desc(struct device *dev)
593591
const struct panel_desc *desc;
594592

595593
desc = of_device_get_match_data(dev);
596-
if (!desc)
597-
return ERR_PTR(-ENODEV);
598-
599-
if (desc == &panel_dpi)
600-
return panel_dpi_probe(dev);
594+
if (!desc) {
595+
/*
596+
* panel-dpi probes without a descriptor and
597+
* panel_dpi_probe() will initialize one for us
598+
* based on the device tree.
599+
*/
600+
if (of_device_is_compatible(dev->of_node, "panel-dpi"))
601+
return panel_dpi_probe(dev);
602+
else
603+
return ERR_PTR(-ENODEV);
604+
}
601605

602606
return desc;
603607
}
@@ -651,7 +655,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
651655
return ERR_PTR(-EPROBE_DEFER);
652656
}
653657

654-
if ((desc != &panel_dpi) &&
658+
if (!of_device_is_compatible(dev->of_node, "panel-dpi") &&
655659
!of_get_display_timing(dev->of_node, "panel-timing", &dt))
656660
panel_simple_parse_panel_timing_node(dev, panel, &dt);
657661

@@ -5400,7 +5404,12 @@ static const struct of_device_id platform_of_match[] = {
54005404
}, {
54015405
/* Must be the last entry */
54025406
.compatible = "panel-dpi",
5403-
.data = &panel_dpi,
5407+
5408+
/*
5409+
* Explicitly NULL, the panel_desc structure will be
5410+
* allocated by panel_dpi_probe().
5411+
*/
5412+
.data = NULL,
54045413
}, {
54055414
/* sentinel */
54065415
}

0 commit comments

Comments
 (0)