Lines Matching full:master
26 * @master: drm_master somewhere within tree of lessees and lessors
32 struct drm_master *drm_lease_owner(struct drm_master *master) in drm_lease_owner() argument
34 while (master->lessor != NULL) in drm_lease_owner()
35 master = master->lessor; in drm_lease_owner()
36 return master; in drm_lease_owner()
41 * @master: drm_master of lessor
50 _drm_find_lessee(struct drm_master *master, int lessee_id) in _drm_find_lessee() argument
52 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_find_lessee()
53 return idr_find(&drm_lease_owner(master)->lessee_idr, lessee_id); in _drm_find_lessee()
57 …* _drm_lease_held_master - check to see if an object is leased (or owned) by master (idr_mutex hel…
58 * @master: the master to check the lease status of
61 * Checks if the specified master holds a lease on the object. Return
64 * true 'master' holds a lease on (or owns) the object
65 * false 'master' does not hold a lease.
67 static int _drm_lease_held_master(struct drm_master *master, int id) in _drm_lease_held_master() argument
69 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_lease_held_master()
70 if (master->lessor) in _drm_lease_held_master()
71 return idr_find(&master->leases, id) != NULL; in _drm_lease_held_master()
77 * @master: the master to check the lease status of
80 * Checks if any lessee of 'master' holds a lease on 'id'. Return
86 static bool _drm_has_leased(struct drm_master *master, int id) in _drm_has_leased() argument
90 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_has_leased()
91 drm_for_each_lessee(lessee, master) in _drm_has_leased()
99 * @file_priv: the master drm_file
102 * Checks if the specified master holds a lease on the object. Return
105 * true 'master' holds a lease on (or owns) the object
106 * false 'master' does not hold a lease.
110 if (!file_priv || !file_priv->master) in _drm_lease_held()
113 return _drm_lease_held_master(file_priv->master, id); in _drm_lease_held()
118 * @file_priv: the master drm_file
121 * Checks if the specified master holds a lease on the object. Return
124 * true 'master' holds a lease on (or owns) the object
125 * false 'master' does not hold a lease.
129 struct drm_master *master; in drm_lease_held() local
132 if (!file_priv || !file_priv->master || !file_priv->master->lessor) in drm_lease_held()
135 master = file_priv->master; in drm_lease_held()
136 mutex_lock(&master->dev->mode_config.idr_mutex); in drm_lease_held()
137 ret = _drm_lease_held_master(master, id); in drm_lease_held()
138 mutex_unlock(&master->dev->mode_config.idr_mutex); in drm_lease_held()
152 struct drm_master *master; in drm_lease_filter_crtcs() local
158 if (!file_priv || !file_priv->master || !file_priv->master->lessor) in drm_lease_filter_crtcs()
161 master = file_priv->master; in drm_lease_filter_crtcs()
162 dev = master->dev; in drm_lease_filter_crtcs()
165 mutex_lock(&master->dev->mode_config.idr_mutex); in drm_lease_filter_crtcs()
167 if (_drm_lease_held_master(master, crtc->base.id)) { in drm_lease_filter_crtcs()
179 mutex_unlock(&master->dev->mode_config.idr_mutex); in drm_lease_filter_crtcs()
192 * ERR_PTR(-EACCES) some other master holds the title to any object
257 * drm_lease_destroy - a master is going away (idr_mutex not held)
258 * @master: the drm_master being destroyed
262 * lessor for this master so that it can check
265 void drm_lease_destroy(struct drm_master *master) in drm_lease_destroy() argument
267 struct drm_device *dev = master->dev; in drm_lease_destroy()
271 DRM_DEBUG_LEASE("drm_lease_destroy %d\n", master->lessee_id); in drm_lease_destroy()
273 /* This master is referenced by all lessees, hence it cannot be destroyed in drm_lease_destroy()
276 WARN_ON(!list_empty(&master->lessees)); in drm_lease_destroy()
278 /* Remove this master from the lessee idr in the owner */ in drm_lease_destroy()
279 if (master->lessee_id != 0) { in drm_lease_destroy()
280 DRM_DEBUG_LEASE("remove master %d from device list of lessees\n", master->lessee_id); in drm_lease_destroy()
281 idr_remove(&(drm_lease_owner(master)->lessee_idr), master->lessee_id); in drm_lease_destroy()
284 /* Remove this master from any lessee list it may be on */ in drm_lease_destroy()
285 list_del(&master->lessee_list); in drm_lease_destroy()
289 if (master->lessor) { in drm_lease_destroy()
290 /* Tell the master to check the lessee list */ in drm_lease_destroy()
292 drm_master_put(&master->lessor); in drm_lease_destroy()
295 DRM_DEBUG_LEASE("drm_lease_destroy done %d\n", master->lessee_id); in drm_lease_destroy()
300 * @top: the master losing its lease
306 struct drm_master *master = top; in _drm_lease_revoke() local
315 DRM_DEBUG_LEASE("revoke leases for %p %d\n", master, master->lessee_id); in _drm_lease_revoke()
318 idr_for_each_entry(&master->leases, entry, object) in _drm_lease_revoke()
319 idr_remove(&master->leases, object); in _drm_lease_revoke()
324 if (!list_empty(&master->lessees)) { in _drm_lease_revoke()
325 master = list_first_entry(&master->lessees, struct drm_master, lessee_list); in _drm_lease_revoke()
328 …while (master != top && master == list_last_entry(&master->lessor->lessees, struct drm_master, les… in _drm_lease_revoke()
329 master = master->lessor; in _drm_lease_revoke()
331 if (master == top) in _drm_lease_revoke()
335 master = list_next_entry(master, lessee_list); in _drm_lease_revoke()
342 * @top: the master losing its lease
481 * The master associated with the specified file will have a lease
493 struct drm_master *lessor = lessor_priv->master; in drm_mode_create_lease_ioctl()
567 /* Change the file to a master one */ in drm_mode_create_lease_ioctl()
568 drm_master_put(&lessee_priv->master); in drm_mode_create_lease_ioctl()
569 lessee_priv->master = lessee; in drm_mode_create_lease_ioctl()
600 * Starting from the master associated with the specified file,
601 * the master with the provided lessee_id is found, and then
602 * an array of lessee ids associated with leases from that master
612 struct drm_master *lessor = lessor_priv->master, *lessee; in drm_mode_list_lessees_ioctl()
665 struct drm_master *lessee = lessee_priv->master; in drm_mode_get_lease_ioctl()
724 struct drm_master *lessor = lessor_priv->master; in drm_mode_revoke_lease_ioctl()