diff options
| author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-02-28 09:49:07 -0500 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-04-24 05:29:32 -0400 |
| commit | 46b757780dfe60596124b85befa935554dba73a3 (patch) | |
| tree | 54d8db19d6529a1335125d9fb90217f7aead66bd | |
| parent | 4285c7e1aaad6ffe5520b36047a28fc960e32482 (diff) | |
drm/lease: Check for lessor outside of locks
The lessor is invariant over a lifetime of a lease, we don't have to
grab any locks for that. Speeds up the common case of not being a lease.
Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-5-daniel.vetter@ffwll.ch
| -rw-r--r-- | drivers/gpu/drm/drm_lease.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c index cce5d9dd52ff..694ff363a90b 100644 --- a/drivers/gpu/drm/drm_lease.c +++ b/drivers/gpu/drm/drm_lease.c | |||
| @@ -111,7 +111,7 @@ static bool _drm_has_leased(struct drm_master *master, int id) | |||
| 111 | */ | 111 | */ |
| 112 | bool _drm_lease_held(struct drm_file *file_priv, int id) | 112 | bool _drm_lease_held(struct drm_file *file_priv, int id) |
| 113 | { | 113 | { |
| 114 | if (file_priv == NULL || file_priv->master == NULL) | 114 | if (!file_priv || !file_priv->master) |
| 115 | return true; | 115 | return true; |
| 116 | 116 | ||
| 117 | return _drm_lease_held_master(file_priv->master, id); | 117 | return _drm_lease_held_master(file_priv->master, id); |
| @@ -133,7 +133,7 @@ bool drm_lease_held(struct drm_file *file_priv, int id) | |||
| 133 | struct drm_master *master; | 133 | struct drm_master *master; |
| 134 | bool ret; | 134 | bool ret; |
| 135 | 135 | ||
| 136 | if (file_priv == NULL || file_priv->master == NULL) | 136 | if (!file_priv || !file_priv->master || !file_priv->master->lessor) |
| 137 | return true; | 137 | return true; |
| 138 | 138 | ||
| 139 | master = file_priv->master; | 139 | master = file_priv->master; |
| @@ -159,7 +159,7 @@ uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs_in) | |||
| 159 | int count_in, count_out; | 159 | int count_in, count_out; |
| 160 | uint32_t crtcs_out = 0; | 160 | uint32_t crtcs_out = 0; |
| 161 | 161 | ||
| 162 | if (file_priv == NULL || file_priv->master == NULL) | 162 | if (!file_priv || !file_priv->master || !file_priv->master->lessor) |
| 163 | return crtcs_in; | 163 | return crtcs_in; |
| 164 | 164 | ||
| 165 | master = file_priv->master; | 165 | master = file_priv->master; |
