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

drm/i915: Add HAS_DISPLAY() and use it

Right now it is decided if GEN has display by checking the num_pipes,
so lets make it explicit and use a macro.

Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130232048.14216-1-jose.souza@intel.com

+14 -12
+5 -5
drivers/gpu/drm/i915/i915_drv.c
··· 287 287 * Use PCH_NOP (PCH but no South Display) for PCH platforms without 288 288 * display. 289 289 */ 290 - if (pch && INTEL_INFO(dev_priv)->num_pipes == 0) { 290 + if (pch && !HAS_DISPLAY(dev_priv)) { 291 291 DRM_DEBUG_KMS("Display disabled, reverting to NOP PCH\n"); 292 292 dev_priv->pch_type = PCH_NOP; 293 293 dev_priv->pch_id = 0; ··· 645 645 if (i915_inject_load_failure()) 646 646 return -ENODEV; 647 647 648 - if (INTEL_INFO(dev_priv)->num_pipes) { 648 + if (HAS_DISPLAY(dev_priv)) { 649 649 ret = drm_vblank_init(&dev_priv->drm, 650 650 INTEL_INFO(dev_priv)->num_pipes); 651 651 if (ret) ··· 696 696 697 697 intel_overlay_setup(dev_priv); 698 698 699 - if (INTEL_INFO(dev_priv)->num_pipes == 0) 699 + if (!HAS_DISPLAY(dev_priv)) 700 700 return 0; 701 701 702 702 ret = intel_fbdev_init(dev); ··· 1566 1566 } else 1567 1567 DRM_ERROR("Failed to register driver for userspace access!\n"); 1568 1568 1569 - if (INTEL_INFO(dev_priv)->num_pipes) { 1569 + if (HAS_DISPLAY(dev_priv)) { 1570 1570 /* Must be done after probing outputs */ 1571 1571 intel_opregion_register(dev_priv); 1572 1572 acpi_video_register(); ··· 1590 1590 * We need to coordinate the hotplugs with the asynchronous fbdev 1591 1591 * configuration, for which we use the fbdev->async_cookie. 1592 1592 */ 1593 - if (INTEL_INFO(dev_priv)->num_pipes) 1593 + if (HAS_DISPLAY(dev_priv)) 1594 1594 drm_kms_helper_poll_init(dev); 1595 1595 1596 1596 intel_power_domains_enable(dev_priv);
+2
drivers/gpu/drm/i915/i915_drv.h
··· 2569 2569 #define GT_FREQUENCY_MULTIPLIER 50 2570 2570 #define GEN9_FREQ_SCALER 3 2571 2571 2572 + #define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->num_pipes > 0) 2573 + 2572 2574 #include "i915_trace.h" 2573 2575 2574 2576 static inline bool intel_vtd_active(void)
+1 -1
drivers/gpu/drm/i915/intel_bios.c
··· 1752 1752 const struct bdb_header *bdb; 1753 1753 u8 __iomem *bios = NULL; 1754 1754 1755 - if (INTEL_INFO(dev_priv)->num_pipes == 0) { 1755 + if (!HAS_DISPLAY(dev_priv)) { 1756 1756 DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n"); 1757 1757 return; 1758 1758 }
+2 -2
drivers/gpu/drm/i915/intel_device_info.c
··· 782 782 if (i915_modparams.disable_display) { 783 783 DRM_INFO("Display disabled (module parameter)\n"); 784 784 info->num_pipes = 0; 785 - } else if (info->num_pipes > 0 && 785 + } else if (HAS_DISPLAY(dev_priv) && 786 786 (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) && 787 787 HAS_PCH_SPLIT(dev_priv)) { 788 788 u32 fuse_strap = I915_READ(FUSE_STRAP); ··· 807 807 DRM_INFO("PipeC fused off\n"); 808 808 info->num_pipes -= 1; 809 809 } 810 - } else if (info->num_pipes > 0 && IS_GEN9(dev_priv)) { 810 + } else if (HAS_DISPLAY(dev_priv) && IS_GEN9(dev_priv)) { 811 811 u32 dfsm = I915_READ(SKL_DFSM); 812 812 u8 disabled_mask = 0; 813 813 bool invalid;
+2 -2
drivers/gpu/drm/i915/intel_display.c
··· 14249 14249 14250 14250 intel_pps_init(dev_priv); 14251 14251 14252 - if (INTEL_INFO(dev_priv)->num_pipes == 0) 14252 + if (!HAS_DISPLAY(dev_priv)) 14253 14253 return; 14254 14254 14255 14255 /* ··· 16040 16040 }; 16041 16041 int i; 16042 16042 16043 - if (INTEL_INFO(dev_priv)->num_pipes == 0) 16043 + if (!HAS_DISPLAY(dev_priv)) 16044 16044 return NULL; 16045 16045 16046 16046 error = kzalloc(sizeof(*error), GFP_ATOMIC);
+1 -1
drivers/gpu/drm/i915/intel_fbdev.c
··· 672 672 struct intel_fbdev *ifbdev; 673 673 int ret; 674 674 675 - if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0)) 675 + if (WARN_ON(!HAS_DISPLAY(dev_priv))) 676 676 return -ENODEV; 677 677 678 678 ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
+1 -1
drivers/gpu/drm/i915/intel_i2c.c
··· 817 817 unsigned int pin; 818 818 int ret; 819 819 820 - if (INTEL_INFO(dev_priv)->num_pipes == 0) 820 + if (!HAS_DISPLAY(dev_priv)) 821 821 return 0; 822 822 823 823 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))