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

drm/fbdev-dma: Remove obsolete setup function

The old setup function drm_fbdev_dma_setup() is unused. Remove it and
its internal callbacks. New drivers should call drm_client_setup()
instead.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240924071734.98201-49-tzimmermann@suse.de

+1 -126
+1 -119
drivers/gpu/drm/drm_fbdev_dma.c
··· 2 2 3 3 #include <linux/fb.h> 4 4 5 - #include <drm/drm_crtc_helper.h> 6 5 #include <drm/drm_drv.h> 6 + #include <drm/drm_fbdev_dma.h> 7 7 #include <drm/drm_fb_dma_helper.h> 8 8 #include <drm/drm_fb_helper.h> 9 9 #include <drm/drm_framebuffer.h> 10 10 #include <drm/drm_gem_dma_helper.h> 11 - 12 - #include <drm/drm_fbdev_dma.h> 13 11 14 12 /* 15 13 * struct fb_ops ··· 100 102 * struct drm_fb_helper 101 103 */ 102 104 103 - static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper, 104 - struct drm_fb_helper_surface_size *sizes) 105 - { 106 - return drm_fbdev_dma_driver_fbdev_probe(fb_helper, sizes); 107 - } 108 - 109 105 static int drm_fbdev_dma_helper_fb_dirty(struct drm_fb_helper *helper, 110 106 struct drm_clip_rect *clip) 111 107 { ··· 120 128 } 121 129 122 130 static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = { 123 - .fb_probe = drm_fbdev_dma_helper_fb_probe, 124 131 .fb_dirty = drm_fbdev_dma_helper_fb_dirty, 125 132 }; 126 133 ··· 237 246 return ret; 238 247 } 239 248 EXPORT_SYMBOL(drm_fbdev_dma_driver_fbdev_probe); 240 - 241 - /* 242 - * struct drm_client_funcs 243 - */ 244 - 245 - static void drm_fbdev_dma_client_unregister(struct drm_client_dev *client) 246 - { 247 - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); 248 - 249 - if (fb_helper->info) { 250 - drm_fb_helper_unregister_info(fb_helper); 251 - } else { 252 - drm_client_release(&fb_helper->client); 253 - drm_fb_helper_unprepare(fb_helper); 254 - kfree(fb_helper); 255 - } 256 - } 257 - 258 - static int drm_fbdev_dma_client_restore(struct drm_client_dev *client) 259 - { 260 - drm_fb_helper_lastclose(client->dev); 261 - 262 - return 0; 263 - } 264 - 265 - static int drm_fbdev_dma_client_hotplug(struct drm_client_dev *client) 266 - { 267 - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); 268 - struct drm_device *dev = client->dev; 269 - int ret; 270 - 271 - if (dev->fb_helper) 272 - return drm_fb_helper_hotplug_event(dev->fb_helper); 273 - 274 - ret = drm_fb_helper_init(dev, fb_helper); 275 - if (ret) 276 - goto err_drm_err; 277 - 278 - if (!drm_drv_uses_atomic_modeset(dev)) 279 - drm_helper_disable_unused_functions(dev); 280 - 281 - ret = drm_fb_helper_initial_config(fb_helper); 282 - if (ret) 283 - goto err_drm_fb_helper_fini; 284 - 285 - return 0; 286 - 287 - err_drm_fb_helper_fini: 288 - drm_fb_helper_fini(fb_helper); 289 - err_drm_err: 290 - drm_err(dev, "fbdev-dma: Failed to setup generic emulation (ret=%d)\n", ret); 291 - return ret; 292 - } 293 - 294 - static const struct drm_client_funcs drm_fbdev_dma_client_funcs = { 295 - .owner = THIS_MODULE, 296 - .unregister = drm_fbdev_dma_client_unregister, 297 - .restore = drm_fbdev_dma_client_restore, 298 - .hotplug = drm_fbdev_dma_client_hotplug, 299 - }; 300 - 301 - /** 302 - * drm_fbdev_dma_setup() - Setup fbdev emulation for GEM DMA helpers 303 - * @dev: DRM device 304 - * @preferred_bpp: Preferred bits per pixel for the device. 305 - * 32 is used if this is zero. 306 - * 307 - * This function sets up fbdev emulation for GEM DMA drivers that support 308 - * dumb buffers with a virtual address and that can be mmap'ed. 309 - * drm_fbdev_dma_setup() shall be called after the DRM driver registered 310 - * the new DRM device with drm_dev_register(). 311 - * 312 - * Restore, hotplug events and teardown are all taken care of. Drivers that do 313 - * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves. 314 - * Simple drivers might use drm_mode_config_helper_suspend(). 315 - * 316 - * This function is safe to call even when there are no connectors present. 317 - * Setup will be retried on the next hotplug event. 318 - * 319 - * The fbdev is destroyed by drm_dev_unregister(). 320 - */ 321 - void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp) 322 - { 323 - struct drm_fb_helper *fb_helper; 324 - int ret; 325 - 326 - drm_WARN(dev, !dev->registered, "Device has not been registered.\n"); 327 - drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n"); 328 - 329 - fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL); 330 - if (!fb_helper) 331 - return; 332 - drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_dma_helper_funcs); 333 - 334 - ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_dma_client_funcs); 335 - if (ret) { 336 - drm_err(dev, "Failed to register client: %d\n", ret); 337 - goto err_drm_client_init; 338 - } 339 - 340 - drm_client_register(&fb_helper->client); 341 - 342 - return; 343 - 344 - err_drm_client_init: 345 - drm_fb_helper_unprepare(fb_helper); 346 - kfree(fb_helper); 347 - } 348 - EXPORT_SYMBOL(drm_fbdev_dma_setup);
-7
include/drm/drm_fbdev_dma.h
··· 3 3 #ifndef DRM_FBDEV_DMA_H 4 4 #define DRM_FBDEV_DMA_H 5 5 6 - struct drm_device; 7 6 struct drm_fb_helper; 8 7 struct drm_fb_helper_surface_size; 9 8 ··· 12 13 13 14 #define DRM_FBDEV_DMA_DRIVER_OPS \ 14 15 .fbdev_probe = drm_fbdev_dma_driver_fbdev_probe 15 - 16 - void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp); 17 16 #else 18 - static inline void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp) 19 - { } 20 - 21 17 #define DRM_FBDEV_DMA_DRIVER_OPS \ 22 18 .fbdev_probe = NULL 23 - 24 19 #endif 25 20 26 21 #endif