Re: [PATCH v5 4/7] drm/i915: Move fbdev functions

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

 



On Wed, 2023-09-27 at 12:26 +0200, Thomas Zimmermann wrote:
> Move functions within intel_fbdev.c to simplify later updates. Minor
> style fixes to make checkpatch happy, but no functional changes.
> 
> v5:
>         * style fixes (checkpatch)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>

Reviewed-by: Jouni Högander <jouni.hogander@xxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/display/intel_fbdev.c | 154 ++++++++++---------
> --
>  1 file changed, 77 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c
> b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 31d0d695d5671..2695c65b55ddc 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -545,58 +545,6 @@ static void intel_fbdev_suspend_worker(struct
> work_struct *work)
>                                 true);
>  }
>  
> -int intel_fbdev_init(struct drm_device *dev)
> -{
> -       struct drm_i915_private *dev_priv = to_i915(dev);
> -       struct intel_fbdev *ifbdev;
> -       int ret;
> -
> -       if (drm_WARN_ON(dev, !HAS_DISPLAY(dev_priv)))
> -               return -ENODEV;
> -
> -       ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
> -       if (ifbdev == NULL)
> -               return -ENOMEM;
> -
> -       mutex_init(&ifbdev->hpd_lock);
> -       drm_fb_helper_prepare(dev, &ifbdev->helper, 32,
> &intel_fb_helper_funcs);
> -
> -       if (intel_fbdev_init_bios(dev, ifbdev))
> -               ifbdev->helper.preferred_bpp = ifbdev->preferred_bpp;
> -       else
> -               ifbdev->preferred_bpp = ifbdev->helper.preferred_bpp;
> -
> -       ret = drm_fb_helper_init(dev, &ifbdev->helper);
> -       if (ret) {
> -               kfree(ifbdev);
> -               return ret;
> -       }
> -
> -       dev_priv->display.fbdev.fbdev = ifbdev;
> -       INIT_WORK(&dev_priv->display.fbdev.suspend_work,
> intel_fbdev_suspend_worker);
> -
> -       return 0;
> -}
> -
> -static void intel_fbdev_initial_config(void *data, async_cookie_t
> cookie)
> -{
> -       struct intel_fbdev *ifbdev = data;
> -
> -       /* Due to peculiar init order wrt to hpd handling this is
> separate. */
> -       if (drm_fb_helper_initial_config(&ifbdev->helper))
> -               intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
> -}
> -
> -void intel_fbdev_initial_config_async(struct drm_i915_private
> *dev_priv)
> -{
> -       struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
> -
> -       if (!ifbdev)
> -               return;
> -
> -       ifbdev->cookie = async_schedule(intel_fbdev_initial_config,
> ifbdev);
> -}
> -
>  static void intel_fbdev_sync(struct intel_fbdev *ifbdev)
>  {
>         if (!ifbdev->cookie)
> @@ -607,31 +555,6 @@ static void intel_fbdev_sync(struct intel_fbdev
> *ifbdev)
>         ifbdev->cookie = 0;
>  }
>  
> -void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
> -{
> -       struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
> -
> -       if (!ifbdev)
> -               return;
> -
> -       intel_fbdev_set_suspend(&dev_priv->drm,
> FBINFO_STATE_SUSPENDED, true);
> -
> -       if (!current_is_async())
> -               intel_fbdev_sync(ifbdev);
> -
> -       drm_fb_helper_unregister_info(&ifbdev->helper);
> -}
> -
> -void intel_fbdev_fini(struct drm_i915_private *dev_priv)
> -{
> -       struct intel_fbdev *ifbdev = fetch_and_zero(&dev_priv-
> >display.fbdev.fbdev);
> -
> -       if (!ifbdev)
> -               return;
> -
> -       intel_fbdev_destroy(ifbdev);
> -}
> -
>  /* Suspends/resumes fbdev processing of incoming HPD events. When
> resuming HPD
>   * processing, fbdev will perform a full connector reprobe if a
> hotplug event
>   * was received while HPD was suspended.
> @@ -748,6 +671,83 @@ void intel_fbdev_restore_mode(struct
> drm_i915_private *dev_priv)
>                 intel_fbdev_invalidate(ifbdev);
>  }
>  
> +int intel_fbdev_init(struct drm_device *dev)
> +{
> +       struct drm_i915_private *dev_priv = to_i915(dev);
> +       struct intel_fbdev *ifbdev;
> +       int ret;
> +
> +       if (drm_WARN_ON(dev, !HAS_DISPLAY(dev_priv)))
> +               return -ENODEV;
> +
> +       ifbdev = kzalloc(sizeof(*ifbdev), GFP_KERNEL);
> +       if (!ifbdev)
> +               return -ENOMEM;
> +
> +       mutex_init(&ifbdev->hpd_lock);
> +       drm_fb_helper_prepare(dev, &ifbdev->helper, 32,
> &intel_fb_helper_funcs);
> +
> +       if (intel_fbdev_init_bios(dev, ifbdev))
> +               ifbdev->helper.preferred_bpp = ifbdev->preferred_bpp;
> +       else
> +               ifbdev->preferred_bpp = ifbdev->helper.preferred_bpp;
> +
> +       ret = drm_fb_helper_init(dev, &ifbdev->helper);
> +       if (ret) {
> +               kfree(ifbdev);
> +               return ret;
> +       }
> +
> +       dev_priv->display.fbdev.fbdev = ifbdev;
> +       INIT_WORK(&dev_priv->display.fbdev.suspend_work,
> intel_fbdev_suspend_worker);
> +
> +       return 0;
> +}
> +
> +static void intel_fbdev_initial_config(void *data, async_cookie_t
> cookie)
> +{
> +       struct intel_fbdev *ifbdev = data;
> +
> +       /* Due to peculiar init order wrt to hpd handling this is
> separate. */
> +       if (drm_fb_helper_initial_config(&ifbdev->helper))
> +               intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
> +}
> +
> +void intel_fbdev_initial_config_async(struct drm_i915_private
> *dev_priv)
> +{
> +       struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
> +
> +       if (!ifbdev)
> +               return;
> +
> +       ifbdev->cookie = async_schedule(intel_fbdev_initial_config,
> ifbdev);
> +}
> +
> +void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
> +{
> +       struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
> +
> +       if (!ifbdev)
> +               return;
> +
> +       intel_fbdev_set_suspend(&dev_priv->drm,
> FBINFO_STATE_SUSPENDED, true);
> +
> +       if (!current_is_async())
> +               intel_fbdev_sync(ifbdev);
> +
> +       drm_fb_helper_unregister_info(&ifbdev->helper);
> +}
> +
> +void intel_fbdev_fini(struct drm_i915_private *dev_priv)
> +{
> +       struct intel_fbdev *ifbdev = fetch_and_zero(&dev_priv-
> >display.fbdev.fbdev);
> +
> +       if (!ifbdev)
> +               return;
> +
> +       intel_fbdev_destroy(ifbdev);
> +}
> +
>  struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev
> *fbdev)
>  {
>         if (!fbdev || !fbdev->helper.fb)





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux