Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/exynos: clean up machine compatible string check

Use 'for' statemant instead of hard-coded 'if' statement.

Signed-off-by: Inki Dae <inki.dae@samsung.com>

Inki Dae 4846e452 820687be

+15 -3
+15 -3
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 610 610 return 0; 611 611 } 612 612 613 + static const char * const strings[] = { 614 + "samsung,exynos3", 615 + "samsung,exynos4", 616 + "samsung,exynos5", 617 + }; 618 + 613 619 static struct platform_driver exynos_drm_platform_driver = { 614 620 .probe = exynos_drm_platform_probe, 615 621 .remove = exynos_drm_platform_remove, ··· 628 622 629 623 static int exynos_drm_init(void) 630 624 { 625 + bool is_exynos = false; 631 626 int ret, i, j; 632 627 633 628 /* ··· 638 631 * by Exynos drm driver when using multi-platform kernel. 639 632 * So these codes will be replaced with more generic way later. 640 633 */ 641 - if (!of_machine_is_compatible("samsung,exynos3") && 642 - !of_machine_is_compatible("samsung,exynos4") && 643 - !of_machine_is_compatible("samsung,exynos5")) 634 + for (i = 0; i < ARRAY_SIZE(strings); i++) { 635 + if (of_machine_is_compatible(strings[i])) { 636 + is_exynos = true; 637 + break; 638 + } 639 + } 640 + 641 + if (!is_exynos) 644 642 return -ENODEV; 645 643 646 644 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,