aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_fbdev.c
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2015-07-31 06:51:48 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-08-06 08:13:03 -0400
commit231e6faf027ae5e86539bb5a3cdb2b22a96dae8c (patch)
treebde3cd574858224c7d101221deb56f54e99416eb /drivers/gpu/drm/omapdrm/omap_fbdev.c
parent2b9e6e376af5171444a1cdcc134ed502e33d1fb2 (diff)
drm/omap: Use new drm_fb_helper functions
Use the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation. v3: - Update error handling for new drm_fb_helper funcs. Check using IS_ERR() instead of checking for NULL. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> v2: - No changes Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_fbdev.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fbdev.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 720d16bce7e8..b8e4cdec28c3 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = {
86 /* Note: to properly handle manual update displays, we wrap the 86 /* Note: to properly handle manual update displays, we wrap the
87 * basic fbdev ops which write to the framebuffer 87 * basic fbdev ops which write to the framebuffer
88 */ 88 */
89 .fb_read = fb_sys_read, 89 .fb_read = drm_fb_helper_sys_read,
90 .fb_write = fb_sys_write, 90 .fb_write = drm_fb_helper_sys_write,
91 .fb_fillrect = sys_fillrect, 91 .fb_fillrect = drm_fb_helper_sys_fillrect,
92 .fb_copyarea = sys_copyarea, 92 .fb_copyarea = drm_fb_helper_sys_copyarea,
93 .fb_imageblit = sys_imageblit, 93 .fb_imageblit = drm_fb_helper_sys_imageblit,
94 94
95 .fb_check_var = drm_fb_helper_check_var, 95 .fb_check_var = drm_fb_helper_check_var,
96 .fb_set_par = drm_fb_helper_set_par, 96 .fb_set_par = drm_fb_helper_set_par,
@@ -179,10 +179,10 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
179 179
180 mutex_lock(&dev->struct_mutex); 180 mutex_lock(&dev->struct_mutex);
181 181
182 fbi = framebuffer_alloc(0, dev->dev); 182 fbi = drm_fb_helper_alloc_fbi(helper);
183 if (!fbi) { 183 if (IS_ERR(fbi)) {
184 dev_err(dev->dev, "failed to allocate fb info\n"); 184 dev_err(dev->dev, "failed to allocate fb info\n");
185 ret = -ENOMEM; 185 ret = PTR_ERR(fbi);
186 goto fail_unlock; 186 goto fail_unlock;
187 } 187 }
188 188
@@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
190 190
191 fbdev->fb = fb; 191 fbdev->fb = fb;
192 helper->fb = fb; 192 helper->fb = fb;
193 helper->fbdev = fbi;
194 193
195 fbi->par = helper; 194 fbi->par = helper;
196 fbi->flags = FBINFO_DEFAULT; 195 fbi->flags = FBINFO_DEFAULT;
@@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
198 197
199 strcpy(fbi->fix.id, MODULE_NAME); 198 strcpy(fbi->fix.id, MODULE_NAME);
200 199
201 ret = fb_alloc_cmap(&fbi->cmap, 256, 0);
202 if (ret) {
203 ret = -ENOMEM;
204 goto fail_unlock;
205 }
206
207 drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); 200 drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
208 drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height); 201 drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
209 202
@@ -236,8 +229,9 @@ fail_unlock:
236fail: 229fail:
237 230
238 if (ret) { 231 if (ret) {
239 if (fbi) 232
240 framebuffer_release(fbi); 233 drm_fb_helper_release_fbi(helper);
234
241 if (fb) { 235 if (fb) {
242 drm_framebuffer_unregister_private(fb); 236 drm_framebuffer_unregister_private(fb);
243 drm_framebuffer_remove(fb); 237 drm_framebuffer_remove(fb);
@@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev)
312 struct omap_drm_private *priv = dev->dev_private; 306 struct omap_drm_private *priv = dev->dev_private;
313 struct drm_fb_helper *helper = priv->fbdev; 307 struct drm_fb_helper *helper = priv->fbdev;
314 struct omap_fbdev *fbdev; 308 struct omap_fbdev *fbdev;
315 struct fb_info *fbi;
316 309
317 DBG(); 310 DBG();
318 311
319 fbi = helper->fbdev; 312 drm_fb_helper_unregister_fbi(helper);
320 313 drm_fb_helper_release_fbi(helper);
321 /* only cleanup framebuffer if it is present */
322 if (fbi) {
323 unregister_framebuffer(fbi);
324 framebuffer_release(fbi);
325 }
326 314
327 drm_fb_helper_fini(helper); 315 drm_fb_helper_fini(helper);
328 316