diff options
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.c | 105 |
1 files changed, 48 insertions, 57 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 2ca0c5dcf80e..c5cb8b6c85a9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -591,73 +591,22 @@ static struct platform_driver *const exynos_drm_non_kms_drivers[] = { | |||
591 | static int exynos_drm_platform_probe(struct platform_device *pdev) | 591 | static int exynos_drm_platform_probe(struct platform_device *pdev) |
592 | { | 592 | { |
593 | struct component_match *match; | 593 | struct component_match *match; |
594 | int ret, i, j; | ||
595 | 594 | ||
596 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 595 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
597 | exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls); | 596 | exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls); |
598 | 597 | ||
599 | for (i = 0; i < ARRAY_SIZE(exynos_drm_kms_drivers); ++i) { | ||
600 | ret = platform_driver_register(exynos_drm_kms_drivers[i]); | ||
601 | if (ret < 0) | ||
602 | goto err_unregister_kms_drivers; | ||
603 | } | ||
604 | |||
605 | match = exynos_drm_match_add(&pdev->dev); | 598 | match = exynos_drm_match_add(&pdev->dev); |
606 | if (IS_ERR(match)) { | 599 | if (IS_ERR(match)) { |
607 | ret = PTR_ERR(match); | 600 | return PTR_ERR(match); |
608 | goto err_unregister_kms_drivers; | ||
609 | } | 601 | } |
610 | 602 | ||
611 | ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, | 603 | return component_master_add_with_match(&pdev->dev, &exynos_drm_ops, |
612 | match); | 604 | match); |
613 | if (ret < 0) | ||
614 | goto err_unregister_kms_drivers; | ||
615 | |||
616 | for (j = 0; j < ARRAY_SIZE(exynos_drm_non_kms_drivers); ++j) { | ||
617 | ret = platform_driver_register(exynos_drm_non_kms_drivers[j]); | ||
618 | if (ret < 0) | ||
619 | goto err_del_component_master; | ||
620 | } | ||
621 | |||
622 | ret = exynos_platform_device_ipp_register(); | ||
623 | if (ret < 0) | ||
624 | goto err_unregister_non_kms_drivers; | ||
625 | |||
626 | return ret; | ||
627 | |||
628 | #ifdef CONFIG_DRM_EXYNOS_IPP | ||
629 | exynos_platform_device_ipp_unregister(); | ||
630 | #endif | ||
631 | err_unregister_non_kms_drivers: | ||
632 | while (--j >= 0) | ||
633 | platform_driver_unregister(exynos_drm_non_kms_drivers[j]); | ||
634 | |||
635 | err_del_component_master: | ||
636 | component_master_del(&pdev->dev, &exynos_drm_ops); | ||
637 | |||
638 | err_unregister_kms_drivers: | ||
639 | while (--i >= 0) | ||
640 | platform_driver_unregister(exynos_drm_kms_drivers[i]); | ||
641 | |||
642 | return ret; | ||
643 | } | 605 | } |
644 | 606 | ||
645 | static int exynos_drm_platform_remove(struct platform_device *pdev) | 607 | static int exynos_drm_platform_remove(struct platform_device *pdev) |
646 | { | 608 | { |
647 | int i; | ||
648 | |||
649 | #ifdef CONFIG_DRM_EXYNOS_IPP | ||
650 | exynos_platform_device_ipp_unregister(); | ||
651 | #endif | ||
652 | |||
653 | for (i = ARRAY_SIZE(exynos_drm_non_kms_drivers) - 1; i >= 0; --i) | ||
654 | platform_driver_unregister(exynos_drm_non_kms_drivers[i]); | ||
655 | |||
656 | component_master_del(&pdev->dev, &exynos_drm_ops); | 609 | component_master_del(&pdev->dev, &exynos_drm_ops); |
657 | |||
658 | for (i = ARRAY_SIZE(exynos_drm_kms_drivers) - 1; i >= 0; --i) | ||
659 | platform_driver_unregister(exynos_drm_kms_drivers[i]); | ||
660 | |||
661 | return 0; | 610 | return 0; |
662 | } | 611 | } |
663 | 612 | ||
@@ -673,7 +622,7 @@ static struct platform_driver exynos_drm_platform_driver = { | |||
673 | 622 | ||
674 | static int exynos_drm_init(void) | 623 | static int exynos_drm_init(void) |
675 | { | 624 | { |
676 | int ret; | 625 | int ret, i, j; |
677 | 626 | ||
678 | /* | 627 | /* |
679 | * Register device object only in case of Exynos SoC. | 628 | * Register device object only in case of Exynos SoC. |
@@ -696,13 +645,43 @@ static int exynos_drm_init(void) | |||
696 | if (ret < 0) | 645 | if (ret < 0) |
697 | goto err_unregister_pd; | 646 | goto err_unregister_pd; |
698 | 647 | ||
648 | for (i = 0; i < ARRAY_SIZE(exynos_drm_kms_drivers); ++i) { | ||
649 | ret = platform_driver_register(exynos_drm_kms_drivers[i]); | ||
650 | if (ret < 0) | ||
651 | goto err_unregister_kms_drivers; | ||
652 | } | ||
653 | |||
654 | for (j = 0; j < ARRAY_SIZE(exynos_drm_non_kms_drivers); ++j) { | ||
655 | ret = platform_driver_register(exynos_drm_non_kms_drivers[j]); | ||
656 | if (ret < 0) | ||
657 | goto err_unregister_non_kms_drivers; | ||
658 | } | ||
659 | |||
660 | #ifdef CONFIG_DRM_EXYNOS_IPP | ||
661 | ret = exynos_platform_device_ipp_register(); | ||
662 | if (ret < 0) | ||
663 | goto err_unregister_non_kms_drivers; | ||
664 | #endif | ||
665 | |||
699 | ret = platform_driver_register(&exynos_drm_platform_driver); | 666 | ret = platform_driver_register(&exynos_drm_platform_driver); |
700 | if (ret) | 667 | if (ret) |
701 | goto err_remove_vidi; | 668 | goto err_unregister_resources; |
702 | 669 | ||
703 | return 0; | 670 | return 0; |
704 | 671 | ||
705 | err_remove_vidi: | 672 | err_unregister_resources: |
673 | #ifdef CONFIG_DRM_EXYNOS_IPP | ||
674 | exynos_platform_device_ipp_unregister(); | ||
675 | #endif | ||
676 | |||
677 | err_unregister_non_kms_drivers: | ||
678 | while (--j >= 0) | ||
679 | platform_driver_unregister(exynos_drm_non_kms_drivers[j]); | ||
680 | |||
681 | err_unregister_kms_drivers: | ||
682 | while (--i >= 0) | ||
683 | platform_driver_unregister(exynos_drm_kms_drivers[i]); | ||
684 | |||
706 | exynos_drm_remove_vidi(); | 685 | exynos_drm_remove_vidi(); |
707 | 686 | ||
708 | err_unregister_pd: | 687 | err_unregister_pd: |
@@ -713,6 +692,18 @@ err_unregister_pd: | |||
713 | 692 | ||
714 | static void exynos_drm_exit(void) | 693 | static void exynos_drm_exit(void) |
715 | { | 694 | { |
695 | int i; | ||
696 | |||
697 | #ifdef CONFIG_DRM_EXYNOS_IPP | ||
698 | exynos_platform_device_ipp_unregister(); | ||
699 | #endif | ||
700 | |||
701 | for (i = ARRAY_SIZE(exynos_drm_non_kms_drivers) - 1; i >= 0; --i) | ||
702 | platform_driver_unregister(exynos_drm_non_kms_drivers[i]); | ||
703 | |||
704 | for (i = ARRAY_SIZE(exynos_drm_kms_drivers) - 1; i >= 0; --i) | ||
705 | platform_driver_unregister(exynos_drm_kms_drivers[i]); | ||
706 | |||
716 | platform_driver_unregister(&exynos_drm_platform_driver); | 707 | platform_driver_unregister(&exynos_drm_platform_driver); |
717 | 708 | ||
718 | exynos_drm_remove_vidi(); | 709 | exynos_drm_remove_vidi(); |