diff options
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_fbdev.c | 36 |
2 files changed, 13 insertions, 27 deletions
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index 98837bde2d25..7f1a3604b19f 100644 --- a/drivers/gpu/drm/bochs/bochs_drv.c +++ b/drivers/gpu/drm/bochs/bochs_drv.c | |||
@@ -109,7 +109,7 @@ static int bochs_pm_suspend(struct device *dev) | |||
109 | 109 | ||
110 | if (bochs->fb.initialized) { | 110 | if (bochs->fb.initialized) { |
111 | console_lock(); | 111 | console_lock(); |
112 | fb_set_suspend(bochs->fb.helper.fbdev, 1); | 112 | drm_fb_helper_set_suspend(&bochs->fb.helper, 1); |
113 | console_unlock(); | 113 | console_unlock(); |
114 | } | 114 | } |
115 | 115 | ||
@@ -126,7 +126,7 @@ static int bochs_pm_resume(struct device *dev) | |||
126 | 126 | ||
127 | if (bochs->fb.initialized) { | 127 | if (bochs->fb.initialized) { |
128 | console_lock(); | 128 | console_lock(); |
129 | fb_set_suspend(bochs->fb.helper.fbdev, 0); | 129 | drm_fb_helper_set_suspend(&bochs->fb.helper, 0); |
130 | console_unlock(); | 130 | console_unlock(); |
131 | } | 131 | } |
132 | 132 | ||
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c index 976d9798dc99..09a0637aab3e 100644 --- a/drivers/gpu/drm/bochs/bochs_fbdev.c +++ b/drivers/gpu/drm/bochs/bochs_fbdev.c | |||
@@ -24,9 +24,9 @@ static struct fb_ops bochsfb_ops = { | |||
24 | .owner = THIS_MODULE, | 24 | .owner = THIS_MODULE, |
25 | .fb_check_var = drm_fb_helper_check_var, | 25 | .fb_check_var = drm_fb_helper_check_var, |
26 | .fb_set_par = drm_fb_helper_set_par, | 26 | .fb_set_par = drm_fb_helper_set_par, |
27 | .fb_fillrect = sys_fillrect, | 27 | .fb_fillrect = drm_fb_helper_sys_fillrect, |
28 | .fb_copyarea = sys_copyarea, | 28 | .fb_copyarea = drm_fb_helper_sys_copyarea, |
29 | .fb_imageblit = sys_imageblit, | 29 | .fb_imageblit = drm_fb_helper_sys_imageblit, |
30 | .fb_pan_display = drm_fb_helper_pan_display, | 30 | .fb_pan_display = drm_fb_helper_pan_display, |
31 | .fb_blank = drm_fb_helper_blank, | 31 | .fb_blank = drm_fb_helper_blank, |
32 | .fb_setcmap = drm_fb_helper_setcmap, | 32 | .fb_setcmap = drm_fb_helper_setcmap, |
@@ -56,11 +56,9 @@ static int bochsfb_create(struct drm_fb_helper *helper, | |||
56 | { | 56 | { |
57 | struct bochs_device *bochs = | 57 | struct bochs_device *bochs = |
58 | container_of(helper, struct bochs_device, fb.helper); | 58 | container_of(helper, struct bochs_device, fb.helper); |
59 | struct drm_device *dev = bochs->dev; | ||
60 | struct fb_info *info; | 59 | struct fb_info *info; |
61 | struct drm_framebuffer *fb; | 60 | struct drm_framebuffer *fb; |
62 | struct drm_mode_fb_cmd2 mode_cmd; | 61 | struct drm_mode_fb_cmd2 mode_cmd; |
63 | struct device *device = &dev->pdev->dev; | ||
64 | struct drm_gem_object *gobj = NULL; | 62 | struct drm_gem_object *gobj = NULL; |
65 | struct bochs_bo *bo = NULL; | 63 | struct bochs_bo *bo = NULL; |
66 | int size, ret; | 64 | int size, ret; |
@@ -106,22 +104,23 @@ static int bochsfb_create(struct drm_fb_helper *helper, | |||
106 | ttm_bo_unreserve(&bo->bo); | 104 | ttm_bo_unreserve(&bo->bo); |
107 | 105 | ||
108 | /* init fb device */ | 106 | /* init fb device */ |
109 | info = framebuffer_alloc(0, device); | 107 | info = drm_fb_helper_alloc_fbi(helper); |
110 | if (info == NULL) | 108 | if (IS_ERR(info)) |
111 | return -ENOMEM; | 109 | return PTR_ERR(info); |
112 | 110 | ||
113 | info->par = &bochs->fb.helper; | 111 | info->par = &bochs->fb.helper; |
114 | 112 | ||
115 | ret = bochs_framebuffer_init(bochs->dev, &bochs->fb.gfb, &mode_cmd, gobj); | 113 | ret = bochs_framebuffer_init(bochs->dev, &bochs->fb.gfb, &mode_cmd, gobj); |
116 | if (ret) | 114 | if (ret) { |
115 | drm_fb_helper_release_fbi(helper); | ||
117 | return ret; | 116 | return ret; |
117 | } | ||
118 | 118 | ||
119 | bochs->fb.size = size; | 119 | bochs->fb.size = size; |
120 | 120 | ||
121 | /* setup helper */ | 121 | /* setup helper */ |
122 | fb = &bochs->fb.gfb.base; | 122 | fb = &bochs->fb.gfb.base; |
123 | bochs->fb.helper.fb = fb; | 123 | bochs->fb.helper.fb = fb; |
124 | bochs->fb.helper.fbdev = info; | ||
125 | 124 | ||
126 | strcpy(info->fix.id, "bochsdrmfb"); | 125 | strcpy(info->fix.id, "bochsdrmfb"); |
127 | 126 | ||
@@ -139,30 +138,17 @@ static int bochsfb_create(struct drm_fb_helper *helper, | |||
139 | info->fix.smem_start = 0; | 138 | info->fix.smem_start = 0; |
140 | info->fix.smem_len = size; | 139 | info->fix.smem_len = size; |
141 | 140 | ||
142 | ret = fb_alloc_cmap(&info->cmap, 256, 0); | ||
143 | if (ret) { | ||
144 | DRM_ERROR("%s: can't allocate color map\n", info->fix.id); | ||
145 | return -ENOMEM; | ||
146 | } | ||
147 | |||
148 | return 0; | 141 | return 0; |
149 | } | 142 | } |
150 | 143 | ||
151 | static int bochs_fbdev_destroy(struct bochs_device *bochs) | 144 | static int bochs_fbdev_destroy(struct bochs_device *bochs) |
152 | { | 145 | { |
153 | struct bochs_framebuffer *gfb = &bochs->fb.gfb; | 146 | struct bochs_framebuffer *gfb = &bochs->fb.gfb; |
154 | struct fb_info *info; | ||
155 | 147 | ||
156 | DRM_DEBUG_DRIVER("\n"); | 148 | DRM_DEBUG_DRIVER("\n"); |
157 | 149 | ||
158 | if (bochs->fb.helper.fbdev) { | 150 | drm_fb_helper_unregister_fbi(&bochs->fb.helper); |
159 | info = bochs->fb.helper.fbdev; | 151 | drm_fb_helper_release_fbi(&bochs->fb.helper); |
160 | |||
161 | unregister_framebuffer(info); | ||
162 | if (info->cmap.len) | ||
163 | fb_dealloc_cmap(&info->cmap); | ||
164 | framebuffer_release(info); | ||
165 | } | ||
166 | 152 | ||
167 | if (gfb->obj) { | 153 | if (gfb->obj) { |
168 | drm_gem_object_unreference_unlocked(gfb->obj); | 154 | drm_gem_object_unreference_unlocked(gfb->obj); |