drm: Rely on mode_config data for fb_helper initialization
Subsystems (37)
PATCH v2 1/1 drm: Rely on mode_config data for fb_helper initialization
Instead of receiving the num_crts as a parameter, we can read it directly from the mode_config structure. I audited the drivers that invoke this helper and I believe all of them initialize the mode_config struct accordingly, prior to calling the fb_helper.
I used the following coccinelle hack to make this transformation, except for the function headers and comment updates. The first and second rules are split because I couldn't find a way to remove the unused temporary variables at the same time I removed the parameter.
// <smpl>
@r@
expression A,B,D,E;
identifier C;
@@
(
- drm_fb_helper_init(A,B,C,D)
+ drm_fb_helper_init(A,B,D)
|
- drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+ drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
- drm_fbdev_cma_init(A,B,C,D)
+ drm_fbdev_cma_init(A,B,D)
)
@@
expression A,B,C,D,E;
@@
(
- drm_fb_helper_init(A,B,C,D)
+ drm_fb_helper_init(A,B,D)
|
- drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+ drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
- drm_fbdev_cma_init(A,B,C,D)
+ drm_fbdev_cma_init(A,B,D)
)
@@
identifier r.C;
type T;
expression V;
@@
- T C;
<...
when != C
- C = V;
...>
// </smpl>
Changes since v1:
- Rebased on top of the tip of drm-misc-next.
- Remove mention to sti since a proper fix got merged.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 1 - drivers/gpu/drm/arc/arcpgu_drv.c | 3 +-- drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/arm/malidp_drv.c | 2 +- drivers/gpu/drm/armada/armada_fbdev.c | 2 +- drivers/gpu/drm/ast/ast_fb.c | 3 +-- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 - drivers/gpu/drm/bochs/bochs_fbdev.c | 3 +-- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +- drivers/gpu/drm/drm_fb_cma_helper.c | 15 +++++++-------- drivers/gpu/drm/drm_fb_helper.c | 10 +++++----- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 5 +---- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 3 +-- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- drivers/gpu/drm/i915/intel_fbdev.c | 3 +-- drivers/gpu/drm/imx/imx-drm-core.c | 3 +-- drivers/gpu/drm/meson/meson_drv.c | 1 - drivers/gpu/drm/mgag200/mgag200_fb.c | 2 +- drivers/gpu/drm/msm/msm_fbdev.c | 3 +-- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +-- drivers/gpu/drm/qxl/qxl_fb.c | 1 - drivers/gpu/drm/radeon/radeon_fb.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 5 +---- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 +--- drivers/gpu/drm/tegra/fb.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 +-- drivers/gpu/drm/udl/udl_fb.c | 3 +-- drivers/gpu/drm/vc4/vc4_kms.c | 1 - drivers/gpu/drm/virtio/virtgpu_fb.c | 1 - drivers/gpu/drm/zte/zx_drm_drv.c | 2 +- include/drm/drm_fb_cma_helper.h | 7 +++---- include/drm/drm_fb_helper.h | 3 +-- 38 files changed, 43 insertions(+), 73 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -1
@@ -374,7 +374,6 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev) &amdgpu_fb_helper_funcs); ret =drm_fb_helper_init (adev->ddev, &rfbdev->helper, - adev->mode_info.num_crtc,AMDGPUFB_CONN_LIMIT );if (ret) {kfree (rfbdev);
drivers/gpu/drm/arc/arcpgu_drv.c +1 -2
@@ -135,8 +135,7 @@ static int arcpgu_load(struct drm_device *drm)drm_kms_helper_poll_init (drm); arcpgu->fbdev =drm_fbdev_cma_init (drm,16 , - drm->mode_config.num_crtc, - drm->mode_config.num_connector); + drm->mode_config.num_connector);if (IS_ERR (arcpgu->fbdev)) { ret =PTR_ERR (arcpgu->fbdev); arcpgu->fbdev =NULL ;
drivers/gpu/drm/arm/hdlcd_drv.c +1 -1
@@ -349,7 +349,7 @@ static int hdlcd_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (hdlcd->fbdev)) {
drivers/gpu/drm/arm/malidp_drv.c +1 -1
@@ -457,7 +457,7 @@ static int malidp_bind(struct device *dev)drm_mode_config_reset (drm); - malidp->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + malidp->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (malidp->fbdev)) {
drivers/gpu/drm/armada/armada_fbdev.c +1 -1
@@ -137,7 +137,7 @@ int armada_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, fbh, &armada_fb_helper_funcs); - ret =drm_fb_helper_init (dev, fbh,1 ,1 ); + ret =drm_fb_helper_init (dev, fbh,1 );if (ret) {DRM_ERROR ("failed to initialize drm fb helper\n" ); goto err_fb_helper;
drivers/gpu/drm/ast/ast_fb.c +1 -2
@@ -315,8 +315,7 @@ int ast_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &afbdev->helper, &ast_fb_helper_funcs); - ret =drm_fb_helper_init (dev, &afbdev->helper, -1 ,1 ); + ret =drm_fb_helper_init (dev, &afbdev->helper,1 );if (ret) goto free;
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +0 -1
@@ -647,7 +647,6 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)platform_set_drvdata (pdev, dev); dc->fbdev =drm_fbdev_cma_init (dev,24 , - dev->mode_config.num_crtc, dev->mode_config.num_connector);if (IS_ERR (dc->fbdev)) dc->fbdev =NULL ;
drivers/gpu/drm/bochs/bochs_fbdev.c +1 -2
@@ -169,8 +169,7 @@ int bochs_fbdev_init(struct bochs_device *bochs)drm_fb_helper_prepare (bochs->dev, &bochs->fb.helper, &bochs_fb_helper_funcs); - ret =drm_fb_helper_init (bochs->dev, &bochs->fb.helper, -1 ,1 ); + ret =drm_fb_helper_init (bochs->dev, &bochs->fb.helper,1 );if (ret)return ret;
drivers/gpu/drm/cirrus/cirrus_fbdev.c +1 -1
@@ -289,7 +289,7 @@ int cirrus_fbdev_init(struct cirrus_device *cdev) &cirrus_fb_helper_funcs); ret =drm_fb_helper_init (cdev->dev, &gfbdev->helper, - cdev->num_crtc,CIRRUSFB_CONN_LIMIT ); +CIRRUSFB_CONN_LIMIT );if (ret)return ret;
drivers/gpu/drm/drm_fb_cma_helper.c +7 -8
@@ -489,15 +489,14 @@ static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {* drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device -* @num_crtc: Number of CRTCs * @max_conn_count: Maximum number of connectors * @funcs: fb helper functions, in particular a custom dirty() callback * * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count,const struct drm_framebuffer_funcs *funcs) +unsigned int preferred_bpp,unsigned int max_conn_count, +const struct drm_framebuffer_funcs *funcs) {struct drm_fbdev_cma *fbdev_cma;struct drm_fb_helper *helper;
@@ -514,7 +513,7 @@ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,drm_fb_helper_prepare (dev, helper, &drm_fb_cma_helper_funcs); - ret =drm_fb_helper_init (dev, helper, num_crtc, max_conn_count); + ret =drm_fb_helper_init (dev, helper, max_conn_count);if (ret <0 ) {dev_err (dev->dev,"Failed to initialize drm fb helper.\n" ); goto err_free;
@@ -554,11 +553,11 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);* Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count) +unsigned int preferred_bpp,unsigned int max_conn_count) { -return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, num_crtc, - max_conn_count, &drm_fb_cma_funcs); +return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, + max_conn_count, + &drm_fb_cma_funcs); }EXPORT_SYMBOL_GPL (drm_fbdev_cma_init);
drivers/gpu/drm/drm_fb_helper.c +5 -5
@@ -712,7 +712,6 @@ EXPORT_SYMBOL(drm_fb_helper_prepare);* drm_fb_helper_init - initialize a drm_fb_helper structure * @dev: drm device * @fb_helper: driver-allocated fbdev helper structure to initialize -* @crtc_count: maximum number of crtcs to support in this fbdev emulation * @max_conn_count: max connector count * * This allocates the structures for the fbdev helper with the given limits.
@@ -727,9 +726,10 @@ EXPORT_SYMBOL(drm_fb_helper_prepare);*/ int drm_fb_helper_init (struct drm_device *dev,struct drm_fb_helper *fb_helper, -int crtc_count,int max_conn_count) +int max_conn_count) {struct drm_crtc *crtc; +struct drm_mode_config *config = &dev->mode_config;int i;if (!drm_fbdev_emulation)
@@ -738,11 +738,11 @@ int drm_fb_helper_init(struct drm_device *dev,if (!max_conn_count)return -EINVAL ; - fb_helper->crtc_info =kcalloc (crtc_count,sizeof (struct drm_fb_helper_crtc ),GFP_KERNEL ); + fb_helper->crtc_info =kcalloc (config->num_crtc,sizeof (struct drm_fb_helper_crtc ),GFP_KERNEL );if (!fb_helper->crtc_info)return -ENOMEM ; - fb_helper->crtc_count = crtc_count; + fb_helper->crtc_count = config->num_crtc; fb_helper->connector_info =kcalloc (dev->mode_config.num_connector,sizeof (struct drm_fb_helper_connector *),GFP_KERNEL );if (!fb_helper->connector_info) {kfree (fb_helper->crtc_info);
@@ -751,7 +751,7 @@ int drm_fb_helper_init(struct drm_device *dev, fb_helper->connector_info_alloc_count = dev->mode_config.num_connector; fb_helper->connector_count =0 ; -for (i =0 ; i < crtc_count; i++) { +for (i =0 ; i < fb_helper->crtc_count; i++) { fb_helper->crtc_info[i].mode_set.connectors = kcalloc(max_conn_count, sizeof(struct drm_connector *),
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +1 -4
@@ -208,7 +208,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)struct exynos_drm_fbdev *fbdev;struct exynos_drm_private *private = dev->dev_private;struct drm_fb_helper *helper; -unsigned int num_crtc;int ret;if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)
@@ -225,9 +224,7 @@ int exynos_drm_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &exynos_drm_fb_helper_funcs); - num_crtc = dev->mode_config.num_crtc; - - ret =drm_fb_helper_init (dev, helper, num_crtc,MAX_CONNECTOR ); + ret =drm_fb_helper_init (dev, helper,MAX_CONNECTOR );if (ret <0 ) {DRM_ERROR ("failed to initialize drm fb helper.\n" ); goto err_init;
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1 -1
@@ -94,7 +94,7 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth =24 ; } - fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 ,1 ); + fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 );if (IS_ERR (fsl_dev->fbdev)) { ret =PTR_ERR (fsl_dev->fbdev); fsl_dev->fbdev =NULL ;
drivers/gpu/drm/gma500/framebuffer.c +1 -1
@@ -564,7 +564,7 @@ int psb_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs); ret =drm_fb_helper_init (dev, &fbdev->psb_fb_helper, - dev_priv->ops->crtcs,INTELFB_CONN_LIMIT ); +INTELFB_CONN_LIMIT );if (ret) goto free;
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c +1 -2
@@ -200,8 +200,7 @@ int hibmc_fbdev_init(struct hibmc_drm_private *priv) &hibmc_fbdev_helper_funcs);/* Now just one crtc and one channel */ - ret =drm_fb_helper_init (priv->dev, - &hifbdev->helper,1 ,1 ); + ret =drm_fb_helper_init (priv->dev, &hifbdev->helper,1 );if (ret) {DRM_ERROR ("failed to initialize fb helper: %d\n" , ret);return ret;
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -2
@@ -59,8 +59,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev)drm_fbdev_cma_hotplug_event (priv->fbdev); }else { priv->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_crtc, - dev->mode_config.num_connector); + dev->mode_config.num_connector);if (IS_ERR (priv->fbdev)) priv->fbdev =NULL ; }
drivers/gpu/drm/i915/intel_fbdev.c +1 -2
@@ -713,8 +713,7 @@ int intel_fbdev_init(struct drm_device *dev)if (!intel_fbdev_init_bios (dev, ifbdev)) ifbdev->preferred_bpp =32 ; - ret =drm_fb_helper_init (dev, &ifbdev->helper, -INTEL_INFO (dev_priv)->num_pipes,4 ); + ret =drm_fb_helper_init (dev, &ifbdev->helper,4 );if (ret) {kfree (ifbdev);return ret;
drivers/gpu/drm/imx/imx-drm-core.c +1 -2
@@ -389,8 +389,7 @@ static int imx_drm_bind(struct device *dev)dev_warn (dev,"Invalid legacyfb_depth. Defaulting to 16bpp\n" ); legacyfb_depth =16 ; } - imxdrm->fbhelper =drm_fbdev_cma_init (drm, legacyfb_depth, - drm->mode_config.num_crtc,MAX_CRTC ); + imxdrm->fbhelper =drm_fbdev_cma_init (drm, legacyfb_depth,MAX_CRTC );if (IS_ERR (imxdrm->fbhelper)) { ret =PTR_ERR (imxdrm->fbhelper); imxdrm->fbhelper =NULL ;
drivers/gpu/drm/meson/meson_drv.c +0 -1
@@ -279,7 +279,6 @@ static int meson_drv_probe(struct platform_device *pdev) drm->mode_config.funcs = &meson_mode_config_funcs; priv->fbdev =drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_crtc, drm->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev);
drivers/gpu/drm/mgag200/mgag200_fb.c +1 -1
@@ -286,7 +286,7 @@ int mgag200_fbdev_init(struct mga_device *mdev)drm_fb_helper_prepare (mdev->dev, &mfbdev->helper, &mga_fb_helper_funcs); ret =drm_fb_helper_init (mdev->dev, &mfbdev->helper, - mdev->num_crtc,MGAG200FB_CONN_LIMIT ); +MGAG200FB_CONN_LIMIT );if (ret) goto err_fb_helper;
drivers/gpu/drm/msm/msm_fbdev.c +1 -2
@@ -201,8 +201,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &msm_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, - priv->num_crtcs, priv->num_connectors); + ret =drm_fb_helper_init (dev, helper, priv->num_connectors);if (ret) {dev_err (dev->dev,"could not init fbdev: ret=%d\n" , ret); goto fail;
drivers/gpu/drm/mxsfb/mxsfb_drv.c +1 -1
@@ -218,7 +218,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)drm_kms_helper_poll_init (drm); - mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (mxsfb->fbdev)) { mxsfb->fbdev =NULL ;
drivers/gpu/drm/nouveau/nouveau_fbcon.c +1 -2
@@ -507,8 +507,7 @@ nouveau_fbcon_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &fbcon->helper, &nouveau_fbcon_helper_funcs); - ret =drm_fb_helper_init (dev, &fbcon->helper, - dev->mode_config.num_crtc,4 ); + ret =drm_fb_helper_init (dev, &fbcon->helper,4 );if (ret) goto free;
drivers/gpu/drm/omapdrm/omap_fbdev.c +1 -2
@@ -263,8 +263,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &omap_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, - priv->num_crtcs, priv->num_connectors); + ret =drm_fb_helper_init (dev, helper, priv->num_connectors);if (ret) {dev_err (dev->dev,"could not init fbdev: ret=%d\n" , ret); goto fail;
drivers/gpu/drm/qxl/qxl_fb.c +0 -1
@@ -399,7 +399,6 @@ int qxl_fbdev_init(struct qxl_device *qdev) &qxl_fb_helper_funcs); ret =drm_fb_helper_init (&qdev->ddev, &qfbdev->helper, - qxl_num_crtc,QXLFB_CONN_LIMIT );if (ret) goto free;
drivers/gpu/drm/radeon/radeon_fb.c +0 -1
@@ -366,7 +366,6 @@ int radeon_fbdev_init(struct radeon_device *rdev) &radeon_fb_helper_funcs); ret =drm_fb_helper_init (rdev->ddev, &rfbdev->helper, - rdev->num_crtc,RADEONFB_CONN_LIMIT );if (ret) goto free;
drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 -1
@@ -662,7 +662,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)drm_kms_helper_poll_init (dev);if (dev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (dev,32 , dev->mode_config.num_crtc, + fbdev =drm_fbdev_cma_init (dev,32 , dev->mode_config.num_connector);if (IS_ERR (fbdev))return PTR_ERR (fbdev);
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c +1 -4
@@ -129,19 +129,16 @@ int rockchip_drm_fbdev_init(struct drm_device *dev) {struct rockchip_drm_private *private = dev->dev_private;struct drm_fb_helper *helper; -unsigned int num_crtc;int ret;if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)return -EINVAL ; - num_crtc = dev->mode_config.num_crtc; - helper = &private->fbdev_helper;drm_fb_helper_prepare (dev, helper, &rockchip_drm_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, num_crtc,ROCKCHIP_MAX_CONNECTOR ); + ret =drm_fb_helper_init (dev, helper,ROCKCHIP_MAX_CONNECTOR );if (ret <0 ) {dev_err (dev->dev,"Failed to initialize drm fb helper - %d.\n" , ret);
drivers/gpu/drm/sti/sti_drv.c +1 -1
@@ -360,7 +360,7 @@ static int sti_bind(struct device *dev) private = ddev->dev_private;if (ddev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (ddev,32 , ddev->mode_config.num_crtc, + fbdev =drm_fbdev_cma_init (ddev,32 , ddev->mode_config.num_connector);if (IS_ERR (fbdev)) {DRM_DEBUG_DRIVER ("Warning: fails to create fbdev\n" );
drivers/gpu/drm/sun4i/sun4i_framebuffer.c +1 -3
@@ -40,9 +40,7 @@ struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm) drm->mode_config.funcs = &sun4i_de_mode_config_funcs; -return drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_crtc, - drm->mode_config.num_connector); +return drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector); }void sun4i_framebuffer_free (struct drm_device *drm)
drivers/gpu/drm/tegra/fb.c +1 -1
@@ -309,7 +309,7 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,struct drm_device *drm = fbdev->base.dev;int err; - err =drm_fb_helper_init (drm, &fbdev->base, num_crtc, max_connectors); + err =drm_fb_helper_init (drm, &fbdev->base, max_connectors);if (err <0 ) {dev_err (drm->dev,"failed to initialize DRM FB helper: %d\n" , err);
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -2
@@ -403,8 +403,7 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)drm_mode_config_reset (ddev); priv->fbdev =drm_fbdev_cma_init (ddev, bpp, - ddev->mode_config.num_crtc, - ddev->mode_config.num_connector); + ddev->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev); goto init_failed;
drivers/gpu/drm/udl/udl_fb.c +1 -2
@@ -441,8 +441,7 @@ int udl_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &ufbdev->helper, &udl_fb_helper_funcs); - ret =drm_fb_helper_init (dev, &ufbdev->helper, -1 ,1 ); + ret =drm_fb_helper_init (dev, &ufbdev->helper,1 );if (ret) goto free;
drivers/gpu/drm/vc4/vc4_kms.c +0 -1
@@ -231,7 +231,6 @@ int vc4_kms_load(struct drm_device *dev)drm_mode_config_reset (dev); vc4->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_crtc, dev->mode_config.num_connector);if (IS_ERR (vc4->fbdev)) vc4->fbdev =NULL ;
drivers/gpu/drm/virtio/virtgpu_fb.c +0 -1
@@ -387,7 +387,6 @@ int virtio_gpu_fbdev_init(struct virtio_gpu_device *vgdev)drm_fb_helper_prepare (vgdev->ddev, &vgfbdev->helper, &virtio_gpu_fb_helper_funcs); ret =drm_fb_helper_init (vgdev->ddev, &vgfbdev->helper, - vgdev->num_scanouts,VIRTIO_GPUFB_CONN_LIMIT );if (ret) {kfree (vgfbdev);
drivers/gpu/drm/zte/zx_drm_drv.c +1 -1
@@ -141,7 +141,7 @@ static int zx_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - priv->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + priv->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev);
include/drm/drm_fb_cma_helper.h +3 -4
@@ -16,11 +16,10 @@ struct drm_plane;struct drm_plane_state ;struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count,const struct drm_framebuffer_funcs *funcs); +unsigned int preferred_bpp,unsigned int max_conn_count, +const struct drm_framebuffer_funcs *funcs);struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count); +unsigned int preferred_bpp,unsigned int max_conn_count);void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma);void drm_fbdev_cma_restore_mode (struct drm_fbdev_cma *fbdev_cma);
include/drm/drm_fb_helper.h +1 -2
@@ -236,8 +236,7 @@ struct drm_fb_helper {void drm_fb_helper_prepare (struct drm_device *dev,struct drm_fb_helper *helper,const struct drm_fb_helper_funcs *funcs);int drm_fb_helper_init (struct drm_device *dev, -struct drm_fb_helper *helper,int crtc_count, -int max_conn); +struct drm_fb_helper *helper,int max_conn);void drm_fb_helper_fini (struct drm_fb_helper *helper);int drm_fb_helper_blank (int blank,struct fb_info *info); int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 52 lines · Gabriel Krisman Bertazi
Instead of receiving the
num_crtsas a parameter, we can read it directly from themode_configstructure. I audited the drivers that invoke this helper and I believe all of them initialize themode_configstruct accordingly, prior to calling thefb_helper.I used the following coccinelle hack to make this transformation, except for the function headers and comment updates. The first and second rules are split because I couldn't find a way to remove the unused temporary variables at the same time I removed the parameter.
// <smpl>
@r@
expression A,B,D,E;
identifier C;
@@
(
-drm_fb_helper_init(A,B,C,D)
+drm_fb_helper_init(A,B,D)
|
-drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
-drm_fbdev_cma_init(A,B,C,D)
+drm_fbdev_cma_init(A,B,D)
)@@
expression A,B,C,D,E;
@@
(
-drm_fb_helper_init(A,B,C,D)
+drm_fb_helper_init(A,B,D)
|
-drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
-drm_fbdev_cma_init(A,B,C,D)
+drm_fbdev_cma_init(A,B,D)
)@@
identifier r.C;
type T;
expression V;
@@
- T C;
<...
when != C
- C = V;
...>
// </smpl>
Quoted 7 lines
Changes since v1:
- Rebased on top of the tip of drm-misc-next.
- Remove mention to sti since a proper fix got merged.Suggested-by Daniel Vetter <[email protected]>Signed-off-by Gabriel Krisman Bertazi <[email protected]>Reviewed-by Eric Anholt <[email protected]>
Yup, this applied cleanly, thanks for respinning.
-Daniel
Quoted 646 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 1 - drivers/gpu/drm/arc/arcpgu_drv.c | 3 +-- drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/arm/malidp_drv.c | 2 +- drivers/gpu/drm/armada/armada_fbdev.c | 2 +- drivers/gpu/drm/ast/ast_fb.c | 3 +-- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 - drivers/gpu/drm/bochs/bochs_fbdev.c | 3 +-- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +- drivers/gpu/drm/drm_fb_cma_helper.c | 15 +++++++-------- drivers/gpu/drm/drm_fb_helper.c | 10 +++++----- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 5 +---- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 3 +-- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- drivers/gpu/drm/i915/intel_fbdev.c | 3 +-- drivers/gpu/drm/imx/imx-drm-core.c | 3 +-- drivers/gpu/drm/meson/meson_drv.c | 1 - drivers/gpu/drm/mgag200/mgag200_fb.c | 2 +- drivers/gpu/drm/msm/msm_fbdev.c | 3 +-- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +-- drivers/gpu/drm/qxl/qxl_fb.c | 1 - drivers/gpu/drm/radeon/radeon_fb.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 5 +---- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 +--- drivers/gpu/drm/tegra/fb.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 +-- drivers/gpu/drm/udl/udl_fb.c | 3 +-- drivers/gpu/drm/vc4/vc4_kms.c | 1 - drivers/gpu/drm/virtio/virtgpu_fb.c | 1 - drivers/gpu/drm/zte/zx_drm_drv.c | 2 +- include/drm/drm_fb_cma_helper.h | 7 +++---- include/drm/drm_fb_helper.h | 3 +-- 38 files changed, 43 insertions(+), 73 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0
-1@@ -374,7 +374,6 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev) &amdgpu_fb_helper_funcs); ret =drm_fb_helper_init (adev->ddev, &rfbdev->helper, - adev->mode_info.num_crtc,AMDGPUFB_CONN_LIMIT );if (ret) {kfree (rfbdev);drivers/gpu/drm/arc/arcpgu_drv.c +1
-2@@ -135,8 +135,7 @@ static int arcpgu_load(struct drm_device *drm)drm_kms_helper_poll_init (drm); arcpgu->fbdev =drm_fbdev_cma_init (drm,16 , - drm->mode_config.num_crtc, - drm->mode_config.num_connector); + drm->mode_config.num_connector);if (IS_ERR (arcpgu->fbdev)) { ret =PTR_ERR (arcpgu->fbdev); arcpgu->fbdev =NULL ;drivers/gpu/drm/arm/hdlcd_drv.c +1
-1@@ -349,7 +349,7 @@ static int hdlcd_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (hdlcd->fbdev)) {drivers/gpu/drm/arm/malidp_drv.c +1
-1@@ -457,7 +457,7 @@ static int malidp_bind(struct device *dev)drm_mode_config_reset (drm); - malidp->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + malidp->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (malidp->fbdev)) {drivers/gpu/drm/armada/armada_fbdev.c +1
-1@@ -137,7 +137,7 @@ int armada_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, fbh, &armada_fb_helper_funcs); - ret =drm_fb_helper_init (dev, fbh,1 ,1 ); + ret =drm_fb_helper_init (dev, fbh,1 );if (ret) {DRM_ERROR ("failed to initialize drm fb helper\n" ); goto err_fb_helper;drivers/gpu/drm/ast/ast_fb.c +1
-2@@ -315,8 +315,7 @@ int ast_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &afbdev->helper, &ast_fb_helper_funcs); - ret =drm_fb_helper_init (dev, &afbdev->helper, -1 ,1 ); + ret =drm_fb_helper_init (dev, &afbdev->helper,1 );if (ret) goto free;drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +0
-1@@ -647,7 +647,6 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)platform_set_drvdata (pdev, dev); dc->fbdev =drm_fbdev_cma_init (dev,24 , - dev->mode_config.num_crtc, dev->mode_config.num_connector);if (IS_ERR (dc->fbdev)) dc->fbdev =NULL ;drivers/gpu/drm/bochs/bochs_fbdev.c +1
-2@@ -169,8 +169,7 @@ int bochs_fbdev_init(struct bochs_device *bochs)drm_fb_helper_prepare (bochs->dev, &bochs->fb.helper, &bochs_fb_helper_funcs); - ret =drm_fb_helper_init (bochs->dev, &bochs->fb.helper, -1 ,1 ); + ret =drm_fb_helper_init (bochs->dev, &bochs->fb.helper,1 );if (ret)return ret;drivers/gpu/drm/cirrus/cirrus_fbdev.c +1
-1@@ -289,7 +289,7 @@ int cirrus_fbdev_init(struct cirrus_device *cdev) &cirrus_fb_helper_funcs); ret =drm_fb_helper_init (cdev->dev, &gfbdev->helper, - cdev->num_crtc,CIRRUSFB_CONN_LIMIT ); +CIRRUSFB_CONN_LIMIT );if (ret)return ret;drivers/gpu/drm/drm_fb_cma_helper.c +7
-8@@ -489,15 +489,14 @@ static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {* drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device -* @num_crtc: Number of CRTCs * @max_conn_count: Maximum number of connectors * @funcs: fb helper functions, in particular a custom dirty() callback * * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count,const struct drm_framebuffer_funcs *funcs) +unsigned int preferred_bpp,unsigned int max_conn_count, +const struct drm_framebuffer_funcs *funcs) {struct drm_fbdev_cma *fbdev_cma;struct drm_fb_helper *helper;@@ -514,7 +513,7 @@ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,drm_fb_helper_prepare (dev, helper, &drm_fb_cma_helper_funcs); - ret =drm_fb_helper_init (dev, helper, num_crtc, max_conn_count); + ret =drm_fb_helper_init (dev, helper, max_conn_count);if (ret <0 ) {dev_err (dev->dev,"Failed to initialize drm fb helper.\n" ); goto err_free;@@ -554,11 +553,11 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);* Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count) +unsigned int preferred_bpp,unsigned int max_conn_count) { -return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, num_crtc, - max_conn_count, &drm_fb_cma_funcs); +return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, + max_conn_count, + &drm_fb_cma_funcs); }EXPORT_SYMBOL_GPL (drm_fbdev_cma_init);drivers/gpu/drm/drm_fb_helper.c +5
-5@@ -712,7 +712,6 @@ EXPORT_SYMBOL(drm_fb_helper_prepare);* drm_fb_helper_init - initialize a drm_fb_helper structure * @dev: drm device * @fb_helper: driver-allocated fbdev helper structure to initialize -* @crtc_count: maximum number of crtcs to support in this fbdev emulation * @max_conn_count: max connector count * * This allocates the structures for the fbdev helper with the given limits. @@ -727,9 +726,10 @@ EXPORT_SYMBOL(drm_fb_helper_prepare);*/ int drm_fb_helper_init (struct drm_device *dev,struct drm_fb_helper *fb_helper, -int crtc_count,int max_conn_count) +int max_conn_count) {struct drm_crtc *crtc; +struct drm_mode_config *config = &dev->mode_config;int i;if (!drm_fbdev_emulation)@@ -738,11 +738,11 @@ int drm_fb_helper_init(struct drm_device *dev,if (!max_conn_count)return -EINVAL ; - fb_helper->crtc_info =kcalloc (crtc_count,sizeof (struct drm_fb_helper_crtc ),GFP_KERNEL ); + fb_helper->crtc_info =kcalloc (config->num_crtc,sizeof (struct drm_fb_helper_crtc ),GFP_KERNEL );if (!fb_helper->crtc_info)return -ENOMEM ; - fb_helper->crtc_count = crtc_count; + fb_helper->crtc_count = config->num_crtc; fb_helper->connector_info =kcalloc (dev->mode_config.num_connector,sizeof (struct drm_fb_helper_connector *),GFP_KERNEL );if (!fb_helper->connector_info) {kfree (fb_helper->crtc_info);@@ -751,7 +751,7 @@ int drm_fb_helper_init(struct drm_device *dev, fb_helper->connector_info_alloc_count = dev->mode_config.num_connector; fb_helper->connector_count =0 ; -for (i =0 ; i < crtc_count; i++) { +for (i =0 ; i < fb_helper->crtc_count; i++) { fb_helper->crtc_info[i].mode_set.connectors = kcalloc(max_conn_count, sizeof(struct drm_connector *),drivers/gpu/drm/exynos/exynos_drm_fbdev.c +1
-4@@ -208,7 +208,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)struct exynos_drm_fbdev *fbdev;struct exynos_drm_private *private = dev->dev_private;struct drm_fb_helper *helper; -unsigned int num_crtc;int ret;if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)@@ -225,9 +224,7 @@ int exynos_drm_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &exynos_drm_fb_helper_funcs); - num_crtc = dev->mode_config.num_crtc; - - ret =drm_fb_helper_init (dev, helper, num_crtc,MAX_CONNECTOR ); + ret =drm_fb_helper_init (dev, helper,MAX_CONNECTOR );if (ret <0 ) {DRM_ERROR ("failed to initialize drm fb helper.\n" ); goto err_init;drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1
-1@@ -94,7 +94,7 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth =24 ; } - fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 ,1 ); + fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 );if (IS_ERR (fsl_dev->fbdev)) { ret =PTR_ERR (fsl_dev->fbdev); fsl_dev->fbdev =NULL ;drivers/gpu/drm/gma500/framebuffer.c +1
-1@@ -564,7 +564,7 @@ int psb_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs); ret =drm_fb_helper_init (dev, &fbdev->psb_fb_helper, - dev_priv->ops->crtcs,INTELFB_CONN_LIMIT ); +INTELFB_CONN_LIMIT );if (ret) goto free;drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c +1
-2@@ -200,8 +200,7 @@ int hibmc_fbdev_init(struct hibmc_drm_private *priv) &hibmc_fbdev_helper_funcs);/* Now just one crtc and one channel */ - ret =drm_fb_helper_init (priv->dev, - &hifbdev->helper,1 ,1 ); + ret =drm_fb_helper_init (priv->dev, &hifbdev->helper,1 );if (ret) {DRM_ERROR ("failed to initialize fb helper: %d\n" , ret);return ret;drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1
-2@@ -59,8 +59,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev)drm_fbdev_cma_hotplug_event (priv->fbdev); }else { priv->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_crtc, - dev->mode_config.num_connector); + dev->mode_config.num_connector);if (IS_ERR (priv->fbdev)) priv->fbdev =NULL ; }drivers/gpu/drm/i915/intel_fbdev.c +1
-2@@ -713,8 +713,7 @@ int intel_fbdev_init(struct drm_device *dev)if (!intel_fbdev_init_bios (dev, ifbdev)) ifbdev->preferred_bpp =32 ; - ret =drm_fb_helper_init (dev, &ifbdev->helper, -INTEL_INFO (dev_priv)->num_pipes,4 ); + ret =drm_fb_helper_init (dev, &ifbdev->helper,4 );if (ret) {kfree (ifbdev);return ret;drivers/gpu/drm/imx/imx-drm-core.c +1
-2@@ -389,8 +389,7 @@ static int imx_drm_bind(struct device *dev)dev_warn (dev,"Invalid legacyfb_depth. Defaulting to 16bpp\n" ); legacyfb_depth =16 ; } - imxdrm->fbhelper =drm_fbdev_cma_init (drm, legacyfb_depth, - drm->mode_config.num_crtc,MAX_CRTC ); + imxdrm->fbhelper =drm_fbdev_cma_init (drm, legacyfb_depth,MAX_CRTC );if (IS_ERR (imxdrm->fbhelper)) { ret =PTR_ERR (imxdrm->fbhelper); imxdrm->fbhelper =NULL ;drivers/gpu/drm/meson/meson_drv.c +0
-1@@ -279,7 +279,6 @@ static int meson_drv_probe(struct platform_device *pdev) drm->mode_config.funcs = &meson_mode_config_funcs; priv->fbdev =drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_crtc, drm->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev);drivers/gpu/drm/mgag200/mgag200_fb.c +1
-1@@ -286,7 +286,7 @@ int mgag200_fbdev_init(struct mga_device *mdev)drm_fb_helper_prepare (mdev->dev, &mfbdev->helper, &mga_fb_helper_funcs); ret =drm_fb_helper_init (mdev->dev, &mfbdev->helper, - mdev->num_crtc,MGAG200FB_CONN_LIMIT ); +MGAG200FB_CONN_LIMIT );if (ret) goto err_fb_helper;drivers/gpu/drm/msm/msm_fbdev.c +1
-2@@ -201,8 +201,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &msm_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, - priv->num_crtcs, priv->num_connectors); + ret =drm_fb_helper_init (dev, helper, priv->num_connectors);if (ret) {dev_err (dev->dev,"could not init fbdev: ret=%d\n" , ret); goto fail;drivers/gpu/drm/mxsfb/mxsfb_drv.c +1
-1@@ -218,7 +218,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)drm_kms_helper_poll_init (drm); - mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (mxsfb->fbdev)) { mxsfb->fbdev =NULL ;drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-2@@ -507,8 +507,7 @@ nouveau_fbcon_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &fbcon->helper, &nouveau_fbcon_helper_funcs); - ret =drm_fb_helper_init (dev, &fbcon->helper, - dev->mode_config.num_crtc,4 ); + ret =drm_fb_helper_init (dev, &fbcon->helper,4 );if (ret) goto free;drivers/gpu/drm/omapdrm/omap_fbdev.c +1
-2@@ -263,8 +263,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &omap_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, - priv->num_crtcs, priv->num_connectors); + ret =drm_fb_helper_init (dev, helper, priv->num_connectors);if (ret) {dev_err (dev->dev,"could not init fbdev: ret=%d\n" , ret); goto fail;drivers/gpu/drm/qxl/qxl_fb.c +0
-1@@ -399,7 +399,6 @@ int qxl_fbdev_init(struct qxl_device *qdev) &qxl_fb_helper_funcs); ret =drm_fb_helper_init (&qdev->ddev, &qfbdev->helper, - qxl_num_crtc,QXLFB_CONN_LIMIT );if (ret) goto free;drivers/gpu/drm/radeon/radeon_fb.c +0
-1@@ -366,7 +366,6 @@ int radeon_fbdev_init(struct radeon_device *rdev) &radeon_fb_helper_funcs); ret =drm_fb_helper_init (rdev->ddev, &rfbdev->helper, - rdev->num_crtc,RADEONFB_CONN_LIMIT );if (ret) goto free;drivers/gpu/drm/rcar-du/rcar_du_kms.c +1
-1@@ -662,7 +662,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)drm_kms_helper_poll_init (dev);if (dev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (dev,32 , dev->mode_config.num_crtc, + fbdev =drm_fbdev_cma_init (dev,32 , dev->mode_config.num_connector);if (IS_ERR (fbdev))return PTR_ERR (fbdev);drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c +1
-4@@ -129,19 +129,16 @@ int rockchip_drm_fbdev_init(struct drm_device *dev) {struct rockchip_drm_private *private = dev->dev_private;struct drm_fb_helper *helper; -unsigned int num_crtc;int ret;if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)return -EINVAL ; - num_crtc = dev->mode_config.num_crtc; - helper = &private->fbdev_helper;drm_fb_helper_prepare (dev, helper, &rockchip_drm_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, num_crtc,ROCKCHIP_MAX_CONNECTOR ); + ret =drm_fb_helper_init (dev, helper,ROCKCHIP_MAX_CONNECTOR );if (ret <0 ) {dev_err (dev->dev,"Failed to initialize drm fb helper - %d.\n" , ret);drivers/gpu/drm/sti/sti_drv.c +1
-1@@ -360,7 +360,7 @@ static int sti_bind(struct device *dev) private = ddev->dev_private;if (ddev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (ddev,32 , ddev->mode_config.num_crtc, + fbdev =drm_fbdev_cma_init (ddev,32 , ddev->mode_config.num_connector);if (IS_ERR (fbdev)) {DRM_DEBUG_DRIVER ("Warning: fails to create fbdev\n" );drivers/gpu/drm/sun4i/sun4i_framebuffer.c +1
-3@@ -40,9 +40,7 @@ struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm) drm->mode_config.funcs = &sun4i_de_mode_config_funcs; -return drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_crtc, - drm->mode_config.num_connector); +return drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector); }void sun4i_framebuffer_free (struct drm_device *drm)drivers/gpu/drm/tegra/fb.c +1
-1@@ -309,7 +309,7 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,struct drm_device *drm = fbdev->base.dev;int err; - err =drm_fb_helper_init (drm, &fbdev->base, num_crtc, max_connectors); + err =drm_fb_helper_init (drm, &fbdev->base, max_connectors);if (err <0 ) {dev_err (drm->dev,"failed to initialize DRM FB helper: %d\n" , err);drivers/gpu/drm/tilcdc/tilcdc_drv.c +1
-2@@ -403,8 +403,7 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)drm_mode_config_reset (ddev); priv->fbdev =drm_fbdev_cma_init (ddev, bpp, - ddev->mode_config.num_crtc, - ddev->mode_config.num_connector); + ddev->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev); goto init_failed;drivers/gpu/drm/udl/udl_fb.c +1
-2@@ -441,8 +441,7 @@ int udl_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &ufbdev->helper, &udl_fb_helper_funcs); - ret =drm_fb_helper_init (dev, &ufbdev->helper, -1 ,1 ); + ret =drm_fb_helper_init (dev, &ufbdev->helper,1 );if (ret) goto free;drivers/gpu/drm/vc4/vc4_kms.c +0
-1@@ -231,7 +231,6 @@ int vc4_kms_load(struct drm_device *dev)drm_mode_config_reset (dev); vc4->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_crtc, dev->mode_config.num_connector);if (IS_ERR (vc4->fbdev)) vc4->fbdev =NULL ;drivers/gpu/drm/virtio/virtgpu_fb.c +0
-1@@ -387,7 +387,6 @@ int virtio_gpu_fbdev_init(struct virtio_gpu_device *vgdev)drm_fb_helper_prepare (vgdev->ddev, &vgfbdev->helper, &virtio_gpu_fb_helper_funcs); ret =drm_fb_helper_init (vgdev->ddev, &vgfbdev->helper, - vgdev->num_scanouts,VIRTIO_GPUFB_CONN_LIMIT );if (ret) {kfree (vgfbdev);drivers/gpu/drm/zte/zx_drm_drv.c +1
-1@@ -141,7 +141,7 @@ static int zx_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - priv->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + priv->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev);include/drm/drm_fb_cma_helper.h +3
-4@@ -16,11 +16,10 @@ struct drm_plane;struct drm_plane_state ;struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count,const struct drm_framebuffer_funcs *funcs); +unsigned int preferred_bpp,unsigned int max_conn_count, +const struct drm_framebuffer_funcs *funcs);struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count); +unsigned int preferred_bpp,unsigned int max_conn_count);void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma);void drm_fbdev_cma_restore_mode (struct drm_fbdev_cma *fbdev_cma);include/drm/drm_fb_helper.h +1
-2@@ -236,8 +236,7 @@ struct drm_fb_helper {void drm_fb_helper_prepare (struct drm_device *dev,struct drm_fb_helper *helper,const struct drm_fb_helper_funcs *funcs);int drm_fb_helper_init (struct drm_device *dev, -struct drm_fb_helper *helper,int crtc_count, -int max_conn); +struct drm_fb_helper *helper,int max_conn);void drm_fb_helper_fini (struct drm_fb_helper *helper);int drm_fb_helper_blank (int blank,struct fb_info *info); int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 52 lines · Gabriel Krisman Bertazi
Instead of receiving the
num_crtsas a parameter, we can read it directly from themode_configstructure. I audited the drivers that invoke this helper and I believe all of them initialize themode_configstruct accordingly, prior to calling thefb_helper.I used the following coccinelle hack to make this transformation, except for the function headers and comment updates. The first and second rules are split because I couldn't find a way to remove the unused temporary variables at the same time I removed the parameter.
// <smpl>
@r@
expression A,B,D,E;
identifier C;
@@
(
-drm_fb_helper_init(A,B,C,D)
+drm_fb_helper_init(A,B,D)
|
-drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
-drm_fbdev_cma_init(A,B,C,D)
+drm_fbdev_cma_init(A,B,D)
)@@
expression A,B,C,D,E;
@@
(
-drm_fb_helper_init(A,B,C,D)
+drm_fb_helper_init(A,B,D)
|
-drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
-drm_fbdev_cma_init(A,B,C,D)
+drm_fbdev_cma_init(A,B,D)
)@@
identifier r.C;
type T;
expression V;
@@
- T C;
<...
when != C
- C = V;
...>
// </smpl>
Quoted 7 lines
Changes since v1:
- Rebased on top of the tip of drm-misc-next.
- Remove mention to sti since a proper fix got merged.Suggested-by Daniel Vetter <[email protected]>Signed-off-by Gabriel Krisman Bertazi <[email protected]>Reviewed-by Eric Anholt <[email protected]>
You forgot to update the kernel-doc, building them now generates new warnings. Please fix in a follow-up patch.
Thanks, Daniel
Quoted 646 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 1 - drivers/gpu/drm/arc/arcpgu_drv.c | 3 +-- drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/arm/malidp_drv.c | 2 +- drivers/gpu/drm/armada/armada_fbdev.c | 2 +- drivers/gpu/drm/ast/ast_fb.c | 3 +-- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 - drivers/gpu/drm/bochs/bochs_fbdev.c | 3 +-- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +- drivers/gpu/drm/drm_fb_cma_helper.c | 15 +++++++-------- drivers/gpu/drm/drm_fb_helper.c | 10 +++++----- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 5 +---- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 3 +-- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- drivers/gpu/drm/i915/intel_fbdev.c | 3 +-- drivers/gpu/drm/imx/imx-drm-core.c | 3 +-- drivers/gpu/drm/meson/meson_drv.c | 1 - drivers/gpu/drm/mgag200/mgag200_fb.c | 2 +- drivers/gpu/drm/msm/msm_fbdev.c | 3 +-- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 +-- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +-- drivers/gpu/drm/qxl/qxl_fb.c | 1 - drivers/gpu/drm/radeon/radeon_fb.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 5 +---- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 +--- drivers/gpu/drm/tegra/fb.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 3 +-- drivers/gpu/drm/udl/udl_fb.c | 3 +-- drivers/gpu/drm/vc4/vc4_kms.c | 1 - drivers/gpu/drm/virtio/virtgpu_fb.c | 1 - drivers/gpu/drm/zte/zx_drm_drv.c | 2 +- include/drm/drm_fb_cma_helper.h | 7 +++---- include/drm/drm_fb_helper.h | 3 +-- 38 files changed, 43 insertions(+), 73 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0
-1@@ -374,7 +374,6 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev) &amdgpu_fb_helper_funcs); ret =drm_fb_helper_init (adev->ddev, &rfbdev->helper, - adev->mode_info.num_crtc,AMDGPUFB_CONN_LIMIT );if (ret) {kfree (rfbdev);drivers/gpu/drm/arc/arcpgu_drv.c +1
-2@@ -135,8 +135,7 @@ static int arcpgu_load(struct drm_device *drm)drm_kms_helper_poll_init (drm); arcpgu->fbdev =drm_fbdev_cma_init (drm,16 , - drm->mode_config.num_crtc, - drm->mode_config.num_connector); + drm->mode_config.num_connector);if (IS_ERR (arcpgu->fbdev)) { ret =PTR_ERR (arcpgu->fbdev); arcpgu->fbdev =NULL ;drivers/gpu/drm/arm/hdlcd_drv.c +1
-1@@ -349,7 +349,7 @@ static int hdlcd_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (hdlcd->fbdev)) {drivers/gpu/drm/arm/malidp_drv.c +1
-1@@ -457,7 +457,7 @@ static int malidp_bind(struct device *dev)drm_mode_config_reset (drm); - malidp->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + malidp->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (malidp->fbdev)) {drivers/gpu/drm/armada/armada_fbdev.c +1
-1@@ -137,7 +137,7 @@ int armada_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, fbh, &armada_fb_helper_funcs); - ret =drm_fb_helper_init (dev, fbh,1 ,1 ); + ret =drm_fb_helper_init (dev, fbh,1 );if (ret) {DRM_ERROR ("failed to initialize drm fb helper\n" ); goto err_fb_helper;drivers/gpu/drm/ast/ast_fb.c +1
-2@@ -315,8 +315,7 @@ int ast_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &afbdev->helper, &ast_fb_helper_funcs); - ret =drm_fb_helper_init (dev, &afbdev->helper, -1 ,1 ); + ret =drm_fb_helper_init (dev, &afbdev->helper,1 );if (ret) goto free;drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +0
-1@@ -647,7 +647,6 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)platform_set_drvdata (pdev, dev); dc->fbdev =drm_fbdev_cma_init (dev,24 , - dev->mode_config.num_crtc, dev->mode_config.num_connector);if (IS_ERR (dc->fbdev)) dc->fbdev =NULL ;drivers/gpu/drm/bochs/bochs_fbdev.c +1
-2@@ -169,8 +169,7 @@ int bochs_fbdev_init(struct bochs_device *bochs)drm_fb_helper_prepare (bochs->dev, &bochs->fb.helper, &bochs_fb_helper_funcs); - ret =drm_fb_helper_init (bochs->dev, &bochs->fb.helper, -1 ,1 ); + ret =drm_fb_helper_init (bochs->dev, &bochs->fb.helper,1 );if (ret)return ret;drivers/gpu/drm/cirrus/cirrus_fbdev.c +1
-1@@ -289,7 +289,7 @@ int cirrus_fbdev_init(struct cirrus_device *cdev) &cirrus_fb_helper_funcs); ret =drm_fb_helper_init (cdev->dev, &gfbdev->helper, - cdev->num_crtc,CIRRUSFB_CONN_LIMIT ); +CIRRUSFB_CONN_LIMIT );if (ret)return ret;drivers/gpu/drm/drm_fb_cma_helper.c +7
-8@@ -489,15 +489,14 @@ static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {* drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device -* @num_crtc: Number of CRTCs * @max_conn_count: Maximum number of connectors * @funcs: fb helper functions, in particular a custom dirty() callback * * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count,const struct drm_framebuffer_funcs *funcs) +unsigned int preferred_bpp,unsigned int max_conn_count, +const struct drm_framebuffer_funcs *funcs) {struct drm_fbdev_cma *fbdev_cma;struct drm_fb_helper *helper;@@ -514,7 +513,7 @@ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,drm_fb_helper_prepare (dev, helper, &drm_fb_cma_helper_funcs); - ret =drm_fb_helper_init (dev, helper, num_crtc, max_conn_count); + ret =drm_fb_helper_init (dev, helper, max_conn_count);if (ret <0 ) {dev_err (dev->dev,"Failed to initialize drm fb helper.\n" ); goto err_free;@@ -554,11 +553,11 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);* Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count) +unsigned int preferred_bpp,unsigned int max_conn_count) { -return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, num_crtc, - max_conn_count, &drm_fb_cma_funcs); +return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, + max_conn_count, + &drm_fb_cma_funcs); }EXPORT_SYMBOL_GPL (drm_fbdev_cma_init);drivers/gpu/drm/drm_fb_helper.c +5
-5@@ -712,7 +712,6 @@ EXPORT_SYMBOL(drm_fb_helper_prepare);* drm_fb_helper_init - initialize a drm_fb_helper structure * @dev: drm device * @fb_helper: driver-allocated fbdev helper structure to initialize -* @crtc_count: maximum number of crtcs to support in this fbdev emulation * @max_conn_count: max connector count * * This allocates the structures for the fbdev helper with the given limits. @@ -727,9 +726,10 @@ EXPORT_SYMBOL(drm_fb_helper_prepare);*/ int drm_fb_helper_init (struct drm_device *dev,struct drm_fb_helper *fb_helper, -int crtc_count,int max_conn_count) +int max_conn_count) {struct drm_crtc *crtc; +struct drm_mode_config *config = &dev->mode_config;int i;if (!drm_fbdev_emulation)@@ -738,11 +738,11 @@ int drm_fb_helper_init(struct drm_device *dev,if (!max_conn_count)return -EINVAL ; - fb_helper->crtc_info =kcalloc (crtc_count,sizeof (struct drm_fb_helper_crtc ),GFP_KERNEL ); + fb_helper->crtc_info =kcalloc (config->num_crtc,sizeof (struct drm_fb_helper_crtc ),GFP_KERNEL );if (!fb_helper->crtc_info)return -ENOMEM ; - fb_helper->crtc_count = crtc_count; + fb_helper->crtc_count = config->num_crtc; fb_helper->connector_info =kcalloc (dev->mode_config.num_connector,sizeof (struct drm_fb_helper_connector *),GFP_KERNEL );if (!fb_helper->connector_info) {kfree (fb_helper->crtc_info);@@ -751,7 +751,7 @@ int drm_fb_helper_init(struct drm_device *dev, fb_helper->connector_info_alloc_count = dev->mode_config.num_connector; fb_helper->connector_count =0 ; -for (i =0 ; i < crtc_count; i++) { +for (i =0 ; i < fb_helper->crtc_count; i++) { fb_helper->crtc_info[i].mode_set.connectors = kcalloc(max_conn_count, sizeof(struct drm_connector *),drivers/gpu/drm/exynos/exynos_drm_fbdev.c +1
-4@@ -208,7 +208,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)struct exynos_drm_fbdev *fbdev;struct exynos_drm_private *private = dev->dev_private;struct drm_fb_helper *helper; -unsigned int num_crtc;int ret;if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)@@ -225,9 +224,7 @@ int exynos_drm_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &exynos_drm_fb_helper_funcs); - num_crtc = dev->mode_config.num_crtc; - - ret =drm_fb_helper_init (dev, helper, num_crtc,MAX_CONNECTOR ); + ret =drm_fb_helper_init (dev, helper,MAX_CONNECTOR );if (ret <0 ) {DRM_ERROR ("failed to initialize drm fb helper.\n" ); goto err_init;drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1
-1@@ -94,7 +94,7 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth =24 ; } - fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 ,1 ); + fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 );if (IS_ERR (fsl_dev->fbdev)) { ret =PTR_ERR (fsl_dev->fbdev); fsl_dev->fbdev =NULL ;drivers/gpu/drm/gma500/framebuffer.c +1
-1@@ -564,7 +564,7 @@ int psb_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs); ret =drm_fb_helper_init (dev, &fbdev->psb_fb_helper, - dev_priv->ops->crtcs,INTELFB_CONN_LIMIT ); +INTELFB_CONN_LIMIT );if (ret) goto free;drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c +1
-2@@ -200,8 +200,7 @@ int hibmc_fbdev_init(struct hibmc_drm_private *priv) &hibmc_fbdev_helper_funcs);/* Now just one crtc and one channel */ - ret =drm_fb_helper_init (priv->dev, - &hifbdev->helper,1 ,1 ); + ret =drm_fb_helper_init (priv->dev, &hifbdev->helper,1 );if (ret) {DRM_ERROR ("failed to initialize fb helper: %d\n" , ret);return ret;drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1
-2@@ -59,8 +59,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev)drm_fbdev_cma_hotplug_event (priv->fbdev); }else { priv->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_crtc, - dev->mode_config.num_connector); + dev->mode_config.num_connector);if (IS_ERR (priv->fbdev)) priv->fbdev =NULL ; }drivers/gpu/drm/i915/intel_fbdev.c +1
-2@@ -713,8 +713,7 @@ int intel_fbdev_init(struct drm_device *dev)if (!intel_fbdev_init_bios (dev, ifbdev)) ifbdev->preferred_bpp =32 ; - ret =drm_fb_helper_init (dev, &ifbdev->helper, -INTEL_INFO (dev_priv)->num_pipes,4 ); + ret =drm_fb_helper_init (dev, &ifbdev->helper,4 );if (ret) {kfree (ifbdev);return ret;drivers/gpu/drm/imx/imx-drm-core.c +1
-2@@ -389,8 +389,7 @@ static int imx_drm_bind(struct device *dev)dev_warn (dev,"Invalid legacyfb_depth. Defaulting to 16bpp\n" ); legacyfb_depth =16 ; } - imxdrm->fbhelper =drm_fbdev_cma_init (drm, legacyfb_depth, - drm->mode_config.num_crtc,MAX_CRTC ); + imxdrm->fbhelper =drm_fbdev_cma_init (drm, legacyfb_depth,MAX_CRTC );if (IS_ERR (imxdrm->fbhelper)) { ret =PTR_ERR (imxdrm->fbhelper); imxdrm->fbhelper =NULL ;drivers/gpu/drm/meson/meson_drv.c +0
-1@@ -279,7 +279,6 @@ static int meson_drv_probe(struct platform_device *pdev) drm->mode_config.funcs = &meson_mode_config_funcs; priv->fbdev =drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_crtc, drm->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev);drivers/gpu/drm/mgag200/mgag200_fb.c +1
-1@@ -286,7 +286,7 @@ int mgag200_fbdev_init(struct mga_device *mdev)drm_fb_helper_prepare (mdev->dev, &mfbdev->helper, &mga_fb_helper_funcs); ret =drm_fb_helper_init (mdev->dev, &mfbdev->helper, - mdev->num_crtc,MGAG200FB_CONN_LIMIT ); +MGAG200FB_CONN_LIMIT );if (ret) goto err_fb_helper;drivers/gpu/drm/msm/msm_fbdev.c +1
-2@@ -201,8 +201,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &msm_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, - priv->num_crtcs, priv->num_connectors); + ret =drm_fb_helper_init (dev, helper, priv->num_connectors);if (ret) {dev_err (dev->dev,"could not init fbdev: ret=%d\n" , ret); goto fail;drivers/gpu/drm/mxsfb/mxsfb_drv.c +1
-1@@ -218,7 +218,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)drm_kms_helper_poll_init (drm); - mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (mxsfb->fbdev)) { mxsfb->fbdev =NULL ;drivers/gpu/drm/nouveau/nouveau_fbcon.c +1
-2@@ -507,8 +507,7 @@ nouveau_fbcon_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &fbcon->helper, &nouveau_fbcon_helper_funcs); - ret =drm_fb_helper_init (dev, &fbcon->helper, - dev->mode_config.num_crtc,4 ); + ret =drm_fb_helper_init (dev, &fbcon->helper,4 );if (ret) goto free;drivers/gpu/drm/omapdrm/omap_fbdev.c +1
-2@@ -263,8 +263,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, helper, &omap_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, - priv->num_crtcs, priv->num_connectors); + ret =drm_fb_helper_init (dev, helper, priv->num_connectors);if (ret) {dev_err (dev->dev,"could not init fbdev: ret=%d\n" , ret); goto fail;drivers/gpu/drm/qxl/qxl_fb.c +0
-1@@ -399,7 +399,6 @@ int qxl_fbdev_init(struct qxl_device *qdev) &qxl_fb_helper_funcs); ret =drm_fb_helper_init (&qdev->ddev, &qfbdev->helper, - qxl_num_crtc,QXLFB_CONN_LIMIT );if (ret) goto free;drivers/gpu/drm/radeon/radeon_fb.c +0
-1@@ -366,7 +366,6 @@ int radeon_fbdev_init(struct radeon_device *rdev) &radeon_fb_helper_funcs); ret =drm_fb_helper_init (rdev->ddev, &rfbdev->helper, - rdev->num_crtc,RADEONFB_CONN_LIMIT );if (ret) goto free;drivers/gpu/drm/rcar-du/rcar_du_kms.c +1
-1@@ -662,7 +662,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)drm_kms_helper_poll_init (dev);if (dev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (dev,32 , dev->mode_config.num_crtc, + fbdev =drm_fbdev_cma_init (dev,32 , dev->mode_config.num_connector);if (IS_ERR (fbdev))return PTR_ERR (fbdev);drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c +1
-4@@ -129,19 +129,16 @@ int rockchip_drm_fbdev_init(struct drm_device *dev) {struct rockchip_drm_private *private = dev->dev_private;struct drm_fb_helper *helper; -unsigned int num_crtc;int ret;if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)return -EINVAL ; - num_crtc = dev->mode_config.num_crtc; - helper = &private->fbdev_helper;drm_fb_helper_prepare (dev, helper, &rockchip_drm_fb_helper_funcs); - ret =drm_fb_helper_init (dev, helper, num_crtc,ROCKCHIP_MAX_CONNECTOR ); + ret =drm_fb_helper_init (dev, helper,ROCKCHIP_MAX_CONNECTOR );if (ret <0 ) {dev_err (dev->dev,"Failed to initialize drm fb helper - %d.\n" , ret);drivers/gpu/drm/sti/sti_drv.c +1
-1@@ -360,7 +360,7 @@ static int sti_bind(struct device *dev) private = ddev->dev_private;if (ddev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (ddev,32 , ddev->mode_config.num_crtc, + fbdev =drm_fbdev_cma_init (ddev,32 , ddev->mode_config.num_connector);if (IS_ERR (fbdev)) {DRM_DEBUG_DRIVER ("Warning: fails to create fbdev\n" );drivers/gpu/drm/sun4i/sun4i_framebuffer.c +1
-3@@ -40,9 +40,7 @@ struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm) drm->mode_config.funcs = &sun4i_de_mode_config_funcs; -return drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_crtc, - drm->mode_config.num_connector); +return drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector); }void sun4i_framebuffer_free (struct drm_device *drm)drivers/gpu/drm/tegra/fb.c +1
-1@@ -309,7 +309,7 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,struct drm_device *drm = fbdev->base.dev;int err; - err =drm_fb_helper_init (drm, &fbdev->base, num_crtc, max_connectors); + err =drm_fb_helper_init (drm, &fbdev->base, max_connectors);if (err <0 ) {dev_err (drm->dev,"failed to initialize DRM FB helper: %d\n" , err);drivers/gpu/drm/tilcdc/tilcdc_drv.c +1
-2@@ -403,8 +403,7 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)drm_mode_config_reset (ddev); priv->fbdev =drm_fbdev_cma_init (ddev, bpp, - ddev->mode_config.num_crtc, - ddev->mode_config.num_connector); + ddev->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev); goto init_failed;drivers/gpu/drm/udl/udl_fb.c +1
-2@@ -441,8 +441,7 @@ int udl_fbdev_init(struct drm_device *dev)drm_fb_helper_prepare (dev, &ufbdev->helper, &udl_fb_helper_funcs); - ret =drm_fb_helper_init (dev, &ufbdev->helper, -1 ,1 ); + ret =drm_fb_helper_init (dev, &ufbdev->helper,1 );if (ret) goto free;drivers/gpu/drm/vc4/vc4_kms.c +0
-1@@ -231,7 +231,6 @@ int vc4_kms_load(struct drm_device *dev)drm_mode_config_reset (dev); vc4->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_crtc, dev->mode_config.num_connector);if (IS_ERR (vc4->fbdev)) vc4->fbdev =NULL ;drivers/gpu/drm/virtio/virtgpu_fb.c +0
-1@@ -387,7 +387,6 @@ int virtio_gpu_fbdev_init(struct virtio_gpu_device *vgdev)drm_fb_helper_prepare (vgdev->ddev, &vgfbdev->helper, &virtio_gpu_fb_helper_funcs); ret =drm_fb_helper_init (vgdev->ddev, &vgfbdev->helper, - vgdev->num_scanouts,VIRTIO_GPUFB_CONN_LIMIT );if (ret) {kfree (vgfbdev);drivers/gpu/drm/zte/zx_drm_drv.c +1
-1@@ -141,7 +141,7 @@ static int zx_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - priv->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + priv->fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_connector);if (IS_ERR (priv->fbdev)) { ret =PTR_ERR (priv->fbdev);include/drm/drm_fb_cma_helper.h +3
-4@@ -16,11 +16,10 @@ struct drm_plane;struct drm_plane_state ;struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count,const struct drm_framebuffer_funcs *funcs); +unsigned int preferred_bpp,unsigned int max_conn_count, +const struct drm_framebuffer_funcs *funcs);struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count); +unsigned int preferred_bpp,unsigned int max_conn_count);void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma);void drm_fbdev_cma_restore_mode (struct drm_fbdev_cma *fbdev_cma);include/drm/drm_fb_helper.h +1
-2@@ -236,8 +236,7 @@ struct drm_fb_helper {void drm_fb_helper_prepare (struct drm_device *dev,struct drm_fb_helper *helper,const struct drm_fb_helper_funcs *funcs);int drm_fb_helper_init (struct drm_device *dev, -struct drm_fb_helper *helper,int crtc_count, -int max_conn); +struct drm_fb_helper *helper,int max_conn);void drm_fb_helper_fini (struct drm_fb_helper *helper);int drm_fb_helper_blank (int blank,struct fb_info *info); int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Daniel Vetter
You forgot to update the kernel-doc, building them now generates new warnings. Please fix in a follow-up patch.
Hm, that´s a bummer. Please take the fix below. Thanks for spotting.
-- >8 --
Subject: [PATCH] drm: Update drm_fbdev_cma_init documentation
Commit be7f735cd5ea ("drm: Rely on mode_config data for fb_helper initialization") dropped the num_crtc argument. Update the documentation to reflect that and prevent the kernel-doc warnings below:
./drivers/gpu/drm/drm_fb_cma_helper.c:557: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init' ./drivers/gpu/drm/drm_fb_cma_helper.c:558: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'
--- drivers/gpu/drm/drm_fb_cma_helper.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_fb_cma_helper.c +0 -1
@@ -547,7 +547,6 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);* drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device -* @num_crtc: Number of CRTCs * @max_conn_count: Maximum number of connectors * * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedQuoted 6 lines · Gabriel Krisman Bertazi
Quoted 2 lines · Daniel Vetter
You forgot to update the kernel-doc, building them now generates new warnings. Please fix in a follow-up patch.
Hm, that´s a bummer. Please take the fix below. Thanks for spotting.
Applied, thx for the quick fix.
-Daniel
Quoted 32 lines
-- >8 --
Subject: [PATCH] drm: Updatedrm_fbdev_cma_initdocumentationCommit
be7f735cd5ea("drm: Rely onmode_configdata forfb_helperinitialization") dropped thenum_crtcargument. Update the documentation to reflect that and prevent the kernel-doc warnings below:
./drivers/gpu/drm/drm_fb_cma_helper.c:557: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'./drivers/gpu/drm/drm_fb_cma_helper.c:558: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init'Fixes be7f735cd5ea ("drm: Rely on mode_config data for fb_helper initialization")Signed-off-by Gabriel Krisman Bertazi <[email protected]>--- drivers/gpu/drm/drm_fb_cma_helper.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fb_cma_helper.c +0
-1@@ -547,7 +547,6 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);* drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device -* @num_crtc: Number of CRTCs * @max_conn_count: Maximum number of connectors * * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. Signature · 1 line
2.11.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel