@@ -486,21 +486,20 @@ void exynos_drm_component_del(struct device *dev,
486486 mutex_unlock (& drm_component_lock );
487487}
488488
489- static int compare_of (struct device * dev , void * data )
489+ static int compare_dev (struct device * dev , void * data )
490490{
491491 return dev == (struct device * )data ;
492492}
493493
494- static int exynos_drm_add_components ( struct device * dev , struct master * m )
494+ static struct component_match * exynos_drm_match_add ( struct device * dev )
495495{
496+ struct component_match * match = NULL ;
496497 struct component_dev * cdev ;
497498 unsigned int attach_cnt = 0 ;
498499
499500 mutex_lock (& drm_component_lock );
500501
501502 list_for_each_entry (cdev , & drm_component_list , list ) {
502- int ret ;
503-
504503 /*
505504 * Add components to master only in case that crtc and
506505 * encoder/connector device objects exist.
@@ -515,16 +514,10 @@ static int exynos_drm_add_components(struct device *dev, struct master *m)
515514 /*
516515 * fimd and dpi modules have same device object so add
517516 * only crtc device object in this case.
518- *
519- * TODO. if dpi module follows driver-model driver then
520- * below codes can be removed.
521517 */
522518 if (cdev -> crtc_dev == cdev -> conn_dev ) {
523- ret = component_master_add_child (m , compare_of ,
524- cdev -> crtc_dev );
525- if (ret < 0 )
526- return ret ;
527-
519+ component_match_add (dev , & match , compare_dev ,
520+ cdev -> crtc_dev );
528521 goto out_lock ;
529522 }
530523
@@ -534,19 +527,16 @@ static int exynos_drm_add_components(struct device *dev, struct master *m)
534527 * connector/encoder need pipe number of crtc when they
535528 * are created.
536529 */
537- ret = component_master_add_child (m , compare_of , cdev -> crtc_dev );
538- ret |= component_master_add_child (m , compare_of ,
539- cdev -> conn_dev );
540- if (ret < 0 )
541- return ret ;
530+ component_match_add (dev , & match , compare_dev , cdev -> crtc_dev );
531+ component_match_add (dev , & match , compare_dev , cdev -> conn_dev );
542532
543533out_lock :
544534 mutex_lock (& drm_component_lock );
545535 }
546536
547537 mutex_unlock (& drm_component_lock );
548538
549- return attach_cnt ? 0 : - ENODEV ;
539+ return attach_cnt ? match : ERR_PTR ( - EPROBE_DEFER ) ;
550540}
551541
552542static int exynos_drm_bind (struct device * dev )
@@ -560,13 +550,13 @@ static void exynos_drm_unbind(struct device *dev)
560550}
561551
562552static const struct component_master_ops exynos_drm_ops = {
563- .add_components = exynos_drm_add_components ,
564553 .bind = exynos_drm_bind ,
565554 .unbind = exynos_drm_unbind ,
566555};
567556
568557static int exynos_drm_platform_probe (struct platform_device * pdev )
569558{
559+ struct component_match * match ;
570560 int ret ;
571561
572562 pdev -> dev .coherent_dma_mask = DMA_BIT_MASK (32 );
@@ -633,13 +623,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
633623 goto err_unregister_ipp_drv ;
634624#endif
635625
636- ret = component_master_add (& pdev -> dev , & exynos_drm_ops );
626+ match = exynos_drm_match_add (& pdev -> dev );
627+ if (IS_ERR (match )) {
628+ ret = PTR_ERR (match );
629+ goto err_unregister_resources ;
630+ }
631+
632+ ret = component_master_add_with_match (& pdev -> dev , & exynos_drm_ops ,
633+ match );
637634 if (ret < 0 )
638- DRM_DEBUG_KMS ( "re-tried by last sub driver probed later.\n" ) ;
635+ goto err_unregister_resources ;
639636
640- return 0 ;
637+ return ret ;
638+
639+ err_unregister_resources :
641640
642641#ifdef CONFIG_DRM_EXYNOS_IPP
642+ exynos_platform_device_ipp_unregister ();
643643err_unregister_ipp_drv :
644644 platform_driver_unregister (& ipp_driver );
645645err_unregister_gsc_drv :
0 commit comments