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

drm: Remove struct drm_driver.lastclose

The lastclose callback in struct drm_driver is unused. Remove it. Also
update documentation.

v2:
- update to use drm_lastclose()
- fix typo in documentation

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20240812083000.337744-9-tzimmermann@suse.de

+6 -51
+6 -22
drivers/gpu/drm/drm_file.c
··· 63 63 if (dev->driver->load || dev->driver->unload) 64 64 return true; 65 65 66 - /* 67 - * Drivers with the lastclose callback assume that it's synchronized 68 - * against concurrent opens, which again needs the BKL. The proper fix 69 - * is to use the drm_client infrastructure with proper locking for each 70 - * client. 71 - */ 72 - if (dev->driver->lastclose) 73 - return true; 74 - 75 66 return false; 76 67 } 77 68 ··· 387 396 } 388 397 EXPORT_SYMBOL(drm_open); 389 398 390 - void drm_lastclose(struct drm_device * dev) 399 + static void drm_lastclose(struct drm_device *dev) 391 400 { 392 - drm_dbg_core(dev, "\n"); 393 - 394 - if (dev->driver->lastclose) 395 - dev->driver->lastclose(dev); 396 - drm_dbg_core(dev, "driver lastclose completed\n"); 397 - 398 401 drm_client_dev_restore(dev); 399 402 400 403 if (dev_is_pci(dev->dev)) ··· 401 416 * @filp: file pointer. 402 417 * 403 418 * This function must be used by drivers as their &file_operations.release 404 - * method. It frees any resources associated with the open file, and calls the 405 - * &drm_driver.postclose driver callback. If this is the last open file for the 406 - * DRM device also proceeds to call the &drm_driver.lastclose driver callback. 419 + * method. It frees any resources associated with the open file. If this 420 + * is the last open file for the DRM device, it also restores the active 421 + * in-kernel DRM client. 407 422 * 408 423 * RETURNS: 409 424 * ··· 473 488 * 474 489 * This function may be used by drivers as their &file_operations.release 475 490 * method. It frees any resources associated with the open file prior to taking 476 - * the drm_global_mutex, which then calls the &drm_driver.postclose driver 477 - * callback. If this is the last open file for the DRM device also proceeds to 478 - * call the &drm_driver.lastclose driver callback. 491 + * the drm_global_mutex. If this is the last open file for the DRM device, it 492 + * then restores the active in-kernel DRM client. 479 493 * 480 494 * RETURNS: 481 495 *
-1
drivers/gpu/drm/drm_internal.h
··· 53 53 bool drm_dev_needs_global_mutex(struct drm_device *dev); 54 54 struct drm_file *drm_file_alloc(struct drm_minor *minor); 55 55 void drm_file_free(struct drm_file *file); 56 - void drm_lastclose(struct drm_device *dev); 57 56 58 57 #ifdef CONFIG_PCI 59 58
-28
include/drm/drm_drv.h
··· 229 229 void (*postclose) (struct drm_device *, struct drm_file *); 230 230 231 231 /** 232 - * @lastclose: 233 - * 234 - * Called when the last &struct drm_file has been closed and there's 235 - * currently no userspace client for the &struct drm_device. 236 - * 237 - * Modern drivers should only use this to force-restore the fbdev 238 - * framebuffer using drm_fb_helper_restore_fbdev_mode_unlocked(). 239 - * Anything else would indicate there's something seriously wrong. 240 - * Modern drivers can also use this to execute delayed power switching 241 - * state changes, e.g. in conjunction with the :ref:`vga_switcheroo` 242 - * infrastructure. 243 - * 244 - * This is called after @postclose hook has been called. 245 - * 246 - * NOTE: 247 - * 248 - * All legacy drivers use this callback to de-initialize the hardware. 249 - * This is purely because of the shadow-attach model, where the DRM 250 - * kernel driver does not really own the hardware. Instead ownershipe is 251 - * handled with the help of userspace through an inheritedly racy dance 252 - * to set/unset the VT into raw mode. 253 - * 254 - * Legacy drivers initialize the hardware in the @firstopen callback, 255 - * which isn't even called for modern drivers. 256 - */ 257 - void (*lastclose) (struct drm_device *); 258 - 259 - /** 260 232 * @unload: 261 233 * 262 234 * Reverse the effects of the driver load callback. Ideally,