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

drm/tegra: dc: Simplify atomic plane helper functions

Remove the tegra_dc_disable_window() function whose only purpose was to
allow tegra_plane_atomic_update() to also call it. Fix that by shuffling
tegra_plano_atomic_disable() to before tegra_plane_atomic_update().

While at it, also remove the overlay plane helper functions because they
are exactly the same as the primary plane helper functions.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+14 -28
+14 -28
drivers/gpu/drm/tegra/dc.c
··· 550 550 return 0; 551 551 } 552 552 553 - static void tegra_dc_disable_window(struct tegra_dc *dc, int index) 553 + static void tegra_plane_atomic_disable(struct drm_plane *plane, 554 + struct drm_plane_state *old_state) 554 555 { 556 + struct tegra_dc *dc = to_tegra_dc(old_state->crtc); 557 + struct tegra_plane *p = to_tegra_plane(plane); 555 558 unsigned long flags; 556 559 u32 value; 557 560 561 + /* rien ne va plus */ 562 + if (!old_state || !old_state->crtc) 563 + return; 564 + 558 565 spin_lock_irqsave(&dc->lock, flags); 559 566 560 - value = WINDOW_A_SELECT << index; 567 + value = WINDOW_A_SELECT << p->index; 561 568 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); 562 569 563 570 value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); ··· 589 582 return; 590 583 591 584 if (!plane->state->visible) 592 - return tegra_dc_disable_window(dc, p->index); 585 + return tegra_plane_atomic_disable(plane, old_state); 593 586 594 587 memset(&window, 0, sizeof(window)); 595 588 window.src.x = plane->state->src.x1 >> 16; ··· 625 618 tegra_dc_setup_window(dc, p->index, &window); 626 619 } 627 620 628 - static void tegra_plane_atomic_disable(struct drm_plane *plane, 629 - struct drm_plane_state *old_state) 630 - { 631 - struct tegra_plane *p = to_tegra_plane(plane); 632 - struct tegra_dc *dc; 633 - 634 - /* rien ne va plus */ 635 - if (!old_state || !old_state->crtc) 636 - return; 637 - 638 - dc = to_tegra_dc(old_state->crtc); 639 - 640 - tegra_dc_disable_window(dc, p->index); 641 - } 642 - 643 - static const struct drm_plane_helper_funcs tegra_primary_plane_helper_funcs = { 621 + static const struct drm_plane_helper_funcs tegra_plane_helper_funcs = { 644 622 .atomic_check = tegra_plane_atomic_check, 645 - .atomic_update = tegra_plane_atomic_update, 646 623 .atomic_disable = tegra_plane_atomic_disable, 624 + .atomic_update = tegra_plane_atomic_update, 647 625 }; 648 626 649 627 static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, ··· 668 676 return ERR_PTR(err); 669 677 } 670 678 671 - drm_plane_helper_add(&plane->base, &tegra_primary_plane_helper_funcs); 679 + drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs); 672 680 673 681 return &plane->base; 674 682 } ··· 863 871 DRM_FORMAT_YUV422, 864 872 }; 865 873 866 - static const struct drm_plane_helper_funcs tegra_overlay_plane_helper_funcs = { 867 - .atomic_check = tegra_plane_atomic_check, 868 - .atomic_update = tegra_plane_atomic_update, 869 - .atomic_disable = tegra_plane_atomic_disable, 870 - }; 871 - 872 874 static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, 873 875 struct tegra_dc *dc, 874 876 unsigned int index) ··· 890 904 return ERR_PTR(err); 891 905 } 892 906 893 - drm_plane_helper_add(&plane->base, &tegra_overlay_plane_helper_funcs); 907 + drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs); 894 908 895 909 return &plane->base; 896 910 }