Commit f35a2a99 authored by Philipp Zabel's avatar Philipp Zabel

drm/encoder: make encoder control functions optional

Simple managed encoders do not require the .destroy callback,
make the whole funcs structure optional.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c2d789fb
...@@ -72,7 +72,7 @@ int drm_encoder_register_all(struct drm_device *dev) ...@@ -72,7 +72,7 @@ int drm_encoder_register_all(struct drm_device *dev)
int ret = 0; int ret = 0;
drm_for_each_encoder(encoder, dev) { drm_for_each_encoder(encoder, dev) {
if (encoder->funcs->late_register) if (encoder->funcs && encoder->funcs->late_register)
ret = encoder->funcs->late_register(encoder); ret = encoder->funcs->late_register(encoder);
if (ret) if (ret)
return ret; return ret;
...@@ -86,7 +86,7 @@ void drm_encoder_unregister_all(struct drm_device *dev) ...@@ -86,7 +86,7 @@ void drm_encoder_unregister_all(struct drm_device *dev)
struct drm_encoder *encoder; struct drm_encoder *encoder;
drm_for_each_encoder(encoder, dev) { drm_for_each_encoder(encoder, dev) {
if (encoder->funcs->early_unregister) if (encoder->funcs && encoder->funcs->early_unregister)
encoder->funcs->early_unregister(encoder); encoder->funcs->early_unregister(encoder);
} }
} }
......
...@@ -195,7 +195,7 @@ void drm_mode_config_reset(struct drm_device *dev) ...@@ -195,7 +195,7 @@ void drm_mode_config_reset(struct drm_device *dev)
crtc->funcs->reset(crtc); crtc->funcs->reset(crtc);
drm_for_each_encoder(encoder, dev) drm_for_each_encoder(encoder, dev)
if (encoder->funcs->reset) if (encoder->funcs && encoder->funcs->reset)
encoder->funcs->reset(encoder); encoder->funcs->reset(encoder);
drm_connector_list_iter_begin(dev, &conn_iter); drm_connector_list_iter_begin(dev, &conn_iter);
......
...@@ -89,7 +89,7 @@ struct drm_encoder_funcs { ...@@ -89,7 +89,7 @@ struct drm_encoder_funcs {
* @head: list management * @head: list management
* @base: base KMS object * @base: base KMS object
* @name: human readable name, can be overwritten by the driver * @name: human readable name, can be overwritten by the driver
* @funcs: control functions * @funcs: control functions, can be NULL for simple managed encoders
* @helper_private: mid-layer private data * @helper_private: mid-layer private data
* *
* CRTCs drive pixels to encoders, which convert them into signals * CRTCs drive pixels to encoders, which convert them into signals
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment