Commit 43443460 authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Thierry Reding

drm/tegra: Remove struct tegra_fbdev

Remove struct tegra_fbdev, which is an empty wrapper around struct
drm_fb_helper. Use the latter directly. No functional changes.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 08263e91
...@@ -29,12 +29,6 @@ ...@@ -29,12 +29,6 @@
struct reset_control; struct reset_control;
#ifdef CONFIG_DRM_FBDEV_EMULATION
struct tegra_fbdev {
struct drm_fb_helper base;
};
#endif
struct tegra_drm { struct tegra_drm {
struct drm_device *drm; struct drm_device *drm;
...@@ -52,10 +46,6 @@ struct tegra_drm { ...@@ -52,10 +46,6 @@ struct tegra_drm {
struct mutex clients_lock; struct mutex clients_lock;
struct list_head clients; struct list_head clients;
#ifdef CONFIG_DRM_FBDEV_EMULATION
struct tegra_fbdev *fbdev;
#endif
unsigned int hmask, vmask; unsigned int hmask, vmask;
unsigned int pitch_align; unsigned int pitch_align;
unsigned int num_crtcs; unsigned int num_crtcs;
......
...@@ -18,13 +18,6 @@ ...@@ -18,13 +18,6 @@
#include "drm.h" #include "drm.h"
#include "gem.h" #include "gem.h"
#ifdef CONFIG_DRM_FBDEV_EMULATION
static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper)
{
return container_of(helper, struct tegra_fbdev, base);
}
#endif
struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
unsigned int index) unsigned int index)
{ {
...@@ -297,42 +290,42 @@ static const struct drm_fb_helper_funcs tegra_fb_helper_funcs = { ...@@ -297,42 +290,42 @@ static const struct drm_fb_helper_funcs tegra_fb_helper_funcs = {
.fb_probe = tegra_fbdev_probe, .fb_probe = tegra_fbdev_probe,
}; };
static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm) static struct drm_fb_helper *tegra_fbdev_create(struct drm_device *drm)
{ {
struct tegra_fbdev *fbdev; struct drm_fb_helper *helper;
fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); helper = kzalloc(sizeof(*helper), GFP_KERNEL);
if (!fbdev) { if (!helper) {
dev_err(drm->dev, "failed to allocate DRM fbdev\n"); dev_err(drm->dev, "failed to allocate DRM fbdev\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
drm_fb_helper_prepare(drm, &fbdev->base, 32, &tegra_fb_helper_funcs); drm_fb_helper_prepare(drm, helper, 32, &tegra_fb_helper_funcs);
return fbdev; return helper;
} }
static void tegra_fbdev_free(struct tegra_fbdev *fbdev) static void tegra_fbdev_free(struct drm_fb_helper *helper)
{ {
drm_fb_helper_unprepare(&fbdev->base); drm_fb_helper_unprepare(helper);
kfree(fbdev); kfree(helper);
} }
static int tegra_fbdev_init(struct tegra_fbdev *fbdev, static int tegra_fbdev_init(struct drm_fb_helper *helper,
unsigned int num_crtc, unsigned int num_crtc,
unsigned int max_connectors) unsigned int max_connectors)
{ {
struct drm_device *drm = fbdev->base.dev; struct drm_device *drm = helper->dev;
int err; int err;
err = drm_fb_helper_init(drm, &fbdev->base); err = drm_fb_helper_init(drm, helper);
if (err < 0) { if (err < 0) {
dev_err(drm->dev, "failed to initialize DRM FB helper: %d\n", dev_err(drm->dev, "failed to initialize DRM FB helper: %d\n",
err); err);
return err; return err;
} }
err = drm_fb_helper_initial_config(&fbdev->base); err = drm_fb_helper_initial_config(helper);
if (err < 0) { if (err < 0) {
dev_err(drm->dev, "failed to set initial configuration: %d\n", dev_err(drm->dev, "failed to set initial configuration: %d\n",
err); err);
...@@ -342,13 +335,12 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev, ...@@ -342,13 +335,12 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,
return 0; return 0;
fini: fini:
drm_fb_helper_fini(&fbdev->base); drm_fb_helper_fini(helper);
return err; return err;
} }
static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) static void tegra_fbdev_exit(struct drm_fb_helper *helper)
{ {
struct drm_fb_helper *helper = &fbdev->base;
struct drm_framebuffer *fb = helper->fb; struct drm_framebuffer *fb = helper->fb;
drm_fb_helper_unregister_info(helper); drm_fb_helper_unregister_info(helper);
...@@ -366,18 +358,16 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) ...@@ -366,18 +358,16 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
} }
drm_fb_helper_fini(helper); drm_fb_helper_fini(helper);
tegra_fbdev_free(fbdev); tegra_fbdev_free(helper);
} }
#endif #endif
int tegra_drm_fb_prepare(struct drm_device *drm) int tegra_drm_fb_prepare(struct drm_device *drm)
{ {
#ifdef CONFIG_DRM_FBDEV_EMULATION #ifdef CONFIG_DRM_FBDEV_EMULATION
struct tegra_drm *tegra = drm->dev_private; drm->fb_helper = tegra_fbdev_create(drm);
if (IS_ERR(drm->fb_helper))
tegra->fbdev = tegra_fbdev_create(drm); return PTR_ERR(drm->fb_helper);
if (IS_ERR(tegra->fbdev))
return PTR_ERR(tegra->fbdev);
#endif #endif
return 0; return 0;
...@@ -386,19 +376,16 @@ int tegra_drm_fb_prepare(struct drm_device *drm) ...@@ -386,19 +376,16 @@ int tegra_drm_fb_prepare(struct drm_device *drm)
void tegra_drm_fb_free(struct drm_device *drm) void tegra_drm_fb_free(struct drm_device *drm)
{ {
#ifdef CONFIG_DRM_FBDEV_EMULATION #ifdef CONFIG_DRM_FBDEV_EMULATION
struct tegra_drm *tegra = drm->dev_private; tegra_fbdev_free(drm->fb_helper);
tegra_fbdev_free(tegra->fbdev);
#endif #endif
} }
int tegra_drm_fb_init(struct drm_device *drm) int tegra_drm_fb_init(struct drm_device *drm)
{ {
#ifdef CONFIG_DRM_FBDEV_EMULATION #ifdef CONFIG_DRM_FBDEV_EMULATION
struct tegra_drm *tegra = drm->dev_private;
int err; int err;
err = tegra_fbdev_init(tegra->fbdev, drm->mode_config.num_crtc, err = tegra_fbdev_init(drm->fb_helper, drm->mode_config.num_crtc,
drm->mode_config.num_connector); drm->mode_config.num_connector);
if (err < 0) if (err < 0)
return err; return err;
...@@ -410,8 +397,6 @@ int tegra_drm_fb_init(struct drm_device *drm) ...@@ -410,8 +397,6 @@ int tegra_drm_fb_init(struct drm_device *drm)
void tegra_drm_fb_exit(struct drm_device *drm) void tegra_drm_fb_exit(struct drm_device *drm)
{ {
#ifdef CONFIG_DRM_FBDEV_EMULATION #ifdef CONFIG_DRM_FBDEV_EMULATION
struct tegra_drm *tegra = drm->dev_private; tegra_fbdev_exit(drm->fb_helper);
tegra_fbdev_exit(tegra->fbdev);
#endif #endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment