Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+25 -200
+3 -18
drivers/gpu/drm/ast/ast_fb.c
··· 146 146 return ret; 147 147 } 148 148 149 - static int astfb_create(struct ast_fbdev *afbdev, 149 + static int astfb_create(struct drm_fb_helper *helper, 150 150 struct drm_fb_helper_surface_size *sizes) 151 151 { 152 + struct ast_fbdev *afbdev = (struct ast_fbdev *)helper; 152 153 struct drm_device *dev = afbdev->helper.dev; 153 154 struct drm_mode_fb_cmd2 mode_cmd; 154 155 struct drm_framebuffer *fb; ··· 250 249 *blue = ast_crtc->lut_b[regno] << 8; 251 250 } 252 251 253 - static int ast_find_or_create_single(struct drm_fb_helper *helper, 254 - struct drm_fb_helper_surface_size *sizes) 255 - { 256 - struct ast_fbdev *afbdev = (struct ast_fbdev *)helper; 257 - int new_fb = 0; 258 - int ret; 259 - 260 - if (!helper->fb) { 261 - ret = astfb_create(afbdev, sizes); 262 - if (ret) 263 - return ret; 264 - new_fb = 1; 265 - } 266 - return new_fb; 267 - } 268 - 269 252 static struct drm_fb_helper_funcs ast_fb_helper_funcs = { 270 253 .gamma_set = ast_fb_gamma_set, 271 254 .gamma_get = ast_fb_gamma_get, 272 - .fb_probe = ast_find_or_create_single, 255 + .fb_probe = astfb_create, 273 256 }; 274 257 275 258 static void ast_fbdev_destroy(struct drm_device *dev,
+3 -19
drivers/gpu/drm/cirrus/cirrus_fbdev.c
··· 121 121 return ret; 122 122 } 123 123 124 - static int cirrusfb_create(struct cirrus_fbdev *gfbdev, 124 + static int cirrusfb_create(struct drm_fb_helper *helper, 125 125 struct drm_fb_helper_surface_size *sizes) 126 126 { 127 + struct cirrus_fbdev *gfbdev = (struct cirrus_fbdev *)helper; 127 128 struct drm_device *dev = gfbdev->helper.dev; 128 129 struct cirrus_device *cdev = gfbdev->helper.dev->dev_private; 129 130 struct fb_info *info; ··· 221 220 return ret; 222 221 } 223 222 224 - static int cirrus_fb_find_or_create_single(struct drm_fb_helper *helper, 225 - struct drm_fb_helper_surface_size 226 - *sizes) 227 - { 228 - struct cirrus_fbdev *gfbdev = (struct cirrus_fbdev *)helper; 229 - int new_fb = 0; 230 - int ret; 231 - 232 - if (!helper->fb) { 233 - ret = cirrusfb_create(gfbdev, sizes); 234 - if (ret) 235 - return ret; 236 - new_fb = 1; 237 - } 238 - return new_fb; 239 - } 240 - 241 223 static int cirrus_fbdev_destroy(struct drm_device *dev, 242 224 struct cirrus_fbdev *gfbdev) 243 225 { ··· 252 268 static struct drm_fb_helper_funcs cirrus_fb_helper_funcs = { 253 269 .gamma_set = cirrus_crtc_fb_gamma_set, 254 270 .gamma_get = cirrus_crtc_fb_gamma_get, 255 - .fb_probe = cirrus_fb_find_or_create_single, 271 + .fb_probe = cirrusfb_create, 256 272 }; 257 273 258 274 int cirrus_fbdev_init(struct cirrus_device *cdev)
+1 -16
drivers/gpu/drm/drm_fb_cma_helper.c
··· 275 275 return ret; 276 276 } 277 277 278 - static int drm_fbdev_cma_probe(struct drm_fb_helper *helper, 279 - struct drm_fb_helper_surface_size *sizes) 280 - { 281 - int ret = 0; 282 - 283 - if (!helper->fb) { 284 - ret = drm_fbdev_cma_create(helper, sizes); 285 - if (ret < 0) 286 - return ret; 287 - ret = 1; 288 - } 289 - 290 - return ret; 291 - } 292 - 293 278 static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = { 294 - .fb_probe = drm_fbdev_cma_probe, 279 + .fb_probe = drm_fbdev_cma_create, 295 280 }; 296 281 297 282 /**
+1 -29
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
··· 226 226 return ret; 227 227 } 228 228 229 - static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, 230 - struct drm_fb_helper_surface_size *sizes) 231 - { 232 - int ret = 0; 233 - 234 - DRM_DEBUG_KMS("%s\n", __FILE__); 235 - 236 - /* 237 - * with !helper->fb, it means that this funcion is called first time 238 - * and after that, the helper->fb would be used as clone mode. 239 - */ 240 - if (!helper->fb) { 241 - ret = exynos_drm_fbdev_create(helper, sizes); 242 - if (ret < 0) { 243 - DRM_ERROR("failed to create fbdev.\n"); 244 - return ret; 245 - } 246 - 247 - /* 248 - * fb_helper expects a value more than 1 if succeed 249 - * because register_framebuffer() should be called. 250 - */ 251 - ret = 1; 252 - } 253 - 254 - return ret; 255 - } 256 - 257 229 static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = { 258 - .fb_probe = exynos_drm_fbdev_probe, 230 + .fb_probe = exynos_drm_fbdev_create, 259 231 }; 260 232 261 233 int exynos_drm_fbdev_init(struct drm_device *dev)
+1 -9
drivers/gpu/drm/gma500/framebuffer.c
··· 545 545 struct psb_fbdev *psb_fbdev = (struct psb_fbdev *)helper; 546 546 struct drm_device *dev = psb_fbdev->psb_fb_helper.dev; 547 547 struct drm_psb_private *dev_priv = dev->dev_private; 548 - int new_fb = 0; 549 548 int bytespp; 550 - int ret; 551 549 552 550 bytespp = sizes->surface_bpp / 8; 553 551 if (bytespp == 3) /* no 24bit packed */ ··· 560 562 sizes->surface_depth = 16; 561 563 } 562 564 563 - if (!helper->fb) { 564 - ret = psbfb_create(psb_fbdev, sizes); 565 - if (ret) 566 - return ret; 567 - new_fb = 1; 568 - } 569 - return new_fb; 565 + return psbfb_create(psb_fbdev, sizes); 570 566 } 571 567 572 568 static struct drm_fb_helper_funcs psb_fb_helper_funcs = {
+3 -18
drivers/gpu/drm/i915/intel_fb.c
··· 57 57 .fb_debug_leave = drm_fb_helper_debug_leave, 58 58 }; 59 59 60 - static int intelfb_create(struct intel_fbdev *ifbdev, 60 + static int intelfb_create(struct drm_fb_helper *helper, 61 61 struct drm_fb_helper_surface_size *sizes) 62 62 { 63 + struct intel_fbdev *ifbdev = (struct intel_fbdev *)helper; 63 64 struct drm_device *dev = ifbdev->helper.dev; 64 65 struct drm_i915_private *dev_priv = dev->dev_private; 65 66 struct fb_info *info; ··· 182 181 return ret; 183 182 } 184 183 185 - static int intel_fb_find_or_create_single(struct drm_fb_helper *helper, 186 - struct drm_fb_helper_surface_size *sizes) 187 - { 188 - struct intel_fbdev *ifbdev = (struct intel_fbdev *)helper; 189 - int new_fb = 0; 190 - int ret; 191 - 192 - if (!helper->fb) { 193 - ret = intelfb_create(ifbdev, sizes); 194 - if (ret) 195 - return ret; 196 - new_fb = 1; 197 - } 198 - return new_fb; 199 - } 200 - 201 184 static struct drm_fb_helper_funcs intel_fb_helper_funcs = { 202 185 .gamma_set = intel_crtc_fb_gamma_set, 203 186 .gamma_get = intel_crtc_fb_gamma_get, 204 - .fb_probe = intel_fb_find_or_create_single, 187 + .fb_probe = intelfb_create, 205 188 }; 206 189 207 190 static void intel_fbdev_destroy(struct drm_device *dev,
+3 -19
drivers/gpu/drm/mgag200/mgag200_fb.c
··· 121 121 return ret; 122 122 } 123 123 124 - static int mgag200fb_create(struct mga_fbdev *mfbdev, 124 + static int mgag200fb_create(struct drm_fb_helper *helper, 125 125 struct drm_fb_helper_surface_size *sizes) 126 126 { 127 + struct mga_fbdev *mfbdev = (struct mga_fbdev *)helper; 127 128 struct drm_device *dev = mfbdev->helper.dev; 128 129 struct drm_mode_fb_cmd2 mode_cmd; 129 130 struct mga_device *mdev = dev->dev_private; ··· 211 210 return ret; 212 211 } 213 212 214 - static int mga_fb_find_or_create_single(struct drm_fb_helper *helper, 215 - struct drm_fb_helper_surface_size 216 - *sizes) 217 - { 218 - struct mga_fbdev *mfbdev = (struct mga_fbdev *)helper; 219 - int new_fb = 0; 220 - int ret; 221 - 222 - if (!helper->fb) { 223 - ret = mgag200fb_create(mfbdev, sizes); 224 - if (ret) 225 - return ret; 226 - new_fb = 1; 227 - } 228 - return new_fb; 229 - } 230 - 231 213 static int mga_fbdev_destroy(struct drm_device *dev, 232 214 struct mga_fbdev *mfbdev) 233 215 { ··· 241 257 static struct drm_fb_helper_funcs mga_fb_helper_funcs = { 242 258 .gamma_set = mga_crtc_fb_gamma_set, 243 259 .gamma_get = mga_crtc_fb_gamma_get, 244 - .fb_probe = mga_fb_find_or_create_single, 260 + .fb_probe = mgag200fb_create, 245 261 }; 246 262 247 263 int mgag200_fbdev_init(struct mga_device *mdev)
+3 -19
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 251 251 } 252 252 253 253 static int 254 - nouveau_fbcon_create(struct nouveau_fbdev *fbcon, 254 + nouveau_fbcon_create(struct drm_fb_helper *helper, 255 255 struct drm_fb_helper_surface_size *sizes) 256 256 { 257 + struct nouveau_fbdev *fbcon = (struct nouveau_fbdev *)helper; 257 258 struct drm_device *dev = fbcon->dev; 258 259 struct nouveau_drm *drm = nouveau_drm(dev); 259 260 struct nouveau_device *device = nv_device(drm->device); ··· 389 388 return ret; 390 389 } 391 390 392 - static int 393 - nouveau_fbcon_find_or_create_single(struct drm_fb_helper *helper, 394 - struct drm_fb_helper_surface_size *sizes) 395 - { 396 - struct nouveau_fbdev *fbcon = (struct nouveau_fbdev *)helper; 397 - int new_fb = 0; 398 - int ret; 399 - 400 - if (!helper->fb) { 401 - ret = nouveau_fbcon_create(fbcon, sizes); 402 - if (ret) 403 - return ret; 404 - new_fb = 1; 405 - } 406 - return new_fb; 407 - } 408 - 409 391 void 410 392 nouveau_fbcon_output_poll_changed(struct drm_device *dev) 411 393 { ··· 434 450 static struct drm_fb_helper_funcs nouveau_fbcon_helper_funcs = { 435 451 .gamma_set = nouveau_fbcon_gamma_set, 436 452 .gamma_get = nouveau_fbcon_gamma_get, 437 - .fb_probe = nouveau_fbcon_find_or_create_single, 453 + .fb_probe = nouveau_fbcon_create, 438 454 }; 439 455 440 456
+3 -18
drivers/gpu/drm/radeon/radeon_fb.c
··· 187 187 return ret; 188 188 } 189 189 190 - static int radeonfb_create(struct radeon_fbdev *rfbdev, 190 + static int radeonfb_create(struct drm_fb_helper *helper, 191 191 struct drm_fb_helper_surface_size *sizes) 192 192 { 193 + struct radeon_fbdev *rfbdev = (struct radeon_fbdev *)helper; 193 194 struct radeon_device *rdev = rfbdev->rdev; 194 195 struct fb_info *info; 195 196 struct drm_framebuffer *fb = NULL; ··· 301 300 return ret; 302 301 } 303 302 304 - static int radeon_fb_find_or_create_single(struct drm_fb_helper *helper, 305 - struct drm_fb_helper_surface_size *sizes) 306 - { 307 - struct radeon_fbdev *rfbdev = (struct radeon_fbdev *)helper; 308 - int new_fb = 0; 309 - int ret; 310 - 311 - if (!helper->fb) { 312 - ret = radeonfb_create(rfbdev, sizes); 313 - if (ret) 314 - return ret; 315 - new_fb = 1; 316 - } 317 - return new_fb; 318 - } 319 - 320 303 void radeon_fb_output_poll_changed(struct radeon_device *rdev) 321 304 { 322 305 drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper); ··· 334 349 static struct drm_fb_helper_funcs radeon_fb_helper_funcs = { 335 350 .gamma_set = radeon_crtc_fb_gamma_set, 336 351 .gamma_get = radeon_crtc_fb_gamma_get, 337 - .fb_probe = radeon_fb_find_or_create_single, 352 + .fb_probe = radeonfb_create, 338 353 }; 339 354 340 355 int radeon_fbdev_init(struct radeon_device *rdev)
+3 -19
drivers/gpu/drm/udl/udl_fb.c
··· 476 476 } 477 477 478 478 479 - static int udlfb_create(struct udl_fbdev *ufbdev, 479 + static int udlfb_create(struct drm_fb_helper *helper, 480 480 struct drm_fb_helper_surface_size *sizes) 481 481 { 482 + struct udl_fbdev *ufbdev = (struct udl_fbdev *)helper; 482 483 struct drm_device *dev = ufbdev->helper.dev; 483 484 struct fb_info *info; 484 485 struct device *device = &dev->usbdev->dev; ··· 557 556 return ret; 558 557 } 559 558 560 - static int udl_fb_find_or_create_single(struct drm_fb_helper *helper, 561 - struct drm_fb_helper_surface_size *sizes) 562 - { 563 - struct udl_fbdev *ufbdev = (struct udl_fbdev *)helper; 564 - int new_fb = 0; 565 - int ret; 566 - 567 - if (!helper->fb) { 568 - ret = udlfb_create(ufbdev, sizes); 569 - if (ret) 570 - return ret; 571 - 572 - new_fb = 1; 573 - } 574 - return new_fb; 575 - } 576 - 577 559 static struct drm_fb_helper_funcs udl_fb_helper_funcs = { 578 560 .gamma_set = udl_crtc_fb_gamma_set, 579 561 .gamma_get = udl_crtc_fb_gamma_get, 580 - .fb_probe = udl_fb_find_or_create_single, 562 + .fb_probe = udlfb_create, 581 563 }; 582 564 583 565 static void udl_fbdev_destroy(struct drm_device *dev,
+1 -16
drivers/staging/omapdrm/omap_fbdev.c
··· 296 296 DBG("fbdev: get gamma"); 297 297 } 298 298 299 - static int omap_fbdev_probe(struct drm_fb_helper *helper, 300 - struct drm_fb_helper_surface_size *sizes) 301 - { 302 - int new_fb = 0; 303 - int ret; 304 - 305 - if (!helper->fb) { 306 - ret = omap_fbdev_create(helper, sizes); 307 - if (ret) 308 - return ret; 309 - new_fb = 1; 310 - } 311 - return new_fb; 312 - } 313 - 314 299 static struct drm_fb_helper_funcs omap_fb_helper_funcs = { 315 300 .gamma_set = omap_crtc_fb_gamma_set, 316 301 .gamma_get = omap_crtc_fb_gamma_get, 317 - .fb_probe = omap_fbdev_probe, 302 + .fb_probe = omap_fbdev_create, 318 303 }; 319 304 320 305 static struct drm_fb_helper *get_fb(struct fb_info *fbi)