Commit b07b90fd authored by Ajay Kumar's avatar Ajay Kumar Committed by Thierry Reding

drm/bridge: do not pass drm_bridge_funcs to drm_bridge_init

Assign the pointer to bridge ops structure(drm_bridge_funcs) in
the bridge driver itself, instead of passing it to drm_bridge_init.

This will allow bridge driver developer to pack bridge private
information inside the bridge object and pass only the drm-relevant
information to drm_bridge_init.
Signed-off-by: default avatarAjay Kumar <ajaykumar.rs@samsung.com>
Acked-by: default avatarInki Dae <inki.dae@samsung.com>
Tested-by: default avatarRahul Sharma <rahul.sharma@samsung.com>
Tested-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Tested-by: default avatarSjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 94d50d57
...@@ -313,7 +313,8 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, ...@@ -313,7 +313,8 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
goto err; goto err;
} }
ret = drm_bridge_init(dev, &ptn_bridge->bridge, &ptn3460_bridge_funcs); ptn_bridge->bridge.funcs = &ptn3460_bridge_funcs;
ret = drm_bridge_init(dev, &ptn_bridge->bridge);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize bridge with drm\n"); DRM_ERROR("Failed to initialize bridge with drm\n");
goto err; goto err;
......
...@@ -1069,7 +1069,6 @@ EXPORT_SYMBOL(drm_connector_unplug_all); ...@@ -1069,7 +1069,6 @@ EXPORT_SYMBOL(drm_connector_unplug_all);
* drm_bridge_init - initialize a drm transcoder/bridge * drm_bridge_init - initialize a drm transcoder/bridge
* @dev: drm device * @dev: drm device
* @bridge: transcoder/bridge to set up * @bridge: transcoder/bridge to set up
* @funcs: bridge function table
* *
* Initialises a preallocated bridge. Bridges should be * Initialises a preallocated bridge. Bridges should be
* subclassed as part of driver connector objects. * subclassed as part of driver connector objects.
...@@ -1077,8 +1076,7 @@ EXPORT_SYMBOL(drm_connector_unplug_all); ...@@ -1077,8 +1076,7 @@ EXPORT_SYMBOL(drm_connector_unplug_all);
* Returns: * Returns:
* Zero on success, error code on failure. * Zero on success, error code on failure.
*/ */
int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge)
const struct drm_bridge_funcs *funcs)
{ {
int ret; int ret;
...@@ -1089,7 +1087,6 @@ int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, ...@@ -1089,7 +1087,6 @@ int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
goto out; goto out;
bridge->dev = dev; bridge->dev = dev;
bridge->funcs = funcs;
list_add_tail(&bridge->head, &dev->mode_config.bridge_list); list_add_tail(&bridge->head, &dev->mode_config.bridge_list);
dev->mode_config.num_bridge++; dev->mode_config.num_bridge++;
......
...@@ -220,8 +220,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi) ...@@ -220,8 +220,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
hdmi_bridge->hdmi = hdmi; hdmi_bridge->hdmi = hdmi;
bridge = &hdmi_bridge->base; bridge = &hdmi_bridge->base;
bridge->funcs = &hdmi_bridge_funcs;
drm_bridge_init(hdmi->dev, bridge, &hdmi_bridge_funcs); drm_bridge_init(hdmi->dev, bridge);
return bridge; return bridge;
......
...@@ -664,7 +664,8 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) ...@@ -664,7 +664,8 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
return -ENOMEM; return -ENOMEM;
bridge->driver_private = hda; bridge->driver_private = hda;
drm_bridge_init(drm_dev, bridge, &sti_hda_bridge_funcs); bridge->funcs = &sti_hda_bridge_funcs;
drm_bridge_init(drm_dev, bridge);
encoder->bridge = bridge; encoder->bridge = bridge;
connector->encoder = encoder; connector->encoder = encoder;
......
...@@ -635,7 +635,8 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -635,7 +635,8 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
goto err_adapt; goto err_adapt;
bridge->driver_private = hdmi; bridge->driver_private = hdmi;
drm_bridge_init(drm_dev, bridge, &sti_hdmi_bridge_funcs); bridge->funcs = &sti_hdmi_bridge_funcs;
drm_bridge_init(drm_dev, bridge);
encoder->bridge = bridge; encoder->bridge = bridge;
connector->encoder = encoder; connector->encoder = encoder;
......
...@@ -1222,8 +1222,7 @@ extern unsigned int drm_connector_index(struct drm_connector *connector); ...@@ -1222,8 +1222,7 @@ extern unsigned int drm_connector_index(struct drm_connector *connector);
/* helper to unplug all connectors from sysfs for device */ /* helper to unplug all connectors from sysfs for device */
extern void drm_connector_unplug_all(struct drm_device *dev); extern void drm_connector_unplug_all(struct drm_device *dev);
extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge);
const struct drm_bridge_funcs *funcs);
extern void drm_bridge_cleanup(struct drm_bridge *bridge); extern void drm_bridge_cleanup(struct drm_bridge *bridge);
extern int drm_encoder_init(struct drm_device *dev, extern int drm_encoder_init(struct drm_device *dev,
......
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