drm: small cleanups and improvements
Subsystems (4)
Luca Ceresoli
reviewerv7 cover drm: small cleanups and improvements
This series collects some minor improvements and fixes previously part of [0], hence the "v7" version number.
All of these patches already have some Review/Ack tags.
[0] https://lore.kernel.org/dri-devel/[email protected]/
---
Luca Ceresoli (5):
drm/debugfs: fix printk format for bridge index
drm: of: drm_of_find_panel_or_bridge: move misplaced comment drm/bridge: panel: use drm_bridge_is_panel() instead of open code drm/bridge: panel: drm_panel_bridge_remove: warn when called on non-panel bridge drm/bridge: panel: forbid initializing a panel with unknown connector type
drivers/gpu/drm/bridge/panel.c | 4 +++- drivers/gpu/drm/drm_debugfs.c | 2 +- drivers/gpu/drm/drm_of.c | 2 +- drivers/gpu/drm/drm_panel.c | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-)
---
base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250214-drm-assorted-cleanups-dd6d8e1b4a8a
Best regards,
Signature · 1 line
Luca Ceresoli <[email protected]>
Luca Ceresoli
reviewerPATCH v7 1/5 drm/debugfs: fix printk format for bridge index
idx is an unsigned int, use %u for printk-style strings.
---
Changes in v7: none
This patch was added in v6.
--- drivers/gpu/drm/drm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_debugfs.c +1 -1
@@ -748,7 +748,7 @@ static int bridges_show(struct seq_file *m, void *data)unsigned int idx =0 ;drm_for_each_bridge_in_chain (encoder, bridge) { -drm_printf (&p,"bridge[%d]: %ps\n" , idx++, bridge->funcs); +drm_printf (&p,"bridge[%u]: %ps\n" , idx++, bridge->funcs);drm_printf (&p,"\ttype: [%d] %s\n" , bridge->type,drm_get_connector_type_name (bridge->type));
Signature · 1 line
2.48.1
Luca Ceresoli
reviewerPATCH v7 2/5 drm: of: drm_of_find_panel_or_bridge: move misplaced comment
In reply to Luca CeresoliThis comment is misleading as it refers to one of the inner if() branches only, not the whole outer if(). Move it to the branch it refers to.
---
Changes in v7: none
This patch was added in v6.
--- drivers/gpu/drm/drm_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_of.c +1 -1
@@ -268,9 +268,9 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, *panel =NULL ; } -/* No panel found yet, check for a bridge next. */ if (bridge) {if (ret) { +/* No panel found yet, check for a bridge next. */ *bridge =of_drm_find_bridge (remote);if (*bridge) ret =0 ;
Signature · 1 line
2.48.1
Luca Ceresoli
reviewerPATCH v7 3/5 drm/bridge: panel: use drm_bridge_is_panel() instead of open code
In reply to Luca Ceresolidrm_panel_bridge_remove() reads bridge->funcs to find out whether this is a panel bridge or another kind of bridge. drm_bridge_is_panel() is made exactly for that, so use it.
---
Changes in v7: none
This patch was added in v6.
--- drivers/gpu/drm/bridge/panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/panel.c +1 -1
@@ -322,7 +322,7 @@ void drm_panel_bridge_remove(struct drm_bridge *bridge)if (!bridge)return ; -if (bridge->funcs != &panel_bridge_bridge_funcs) +if (!drm_bridge_is_panel (bridge))return ; panel_bridge =drm_bridge_to_panel_bridge (bridge);
Signature · 1 line
2.48.1
Luca Ceresoli
reviewerPATCH v7 4/5 drm/bridge: panel: drm_panel_bridge_remove: warn when called on non-panel bridge
In reply to Luca CeresoliThis function is for panel_bridge instances only. The silent return when invoked on other bridges might hide actual errors, so avoid them to go unnoticed.
---
Changes in v7: none
This patch was added in v6.
--- drivers/gpu/drm/bridge/panel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/panel.c +3 -1
@@ -322,8 +322,10 @@ void drm_panel_bridge_remove(struct drm_bridge *bridge)if (!bridge)return ; -if (!drm_bridge_is_panel (bridge)) +if (!drm_bridge_is_panel (bridge)) { +drm_warn (bridge->dev,"%s: called on non-panel bridge!\n" , __func__);return ; + } panel_bridge =drm_bridge_to_panel_bridge (bridge);
Signature · 1 line
2.48.1
Luca Ceresoli
reviewerPATCH v7 5/5 drm/bridge: panel: forbid initializing a panel with unknown connector type
In reply to Luca CeresoliHaving an DRM_MODE_CONNECTOR_Unknown connector type is considered bad, and drm_panel_bridge_add_typed() and derivatives are deprecated for this.
drm_panel_init() won't prevent initializing a panel with a DRM_MODE_CONNECTOR_Unknown connector type. Luckily there are no in-tree users doing it, so take this as an opportinuty to document a valid connector type must be passed.
Returning an error if this rule is violated is not possible because drm_panel_init() is a void function. Add at least a warning to make any violations noticeable, especially to non-upstream drivers.
---
Changed in v7:
- fix typo in commit message
- rebased on v6 (applies to drm_panel, not bridge/panel.c)
This patch was added in v6.
--- drivers/gpu/drm/drm_panel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_panel.c +4 -1
@@ -50,7 +50,7 @@ static LIST_HEAD(panel_list);* @dev: parent device of the panel * @funcs: panel operations * @connector_type: the connector type (DRM_MODE_CONNECTOR_*) corresponding to -* the panel interface +* the panel interface (must NOT be DRM_MODE_CONNECTOR_Unknown) * * Initialize the panel structure for subsequent registration with * drm_panel_add().
@@ -58,6 +58,9 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel,struct device *dev,const struct drm_panel_funcs *funcs,int connector_type) { +if (connector_type == DRM_MODE_CONNECTOR_Unknown) +DRM_WARN ("%s: %s: a valid connector type is required!\n" , __func__,dev_name (dev)); +INIT_LIST_HEAD (&panel->list);INIT_LIST_HEAD (&panel->followers);mutex_init (&panel->follower_lock);
Signature · 1 line
2.48.1
Quoted 8 lines · Luca Ceresoli
This series collects some minor improvements and fixes previously part of [0], hence the "v7" version number.
All of these patches already have some Review/Ack tags.
[0] https://lore.kernel.org/dri-devel/[email protected]/
[...]
Applied, thanks!
[1/5] drm/debugfs: fix printk format for bridge index
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/72443c730b7a [2/5] drm: of: drm_of_find_panel_or_bridge: move misplaced comment https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/9d60cf4e8cf7 [3/5] drm/bridge: panel: use drm_bridge_is_panel() instead of open code https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/cc46371e3d32 [4/5] drm/bridge: panel: drm_panel_bridge_remove: warn when called on non-panel bridge https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/77053ef7207a [5/5] drm/bridge: panel: forbid initializing a panel with unknown connector type https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/b296955b3a74
Rob