mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
drm/bridge: add devm_drm_put_bridge()
Bridges obtained via devm_drm_bridge_alloc(dev, ...) will be put when the requesting device (@dev) is removed. However drivers which obtained them may need to put the obtained reference explicitly. One such case is if they bind the devm removal action to a different device than the one implemented by the driver itself and which might be removed at a different time, such as bridge/panel.c. Add devm_drm_put_bridge() to manually release a devm-obtained bridge in such cases. This function is considered only a temporary workaround until the panel bridge is reworked and should be removed afterwards. Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20250509-drm-bridge-convert-to-alloc-api-v3-20-b8bc1f16d7aa@bootlin.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
parent
afb903c01b
commit
5164553d73
2 changed files with 21 additions and 0 deletions
|
@ -1392,6 +1392,23 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np)
|
||||||
EXPORT_SYMBOL(of_drm_find_bridge);
|
EXPORT_SYMBOL(of_drm_find_bridge);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* devm_drm_put_bridge - Release a bridge reference obtained via devm
|
||||||
|
* @dev: device that got the bridge via devm
|
||||||
|
* @bridge: pointer to a struct drm_bridge obtained via devm
|
||||||
|
*
|
||||||
|
* Same as drm_bridge_put() for bridge pointers obtained via devm functions
|
||||||
|
* such as devm_drm_bridge_alloc().
|
||||||
|
*
|
||||||
|
* This function is a temporary workaround and MUST NOT be used. Manual
|
||||||
|
* handling of bridge lifetime is inherently unsafe.
|
||||||
|
*/
|
||||||
|
void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge)
|
||||||
|
{
|
||||||
|
devm_release_action(dev, drm_bridge_put_void, bridge);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(devm_drm_put_bridge);
|
||||||
|
|
||||||
static void drm_bridge_debugfs_show_bridge(struct drm_printer *p,
|
static void drm_bridge_debugfs_show_bridge(struct drm_printer *p,
|
||||||
struct drm_bridge *bridge,
|
struct drm_bridge *bridge,
|
||||||
unsigned int idx)
|
unsigned int idx)
|
||||||
|
|
|
@ -1311,6 +1311,8 @@ static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev,
|
||||||
return ERR_PTR(-ENODEV);
|
return ERR_PTR(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge) {}
|
||||||
|
|
||||||
static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,
|
static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,
|
||||||
struct device_node *node,
|
struct device_node *node,
|
||||||
u32 port,
|
u32 port,
|
||||||
|
@ -1320,6 +1322,8 @@ static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge);
|
||||||
|
|
||||||
void drm_bridge_debugfs_params(struct dentry *root);
|
void drm_bridge_debugfs_params(struct dentry *root);
|
||||||
void drm_bridge_debugfs_encoder_params(struct dentry *root, struct drm_encoder *encoder);
|
void drm_bridge_debugfs_encoder_params(struct dentry *root, struct drm_encoder *encoder);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue