@@ -284,14 +284,9 @@ static void fimd_clear_channel(struct fimd_context *ctx)
284
284
}
285
285
}
286
286
287
- static int fimd_ctx_initialize (struct fimd_context * ctx ,
287
+ static int fimd_iommu_attach_devices (struct fimd_context * ctx ,
288
288
struct drm_device * drm_dev )
289
289
{
290
- struct exynos_drm_private * priv ;
291
- priv = drm_dev -> dev_private ;
292
-
293
- ctx -> drm_dev = drm_dev ;
294
- ctx -> pipe = priv -> pipe ++ ;
295
290
296
291
/* attach this sub driver to iommu mapping if supported. */
297
292
if (is_drm_iommu_supported (ctx -> drm_dev )) {
@@ -313,7 +308,7 @@ static int fimd_ctx_initialize(struct fimd_context *ctx,
313
308
return 0 ;
314
309
}
315
310
316
- static void fimd_ctx_remove (struct fimd_context * ctx )
311
+ static void fimd_iommu_detach_devices (struct fimd_context * ctx )
317
312
{
318
313
/* detach this sub driver from iommu mapping if supported. */
319
314
if (is_drm_iommu_supported (ctx -> drm_dev ))
@@ -1056,25 +1051,23 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
1056
1051
{
1057
1052
struct fimd_context * ctx = dev_get_drvdata (dev );
1058
1053
struct drm_device * drm_dev = data ;
1054
+ struct exynos_drm_private * priv = drm_dev -> dev_private ;
1059
1055
int ret ;
1060
1056
1061
- ret = fimd_ctx_initialize (ctx , drm_dev );
1062
- if (ret ) {
1063
- DRM_ERROR ("fimd_ctx_initialize failed.\n" );
1064
- return ret ;
1065
- }
1057
+ ctx -> drm_dev = drm_dev ;
1058
+ ctx -> pipe = priv -> pipe ++ ;
1066
1059
1067
1060
ctx -> crtc = exynos_drm_crtc_create (drm_dev , ctx -> pipe ,
1068
1061
EXYNOS_DISPLAY_TYPE_LCD ,
1069
1062
& fimd_crtc_ops , ctx );
1070
- if (IS_ERR (ctx -> crtc )) {
1071
- fimd_ctx_remove (ctx );
1072
- return PTR_ERR (ctx -> crtc );
1073
- }
1074
1063
1075
1064
if (ctx -> display )
1076
1065
exynos_drm_create_enc_conn (drm_dev , ctx -> display );
1077
1066
1067
+ ret = fimd_iommu_attach_devices (ctx , drm_dev );
1068
+ if (ret )
1069
+ return ret ;
1070
+
1078
1071
return 0 ;
1079
1072
1080
1073
}
@@ -1086,10 +1079,10 @@ static void fimd_unbind(struct device *dev, struct device *master,
1086
1079
1087
1080
fimd_dpms (ctx -> crtc , DRM_MODE_DPMS_OFF );
1088
1081
1082
+ fimd_iommu_detach_devices (ctx );
1083
+
1089
1084
if (ctx -> display )
1090
1085
exynos_dpi_remove (ctx -> display );
1091
-
1092
- fimd_ctx_remove (ctx );
1093
1086
}
1094
1087
1095
1088
static const struct component_ops fimd_component_ops = {
0 commit comments