drm: Pass 'dev' to drm_helper_mode_fill_fb_struct()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 14 Dec 2016 20:48:59 +0000 (22:48 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 15 Dec 2016 12:03:30 +0000 (14:03 +0200)
Pass the drm_device to drm_helper_mode_fill_fb_struct() so that we can
populate fb->dev early. Will make it easier to use the fb before we
register it.

@@
identifier fb, mode_cmd;
@@
 void drm_helper_mode_fill_fb_struct(
+      struct drm_device *dev,
     struct drm_framebuffer *fb,
     const struct drm_mode_fb_cmd2 *mode_cmd
     );

@@
identifier fb, mode_cmd;
@@
 void drm_helper_mode_fill_fb_struct(
+      struct drm_device *dev,
     struct drm_framebuffer *fb,
     const struct drm_mode_fb_cmd2 *mode_cmd
     )
{ ... }

@@
function func;
identifier dev;
expression E1, E2;
@@
func(struct drm_device *dev, ...)
{
 ...
 drm_helper_mode_fill_fb_struct(
+ dev,
E1, E2);
 ...
}

@@
expression E1, E2;
@@
 drm_helper_mode_fill_fb_struct(
+ dev,
E1, E2);

v2: Rerun spatch due to code changes

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481748539-18283-1-git-send-email-ville.syrjala@linux.intel.com
24 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
drivers/gpu/drm/armada/armada_fb.c
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/bochs/bochs_mm.c
drivers/gpu/drm/cirrus/cirrus_main.c
drivers/gpu/drm/drm_fb_cma_helper.c
drivers/gpu/drm/drm_modeset_helper.c
drivers/gpu/drm/exynos/exynos_drm_fb.c
drivers/gpu/drm/gma500/framebuffer.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/mediatek/mtk_drm_fb.c
drivers/gpu/drm/mgag200/mgag200_main.c
drivers/gpu/drm/msm/msm_fb.c
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/omapdrm/omap_fb.c
drivers/gpu/drm/qxl/qxl_display.c
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/rockchip/rockchip_drm_fb.c
drivers/gpu/drm/tegra/fb.c
drivers/gpu/drm/udl/udl_fb.c
drivers/gpu/drm/virtio/virtgpu_display.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
include/drm/drm_modeset_helper.h

index 581601ca6b89dec1a8dfa39ec1f77b367b8bf4d4..d2036df145b3199a533c35e97c8987d16b73dd8a 100644 (file)
@@ -508,7 +508,7 @@ amdgpu_framebuffer_init(struct drm_device *dev,
 {
        int ret;
        rfb->obj = obj;
-       drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
        ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
        if (ret) {
                rfb->obj = NULL;
index f03c212b754d273189766532d0614a5cc5f59ee5..2a7eb6817c367b86709401a1b20a6c89c92bfea3 100644 (file)
@@ -81,7 +81,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
        dfb->mod = config;
        dfb->obj = obj;
 
-       drm_helper_mode_fill_fb_struct(&dfb->fb, mode);
+       drm_helper_mode_fill_fb_struct(dev, &dfb->fb, mode);
 
        ret = drm_framebuffer_init(dev, &dfb->fb, &armada_fb_funcs);
        if (ret) {
index 904beaa932d03f0b5ce7d89a13d16729582052e0..d85af0ff2653b8a8b5d0c874fe912d3bf27f8f3b 100644 (file)
@@ -313,7 +313,7 @@ int ast_framebuffer_init(struct drm_device *dev,
 {
        int ret;
 
-       drm_helper_mode_fill_fb_struct(&ast_fb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &ast_fb->base, mode_cmd);
        ast_fb->obj = obj;
        ret = drm_framebuffer_init(dev, &ast_fb->base, &ast_fb_funcs);
        if (ret) {
index 099a3c688c26d06d4babaa298e81480899ac9443..ceb1fecf02dd3606bbf023dd3a7538d262724535 100644 (file)
@@ -484,7 +484,7 @@ int bochs_framebuffer_init(struct drm_device *dev,
 {
        int ret;
 
-       drm_helper_mode_fill_fb_struct(&gfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
        gfb->obj = obj;
        ret = drm_framebuffer_init(dev, &gfb->base, &bochs_fb_funcs);
        if (ret) {
index 2c3c0d4072ced3957ec4d142cbdc24b6fd3835d0..52d901fa86872d7f45f6cc6c476257f8664b039f 100644 (file)
@@ -34,7 +34,7 @@ int cirrus_framebuffer_init(struct drm_device *dev,
 {
        int ret;
 
-       drm_helper_mode_fill_fb_struct(&gfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
        gfb->obj = obj;
        ret = drm_framebuffer_init(dev, &gfb->base, &cirrus_fb_funcs);
        if (ret) {
index 81b3558302b5ab7a307bb9c852859b043dd34378..570f5c6063f383a5b06015a0989d821657f77f9b 100644 (file)
@@ -147,7 +147,7 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
        if (!fb_cma)
                return ERR_PTR(-ENOMEM);
 
-       drm_helper_mode_fill_fb_struct(&fb_cma->fb, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &fb_cma->fb, mode_cmd);
 
        for (i = 0; i < num_planes; i++)
                fb_cma->obj[i] = obj[i];
index cc232ac6c9503842caac3043fb0a827530fde9fa..285ffcba0fe8781fe345640f0e39ab8f2ad5ebe7 100644 (file)
@@ -68,7 +68,8 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
  * This helper can be used in a drivers fb_create callback to pre-fill the fb's
  * metadata fields.
  */
-void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
+void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
+                                   struct drm_framebuffer *fb,
                                    const struct drm_mode_fb_cmd2 *mode_cmd)
 {
        const struct drm_format_info *info;
index 23cce0a3f5fcc842cd708edb594fea9700feec5f..68d414227533982899c58f7105d09702fa75d138 100644 (file)
@@ -126,7 +126,7 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
                                                + mode_cmd->offsets[i];
        }
 
-       drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &exynos_fb->fb, mode_cmd);
 
        ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
        if (ret < 0) {
index 4071b2d1e8cfcda44d9479e0a457f312df8cdc76..6d89ed76094196acfdbb35bc664190c8fa70530b 100644 (file)
@@ -244,7 +244,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
        if (mode_cmd->pitches[0] & 63)
                return -EINVAL;
 
-       drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &fb->base, mode_cmd);
        fb->gtt = gt;
        ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs);
        if (ret) {
index e76abf61edae4a42cd5ae698e85923ea90e02b05..3c6f750389fb07311c7ed11d1a4f8df66fbafc2f 100644 (file)
@@ -512,7 +512,7 @@ hibmc_framebuffer_init(struct drm_device *dev,
                return ERR_PTR(-ENOMEM);
        }
 
-       drm_helper_mode_fill_fb_struct(&hibmc_fb->fb, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &hibmc_fb->fb, mode_cmd);
        hibmc_fb->obj = obj;
        ret = drm_framebuffer_init(dev, &hibmc_fb->fb, &hibmc_fb_funcs);
        if (ret) {
index cf5cff7b03b8528ce10590a1dd973bbfa2b87776..0d4a83310231c84e82ffd3268c063c4d64ad50c4 100644 (file)
@@ -15877,7 +15877,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
        if (mode_cmd->offsets[0] != 0)
                return -EINVAL;
 
-       drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &intel_fb->base, mode_cmd);
        intel_fb->obj = obj;
 
        ret = intel_fill_fb_info(dev_priv, &intel_fb->base);
index 147df85399ab6426c0e2aede83040ea5dbd1da6b..d4246c9dceae9804a7bef86784e4c665df3e500c 100644 (file)
@@ -82,7 +82,7 @@ static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,
        if (!mtk_fb)
                return ERR_PTR(-ENOMEM);
 
-       drm_helper_mode_fill_fb_struct(&mtk_fb->base, mode);
+       drm_helper_mode_fill_fb_struct(dev, &mtk_fb->base, mode);
 
        mtk_fb->gem_obj = obj;
 
index e79cbc25ae3c54048b21c6293ea340b91b0750fc..95d628b9457e56af865bf99ce0d1b137417915bc 100644 (file)
@@ -34,7 +34,7 @@ int mgag200_framebuffer_init(struct drm_device *dev,
 {
        int ret;
        
-       drm_helper_mode_fill_fb_struct(&gfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
        gfb->obj = obj;
        ret = drm_framebuffer_init(dev, &gfb->base, &mga_fb_funcs);
        if (ret) {
index 9acf544e7a8f7dbd2c81f60be91d5c4e0ea0bae4..ccefd6a30f37027bfdfd7eac2a9477e5180ab132 100644 (file)
@@ -217,7 +217,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
                msm_fb->planes[i] = bos[i];
        }
 
-       drm_helper_mode_fill_fb_struct(fb, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
 
        ret = drm_framebuffer_init(dev, fb, &msm_framebuffer_funcs);
        if (ret) {
index cef08da1da4e0bcb6a22fa73033562cdeea55006..e0db5d38fb18888888d5b18de7834a9fb2a9de53 100644 (file)
@@ -259,7 +259,7 @@ nouveau_framebuffer_new(struct drm_device *dev,
        if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
                return -ENOMEM;
 
-       drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &fb->base, mode_cmd);
        fb->nvbo = nvbo;
 
        ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs);
index 5f3337f1e9aaf007fcc86fb698e4cc442ab9ba3a..9875c99be009ada880e1cb15ad71174db16ee984 100644 (file)
@@ -457,7 +457,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
                plane->paddr  = 0;
        }
 
-       drm_helper_mode_fill_fb_struct(fb, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
 
        ret = drm_framebuffer_init(dev, fb, &omap_framebuffer_funcs);
        if (ret) {
index 4b5eab8a47b3edfc9a0cf2cc1a4aabc04c9bac9a..6cabb47c75b15f6eea086978510964a221c3bcc9 100644 (file)
@@ -629,7 +629,7 @@ qxl_framebuffer_init(struct drm_device *dev,
                qfb->obj = NULL;
                return ret;
        }
-       drm_helper_mode_fill_fb_struct(&qfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &qfb->base, mode_cmd);
        return 0;
 }
 
index e7409e8a9f877fd29baee683893a28cc2ae09a35..6285355eb5d562d7b9d5167929eb17bff4599f13 100644 (file)
@@ -1327,7 +1327,7 @@ radeon_framebuffer_init(struct drm_device *dev,
 {
        int ret;
        rfb->obj = obj;
-       drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
        ret = drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs);
        if (ret) {
                rfb->obj = NULL;
index 0f6eda023bd0cc7eb4611f2ec259172cac8dd14e..d5e1f8627d3864bdc4c0f7fbba869def8bf1fe3d 100644 (file)
@@ -92,7 +92,7 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cm
        if (!rockchip_fb)
                return ERR_PTR(-ENOMEM);
 
-       drm_helper_mode_fill_fb_struct(&rockchip_fb->fb, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &rockchip_fb->fb, mode_cmd);
 
        for (i = 0; i < num_planes; i++)
                rockchip_fb->obj[i] = obj[i];
index e4a5ab0a9677b0a782fa7f71a42d6cdd8cbf7907..a0096493f51cb2e33b9675f97140524593085521 100644 (file)
@@ -114,7 +114,7 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
 
        fb->num_planes = num_planes;
 
-       drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(drm, &fb->base, mode_cmd);
 
        for (i = 0; i < fb->num_planes; i++)
                fb->planes[i] = planes[i];
index 167f42c67c7cf5c67019a8eba409626dc391e672..fefd87f422ec747868112d76bddc5f19d245d47a 100644 (file)
@@ -330,7 +330,7 @@ udl_framebuffer_init(struct drm_device *dev,
        int ret;
 
        ufb->obj = obj;
-       drm_helper_mode_fill_fb_struct(&ufb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &ufb->base, mode_cmd);
        ret = drm_framebuffer_init(dev, &ufb->base, &udlfb_funcs);
        return ret;
 }
index 58048709c34e6ca0f48b03b3bc5638a3b93d7226..8b80fdd0e0a882ca59b8d2724b3fb64f6eb22b7c 100644 (file)
@@ -93,7 +93,7 @@ virtio_gpu_framebuffer_init(struct drm_device *dev,
                vgfb->obj = NULL;
                return ret;
        }
-       drm_helper_mode_fill_fb_struct(&vgfb->base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &vgfb->base, mode_cmd);
 
        spin_lock_init(&vgfb->dirty_lock);
        vgfb->x1 = vgfb->y1 = INT_MAX;
index e7daf59bac80e82eedc76eed554492ba68544713..cf22110e9eee3126e65f420d32b333449a16819e 100644 (file)
@@ -583,7 +583,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
                goto out_err1;
        }
 
-       drm_helper_mode_fill_fb_struct(&vfbs->base.base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &vfbs->base.base, mode_cmd);
        vfbs->surface = vmw_surface_reference(surface);
        vfbs->base.user_handle = mode_cmd->handles[0];
        vfbs->is_dmabuf_proxy = is_dmabuf_proxy;
@@ -864,7 +864,7 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv,
                goto out_err1;
        }
 
-       drm_helper_mode_fill_fb_struct(&vfbd->base.base, mode_cmd);
+       drm_helper_mode_fill_fb_struct(dev, &vfbd->base.base, mode_cmd);
        vfbd->base.dmabuf = true;
        vfbd->buffer = vmw_dmabuf_reference(dmabuf);
        vfbd->base.user_handle = mode_cmd->handles[0];
index b8051d5abe102a3ab4d6a623c51f6db51878901f..cb0ec92e11e60fbdfb942761ccb7dc2063f1dc73 100644 (file)
@@ -27,7 +27,8 @@
 
 void drm_helper_move_panel_connectors_to_head(struct drm_device *);
 
-void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
+void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
+                                   struct drm_framebuffer *fb,
                                    const struct drm_mode_fb_cmd2 *mode_cmd);
 
 int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,