drm/bridge: do not pass drm_bridge_funcs to drm_bridge_init
authorAjay Kumar <ajaykumar.rs@samsung.com>
Tue, 20 Jan 2015 16:38:43 +0000 (22:08 +0530)
committerThierry Reding <treding@nvidia.com>
Wed, 28 Jan 2015 07:45:40 +0000 (08:45 +0100)
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: Ajay Kumar <ajaykumar.rs@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Rahul Sharma <rahul.sharma@samsung.com>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Tested-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/bridge/ptn3460.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
drivers/gpu/drm/sti/sti_hda.c
drivers/gpu/drm/sti/sti_hdmi.c
include/drm/drm_crtc.h

index 4db38e1f7a1fe466263f86f6b11c6ff890d82c20..a2ddc8d73c6a363c4549b17853038722c37de2a8 100644 (file)
@@ -313,7 +313,8 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
                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) {
                DRM_ERROR("Failed to initialize bridge with drm\n");
                goto err;
index b459888f63104b03fe170c3b89c112f959094472..7936c5c2314c15804c9f1f8e5e8de74d98a0e204 100644 (file)
@@ -1069,7 +1069,6 @@ EXPORT_SYMBOL(drm_connector_unplug_all);
  * drm_bridge_init - initialize a drm transcoder/bridge
  * @dev: drm device
  * @bridge: transcoder/bridge to set up
- * @funcs: bridge function table
  *
  * Initialises a preallocated bridge. Bridges should be
  * subclassed as part of driver connector objects.
@@ -1077,8 +1076,7 @@ EXPORT_SYMBOL(drm_connector_unplug_all);
  * Returns:
  * Zero on success, error code on failure.
  */
-int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
-               const struct drm_bridge_funcs *funcs)
+int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge)
 {
        int ret;
 
@@ -1089,7 +1087,6 @@ int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
                goto out;
 
        bridge->dev = dev;
-       bridge->funcs = funcs;
 
        list_add_tail(&bridge->head, &dev->mode_config.bridge_list);
        dev->mode_config.num_bridge++;
index 6902ad6da710fe2d4f7fb7e9f56c3f84ba1c5b49..52ed2b53b24650fe945b68e23cd63f4f2e7efe71 100644 (file)
@@ -220,8 +220,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
        hdmi_bridge->hdmi = hdmi;
 
        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;
 
index 2ae9a9b7366660632f1745a1dce3e60cf7f03532..6cf145de9b413acd4a2831c6f1ba8f3b9b949e6a 100644 (file)
@@ -664,7 +664,8 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
                return -ENOMEM;
 
        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;
        connector->encoder = encoder;
index d032e024b0b81ac7e68ccc48467b20750ec2c665..74e943e655d1f2716d5737ccdeb8fce681607583 100644 (file)
@@ -635,7 +635,8 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
                goto err_adapt;
 
        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;
        connector->encoder = encoder;
index 02614170c0345a100af800b93c51c7658b033ceb..15bb762fb31658211fce06f3f359ab07b4a079fe 100644 (file)
@@ -1222,8 +1222,7 @@ extern unsigned int drm_connector_index(struct drm_connector *connector);
 /* helper to unplug all connectors from sysfs for device */
 extern void drm_connector_unplug_all(struct drm_device *dev);
 
-extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
-                          const struct drm_bridge_funcs *funcs);
+extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge);
 extern void drm_bridge_cleanup(struct drm_bridge *bridge);
 
 extern int drm_encoder_init(struct drm_device *dev,