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

drm: Remove __drm_modeset_lock_all

The last user is gone, no need for trylocking any more in this legacy
helper.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

+11 -42
+11 -41
drivers/gpu/drm/drm_modeset_lock.c
··· 55 55 * drm_modeset_acquire_fini(&ctx); 56 56 */ 57 57 58 - 59 58 /** 60 - * __drm_modeset_lock_all - internal helper to grab all modeset locks 61 - * @dev: DRM device 62 - * @trylock: trylock mode for atomic contexts 59 + * drm_modeset_lock_all - take all modeset locks 60 + * @dev: drm device 63 61 * 64 - * This is a special version of drm_modeset_lock_all() which can also be used in 65 - * atomic contexts. Then @trylock must be set to true. 66 - * 67 - * Returns: 68 - * 0 on success or negative error code on failure. 62 + * This function takes all modeset locks, suitable where a more fine-grained 63 + * scheme isn't (yet) implemented. Locks must be dropped with 64 + * drm_modeset_unlock_all. 69 65 */ 70 - int __drm_modeset_lock_all(struct drm_device *dev, 71 - bool trylock) 66 + void drm_modeset_lock_all(struct drm_device *dev) 72 67 { 73 68 struct drm_mode_config *config = &dev->mode_config; 74 69 struct drm_modeset_acquire_ctx *ctx; 75 70 int ret; 76 71 77 - ctx = kzalloc(sizeof(*ctx), 78 - trylock ? GFP_ATOMIC : GFP_KERNEL); 79 - if (!ctx) 80 - return -ENOMEM; 72 + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 73 + if (WARN_ON(!ctx)) 74 + return; 81 75 82 - if (trylock) { 83 - if (!mutex_trylock(&config->mutex)) { 84 - ret = -EBUSY; 85 - goto out; 86 - } 87 - } else { 88 - mutex_lock(&config->mutex); 89 - } 76 + mutex_lock(&config->mutex); 90 77 91 78 drm_modeset_acquire_init(ctx, 0); 92 - ctx->trylock_only = trylock; 93 79 94 80 retry: 95 81 ret = drm_modeset_lock(&config->connection_mutex, ctx); ··· 94 108 95 109 drm_warn_on_modeset_not_all_locked(dev); 96 110 97 - return 0; 111 + return; 98 112 99 113 fail: 100 114 if (ret == -EDEADLK) { ··· 102 116 goto retry; 103 117 } 104 118 105 - out: 106 119 kfree(ctx); 107 - return ret; 108 - } 109 - EXPORT_SYMBOL(__drm_modeset_lock_all); 110 - 111 - /** 112 - * drm_modeset_lock_all - take all modeset locks 113 - * @dev: drm device 114 - * 115 - * This function takes all modeset locks, suitable where a more fine-grained 116 - * scheme isn't (yet) implemented. Locks must be dropped with 117 - * drm_modeset_unlock_all. 118 - */ 119 - void drm_modeset_lock_all(struct drm_device *dev) 120 - { 121 - WARN_ON(__drm_modeset_lock_all(dev, false) != 0); 122 120 } 123 121 EXPORT_SYMBOL(drm_modeset_lock_all); 124 122
-1
include/drm/drm_modeset_lock.h
··· 130 130 struct drm_plane; 131 131 132 132 void drm_modeset_lock_all(struct drm_device *dev); 133 - int __drm_modeset_lock_all(struct drm_device *dev, bool trylock); 134 133 void drm_modeset_unlock_all(struct drm_device *dev); 135 134 void drm_modeset_lock_crtc(struct drm_crtc *crtc, 136 135 struct drm_plane *plane);