[v3,05/35] drm/exynos: mic: Stop using drm_bridge->driver_private
diff mbox series

Message ID 20191224173408.25624-6-mihail.atanassov@arm.com
State New
Headers show
Series
  • drm/bridge: Consolidate initialization
Related show

Commit Message

Mihail Atanassov Dec. 24, 2019, 5:34 p.m. UTC
Use a container_of wrapper instead. Note that no logic depends on
driver_private being NULL or not, so the cleanup in exynos_mic_bind is
safe to apply.

Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
---

Reviewer note: the driver_private cleanup used to be part of the
relevant drm_bridge_init() patch.

 drivers/gpu/drm/exynos/exynos_drm_mic.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index f41d75923557..2b5f10c3a285 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -106,6 +106,8 @@  struct exynos_mic {
 	bool enabled;
 };
 
+#define bridge_to_exynos_mic(b) container_of((b), struct exynos_mic, bridge)
+
 static void mic_set_path(struct exynos_mic *mic, bool enable)
 {
 	int ret;
@@ -232,7 +234,7 @@  static void mic_disable(struct drm_bridge *bridge) { }
 
 static void mic_post_disable(struct drm_bridge *bridge)
 {
-	struct exynos_mic *mic = bridge->driver_private;
+	struct exynos_mic *mic = bridge_to_exynos_mic(bridge);
 
 	mutex_lock(&mic_mutex);
 	if (!mic->enabled)
@@ -251,7 +253,7 @@  static void mic_mode_set(struct drm_bridge *bridge,
 			 const struct drm_display_mode *mode,
 			 const struct drm_display_mode *adjusted_mode)
 {
-	struct exynos_mic *mic = bridge->driver_private;
+	struct exynos_mic *mic = bridge_to_exynos_mic(bridge);
 
 	mutex_lock(&mic_mutex);
 	drm_display_mode_to_videomode(mode, &mic->vm);
@@ -261,7 +263,7 @@  static void mic_mode_set(struct drm_bridge *bridge,
 
 static void mic_pre_enable(struct drm_bridge *bridge)
 {
-	struct exynos_mic *mic = bridge->driver_private;
+	struct exynos_mic *mic = bridge_to_exynos_mic(bridge);
 	int ret;
 
 	mutex_lock(&mic_mutex);
@@ -309,10 +311,6 @@  static const struct drm_bridge_funcs mic_bridge_funcs = {
 static int exynos_mic_bind(struct device *dev, struct device *master,
 			   void *data)
 {
-	struct exynos_mic *mic = dev_get_drvdata(dev);
-
-	mic->bridge.driver_private = mic;
-
 	return 0;
 }