Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd5428a5 authored by Daniel Vetter's avatar Daniel Vetter
Browse files

drm/<drivers>: simplify ->fb_probe callback



The fb helper lost its support for reallocating an fb completely, so
no need to return special success values any more.

Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 8acf658a
Loading
Loading
Loading
Loading
+3 −18
Original line number Diff line number Diff line
@@ -146,9 +146,10 @@ static int astfb_create_object(struct ast_fbdev *afbdev,
	return ret;
}

static int astfb_create(struct ast_fbdev *afbdev,
static int astfb_create(struct drm_fb_helper *helper,
			struct drm_fb_helper_surface_size *sizes)
{
	struct ast_fbdev *afbdev = (struct ast_fbdev *)helper;
	struct drm_device *dev = afbdev->helper.dev;
	struct drm_mode_fb_cmd2 mode_cmd;
	struct drm_framebuffer *fb;
@@ -249,26 +250,10 @@ static void ast_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
	*blue = ast_crtc->lut_b[regno] << 8;
}

static int ast_find_or_create_single(struct drm_fb_helper *helper,
					  struct drm_fb_helper_surface_size *sizes)
{
	struct ast_fbdev *afbdev = (struct ast_fbdev *)helper;
	int new_fb = 0;
	int ret;

	if (!helper->fb) {
		ret = astfb_create(afbdev, sizes);
		if (ret)
			return ret;
		new_fb = 1;
	}
	return new_fb;
}

static struct drm_fb_helper_funcs ast_fb_helper_funcs = {
	.gamma_set = ast_fb_gamma_set,
	.gamma_get = ast_fb_gamma_get,
	.fb_probe = ast_find_or_create_single,
	.fb_probe = astfb_create,
};

static void ast_fbdev_destroy(struct drm_device *dev,
+3 −19
Original line number Diff line number Diff line
@@ -121,9 +121,10 @@ static int cirrusfb_create_object(struct cirrus_fbdev *afbdev,
	return ret;
}

static int cirrusfb_create(struct cirrus_fbdev *gfbdev,
static int cirrusfb_create(struct drm_fb_helper *helper,
			   struct drm_fb_helper_surface_size *sizes)
{
	struct cirrus_fbdev *gfbdev = (struct cirrus_fbdev *)helper;
	struct drm_device *dev = gfbdev->helper.dev;
	struct cirrus_device *cdev = gfbdev->helper.dev->dev_private;
	struct fb_info *info;
@@ -220,23 +221,6 @@ static int cirrusfb_create(struct cirrus_fbdev *gfbdev,
	return ret;
}

static int cirrus_fb_find_or_create_single(struct drm_fb_helper *helper,
					   struct drm_fb_helper_surface_size
					   *sizes)
{
	struct cirrus_fbdev *gfbdev = (struct cirrus_fbdev *)helper;
	int new_fb = 0;
	int ret;

	if (!helper->fb) {
		ret = cirrusfb_create(gfbdev, sizes);
		if (ret)
			return ret;
		new_fb = 1;
	}
	return new_fb;
}

static int cirrus_fbdev_destroy(struct drm_device *dev,
				struct cirrus_fbdev *gfbdev)
{
@@ -268,7 +252,7 @@ static int cirrus_fbdev_destroy(struct drm_device *dev,
static struct drm_fb_helper_funcs cirrus_fb_helper_funcs = {
	.gamma_set = cirrus_crtc_fb_gamma_set,
	.gamma_get = cirrus_crtc_fb_gamma_get,
	.fb_probe = cirrus_fb_find_or_create_single,
	.fb_probe = cirrusfb_create,
};

int cirrus_fbdev_init(struct cirrus_device *cdev)
+1 −16
Original line number Diff line number Diff line
@@ -275,23 +275,8 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,
	return ret;
}

static int drm_fbdev_cma_probe(struct drm_fb_helper *helper,
	struct drm_fb_helper_surface_size *sizes)
{
	int ret = 0;

	if (!helper->fb) {
		ret = drm_fbdev_cma_create(helper, sizes);
		if (ret < 0)
			return ret;
		ret = 1;
	}

	return ret;
}

static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
	.fb_probe = drm_fbdev_cma_probe,
	.fb_probe = drm_fbdev_cma_create,
};

/**
+1 −29
Original line number Diff line number Diff line
@@ -226,36 +226,8 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
	return ret;
}

static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,
				   struct drm_fb_helper_surface_size *sizes)
{
	int ret = 0;

	DRM_DEBUG_KMS("%s\n", __FILE__);

	/*
	 * with !helper->fb, it means that this funcion is called first time
	 * and after that, the helper->fb would be used as clone mode.
	 */
	if (!helper->fb) {
		ret = exynos_drm_fbdev_create(helper, sizes);
		if (ret < 0) {
			DRM_ERROR("failed to create fbdev.\n");
			return ret;
		}

		/*
		 * fb_helper expects a value more than 1 if succeed
		 * because register_framebuffer() should be called.
		 */
		ret = 1;
	}

	return ret;
}

static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
	.fb_probe =	exynos_drm_fbdev_probe,
	.fb_probe =	exynos_drm_fbdev_create,
};

int exynos_drm_fbdev_init(struct drm_device *dev)
+1 −9
Original line number Diff line number Diff line
@@ -545,9 +545,7 @@ static int psbfb_probe(struct drm_fb_helper *helper,
	struct psb_fbdev *psb_fbdev = (struct psb_fbdev *)helper;
	struct drm_device *dev = psb_fbdev->psb_fb_helper.dev;
	struct drm_psb_private *dev_priv = dev->dev_private;
	int new_fb = 0;
	int bytespp;
	int ret;

	bytespp = sizes->surface_bpp / 8;
	if (bytespp == 3)	/* no 24bit packed */
@@ -562,13 +560,7 @@ static int psbfb_probe(struct drm_fb_helper *helper,
                sizes->surface_depth = 16;
        }

	if (!helper->fb) {
		ret = psbfb_create(psb_fbdev, sizes);
		if (ret)
			return ret;
		new_fb = 1;
	}
	return new_fb;
	return psbfb_create(psb_fbdev, sizes);
}

static struct drm_fb_helper_funcs psb_fb_helper_funcs = {
Loading