Re: [PATCH 07/16] drm/i915: Remove redundant checks for num_pipes == 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 12 Oct 2018, José Roberto de Souza <jose.souza@xxxxxxxxx> wrote:
> This 'if's will always be false because of previous changes so let's
> drop then.

I also think this will gain clarity if i915_load_modeset_init() starts
with early return on no display.

>
> Signed-off-by: José Roberto de Souza <jose.souza@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_drv.c      | 12 +++---------
>  drivers/gpu/drm/i915/intel_bios.c    |  5 -----
>  drivers/gpu/drm/i915/intel_display.c |  3 ---
>  drivers/gpu/drm/i915/intel_fbdev.c   |  3 ---
>  drivers/gpu/drm/i915/intel_i2c.c     |  3 ---
>  5 files changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 8334d1797df7..d69faf70dcfd 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -645,12 +645,9 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  	if (i915_inject_load_failure())
>  		return -ENODEV;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes) {
> -		ret = drm_vblank_init(&dev_priv->drm,
> -				      INTEL_INFO(dev_priv)->num_pipes);
> -		if (ret)
> -			goto out;
> -	}
> +	ret = drm_vblank_init(&dev_priv->drm, INTEL_INFO(dev_priv)->num_pipes);
> +	if (ret)
> +		goto out;
>  
>  	intel_bios_init(dev_priv);
>  
> @@ -683,9 +680,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  
>  	intel_setup_overlay(dev_priv);
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> -		return 0;
> -
>  	ret = intel_fbdev_init(dev);
>  	if (ret)
>  		goto cleanup_modeset;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 1faa494e2bc9..1e0205572ff9 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1721,11 +1721,6 @@ void intel_bios_init(struct drm_i915_private *dev_priv)
>  	const struct bdb_header *bdb;
>  	u8 __iomem *bios = NULL;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0) {
> -		DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n");
> -		return;
> -	}
> -

I might leave in asserts such as

	if (WARN_ON(!HAS_DISPLAY(dev_priv)))
        	return;

in most places anyway.

BR,
Jani.


>  	init_vbt_defaults(dev_priv);
>  
>  	/* If the OpRegion does not have VBT, look in PCI ROM. */
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 1d07fc41d492..d369c7336286 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13957,9 +13957,6 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  
>  	intel_pps_init(dev_priv);
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> -		return;
> -
>  	/*
>  	 * intel_edp_init_connector() depends on this completing first, to
>  	 * prevent the registeration of both eDP and LVDS and the incorrect
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 2480c7d6edee..5eaf1c35332b 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -672,9 +672,6 @@ int intel_fbdev_init(struct drm_device *dev)
>  	struct intel_fbdev *ifbdev;
>  	int ret;
>  
> -	if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0))
> -		return -ENODEV;
> -
>  	ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
>  	if (ifbdev == NULL)
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index 33d87ab93fdd..9c05f7af68a6 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -817,9 +817,6 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv)
>  	unsigned int pin;
>  	int ret;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> -		return 0;
> -
>  	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
>  		dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE;
>  	else if (!HAS_GMCH_DISPLAY(dev_priv))

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux