Commit b5757a5b authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20240812083000.337744-9-tzimmermann@suse.de
parent 6c22aadb
...@@ -63,15 +63,6 @@ bool drm_dev_needs_global_mutex(struct drm_device *dev) ...@@ -63,15 +63,6 @@ bool drm_dev_needs_global_mutex(struct drm_device *dev)
if (dev->driver->load || dev->driver->unload) if (dev->driver->load || dev->driver->unload)
return true; return true;
/*
* Drivers with the lastclose callback assume that it's synchronized
* against concurrent opens, which again needs the BKL. The proper fix
* is to use the drm_client infrastructure with proper locking for each
* client.
*/
if (dev->driver->lastclose)
return true;
return false; return false;
} }
...@@ -396,14 +387,8 @@ int drm_open(struct inode *inode, struct file *filp) ...@@ -396,14 +387,8 @@ int drm_open(struct inode *inode, struct file *filp)
} }
EXPORT_SYMBOL(drm_open); EXPORT_SYMBOL(drm_open);
void drm_lastclose(struct drm_device * dev) static void drm_lastclose(struct drm_device *dev)
{ {
drm_dbg_core(dev, "\n");
if (dev->driver->lastclose)
dev->driver->lastclose(dev);
drm_dbg_core(dev, "driver lastclose completed\n");
drm_client_dev_restore(dev); drm_client_dev_restore(dev);
if (dev_is_pci(dev->dev)) if (dev_is_pci(dev->dev))
...@@ -416,9 +401,9 @@ void drm_lastclose(struct drm_device * dev) ...@@ -416,9 +401,9 @@ void drm_lastclose(struct drm_device * dev)
* @filp: file pointer. * @filp: file pointer.
* *
* This function must be used by drivers as their &file_operations.release * This function must be used by drivers as their &file_operations.release
* method. It frees any resources associated with the open file, and calls the * method. It frees any resources associated with the open file. If this
* &drm_driver.postclose driver callback. If this is the last open file for the * is the last open file for the DRM device, it also restores the active
* DRM device also proceeds to call the &drm_driver.lastclose driver callback. * in-kernel DRM client.
* *
* RETURNS: * RETURNS:
* *
...@@ -488,9 +473,8 @@ void drm_file_update_pid(struct drm_file *filp) ...@@ -488,9 +473,8 @@ void drm_file_update_pid(struct drm_file *filp)
* *
* This function may be used by drivers as their &file_operations.release * This function may be used by drivers as their &file_operations.release
* method. It frees any resources associated with the open file prior to taking * method. It frees any resources associated with the open file prior to taking
* the drm_global_mutex, which then calls the &drm_driver.postclose driver * the drm_global_mutex. If this is the last open file for the DRM device, it
* callback. If this is the last open file for the DRM device also proceeds to * then restores the active in-kernel DRM client.
* call the &drm_driver.lastclose driver callback.
* *
* RETURNS: * RETURNS:
* *
......
...@@ -53,7 +53,6 @@ extern struct mutex drm_global_mutex; ...@@ -53,7 +53,6 @@ extern struct mutex drm_global_mutex;
bool drm_dev_needs_global_mutex(struct drm_device *dev); bool drm_dev_needs_global_mutex(struct drm_device *dev);
struct drm_file *drm_file_alloc(struct drm_minor *minor); struct drm_file *drm_file_alloc(struct drm_minor *minor);
void drm_file_free(struct drm_file *file); void drm_file_free(struct drm_file *file);
void drm_lastclose(struct drm_device *dev);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
......
...@@ -228,34 +228,6 @@ struct drm_driver { ...@@ -228,34 +228,6 @@ struct drm_driver {
*/ */
void (*postclose) (struct drm_device *, struct drm_file *); void (*postclose) (struct drm_device *, struct drm_file *);
/**
* @lastclose:
*
* Called when the last &struct drm_file has been closed and there's
* currently no userspace client for the &struct drm_device.
*
* Modern drivers should only use this to force-restore the fbdev
* framebuffer using drm_fb_helper_restore_fbdev_mode_unlocked().
* Anything else would indicate there's something seriously wrong.
* Modern drivers can also use this to execute delayed power switching
* state changes, e.g. in conjunction with the :ref:`vga_switcheroo`
* infrastructure.
*
* This is called after @postclose hook has been called.
*
* NOTE:
*
* All legacy drivers use this callback to de-initialize the hardware.
* This is purely because of the shadow-attach model, where the DRM
* kernel driver does not really own the hardware. Instead ownershipe is
* handled with the help of userspace through an inheritedly racy dance
* to set/unset the VT into raw mode.
*
* Legacy drivers initialize the hardware in the @firstopen callback,
* which isn't even called for modern drivers.
*/
void (*lastclose) (struct drm_device *);
/** /**
* @unload: * @unload:
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment