diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-10-20 12:55:40 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-11-05 23:52:51 -0500 |
commit | f73aca50b7f6e0f3e04d887f852b9f8b0e108fa7 (patch) | |
tree | 65c094572c8989e5edbec7e2a16c187c725f2fb8 /drivers/gpu/drm/drm_stub.c | |
parent | 02ee4e9455456a9bc9ee94d30eef78fc610922c1 (diff) |
drm: call drm_unplug_minor() from drm_put_minor()
This protects drm_unplug_minor() against repeated calls so we can use it
in drm_put_minor(). This allows us to further simplify it in follow-ups as
we no longer do minor-destruction in both functions but only in
drm_unplug_minor().
Also add kernel-doc comments about what these calls do.
[airlied: fixup for changes to kdev stuff]
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 26055abf94ee..ae3f293229ae 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -324,10 +324,30 @@ err_idr: | |||
324 | EXPORT_SYMBOL(drm_get_minor); | 324 | EXPORT_SYMBOL(drm_get_minor); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Put a secondary minor number. | 327 | * drm_unplug_minor - Unplug DRM minor |
328 | * @minor: Minor to unplug | ||
328 | * | 329 | * |
329 | * \param sec_minor - structure to be released | 330 | * Unplugs the given DRM minor but keeps the object. So after this returns, |
330 | * \return always zero | 331 | * minor->dev is still valid so existing open-files can still access it to get |
332 | * device information from their drm_file ojects. | ||
333 | * If the minor is already unplugged or if @minor is NULL, nothing is done. | ||
334 | * The global DRM mutex must be held by the caller. | ||
335 | */ | ||
336 | static void drm_unplug_minor(struct drm_minor *minor) | ||
337 | { | ||
338 | if (!minor || !device_is_registered(minor->kdev)) | ||
339 | return; | ||
340 | |||
341 | drm_sysfs_device_remove(minor); | ||
342 | } | ||
343 | |||
344 | /** | ||
345 | * drm_put_minor - Destroy DRM minor | ||
346 | * @minor_p: Double pointer to DRM minor | ||
347 | * | ||
348 | * This calls drm_unplug_minor() on the given minor and then frees it. The minor | ||
349 | * pointer is reset to NULL before this returns. | ||
350 | * The global DRM mutex must be held by the caller. | ||
331 | */ | 351 | */ |
332 | int drm_put_minor(struct drm_minor **minor_p) | 352 | int drm_put_minor(struct drm_minor **minor_p) |
333 | { | 353 | { |
@@ -339,7 +359,7 @@ int drm_put_minor(struct drm_minor **minor_p) | |||
339 | drm_debugfs_cleanup(minor); | 359 | drm_debugfs_cleanup(minor); |
340 | #endif | 360 | #endif |
341 | 361 | ||
342 | drm_sysfs_device_remove(minor); | 362 | drm_unplug_minor(minor); |
343 | 363 | ||
344 | idr_remove(&drm_minors_idr, minor->index); | 364 | idr_remove(&drm_minors_idr, minor->index); |
345 | 365 | ||
@@ -349,11 +369,6 @@ int drm_put_minor(struct drm_minor **minor_p) | |||
349 | } | 369 | } |
350 | EXPORT_SYMBOL(drm_put_minor); | 370 | EXPORT_SYMBOL(drm_put_minor); |
351 | 371 | ||
352 | static void drm_unplug_minor(struct drm_minor *minor) | ||
353 | { | ||
354 | drm_sysfs_device_remove(minor); | ||
355 | } | ||
356 | |||
357 | /** | 372 | /** |
358 | * Called via drm_exit() at module unload time or when pci device is | 373 | * Called via drm_exit() at module unload time or when pci device is |
359 | * unplugged. | 374 | * unplugged. |