| @@ -286,13 +286,13 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id) · 285 unmodified lines |
| 286 | spin_lock_irqsave(&drm_minor_lock, flags); | 286 | spin_lock_irqsave(&drm_minor_lock, flags); |
| 287 | minor = idr_find(&drm_minors_idr, minor_id); | 287 | minor = idr_find(&drm_minors_idr, minor_id); |
| 288 | if (minor) | 288 | if (minor) |
| 289 | drm_dev_ref(minor->dev); | 289 | drm_dev_get(minor->dev); |
| 290 | spin_unlock_irqrestore(&drm_minor_lock, flags); | 290 | spin_unlock_irqrestore(&drm_minor_lock, flags); |
| 291 | | 291 | |
| 292 | if (!minor) { | 292 | if (!minor) { |
| 293 | return ERR_PTR(-ENODEV); | 293 | return ERR_PTR(-ENODEV); |
| 294 | } else if (drm_dev_is_unplugged(minor->dev)) { | 294 | } else if (drm_dev_is_unplugged(minor->dev)) { |
| 295 | drm_dev_unref(minor->dev); | 295 | drm_dev_put(minor->dev); |
| 296 | return ERR_PTR(-ENODEV); | 296 | return ERR_PTR(-ENODEV); |
| 297 | } | 297 | } |
| 298 | | 298 | |
| @@ -301,7 +301,7 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id) · 2 unmodified lines |
| 301 | | 301 | |
| 302 | void drm_minor_release(struct drm_minor *minor) | 302 | void drm_minor_release(struct drm_minor *minor) |
| 303 | { | 303 | { |
| 304 | drm_dev_unref(minor->dev); | 304 | drm_dev_put(minor->dev); |
| 305 | } | 305 | } |
| 306 | | 306 | |
| 307 | /** | 307 | /** |
| @@ -326,11 +326,11 @@ void drm_minor_release(struct drm_minor *minor) · 18 unmodified lines |
| 326 | * When cleaning up a device instance everything needs to be done in reverse: | 326 | * When cleaning up a device instance everything needs to be done in reverse: |
| 327 | * First unpublish the device instance with drm_dev_unregister(). Then clean up | 327 | * First unpublish the device instance with drm_dev_unregister(). Then clean up |
| 328 | * any other resources allocated at device initialization and drop the driver's | 328 | * any other resources allocated at device initialization and drop the driver's |
| 329 | * reference to &drm_device using drm_dev_unref(). | 329 | * reference to &drm_device using drm_dev_put(). |
| 330 | * | 330 | * |
| 331 | * Note that the lifetime rules for &drm_device instance has still a lot of | 331 | * Note that the lifetime rules for &drm_device instance has still a lot of |
| 332 | * historical baggage. Hence use the reference counting provided by | 332 | * historical baggage. Hence use the reference counting provided by |
| 333 | * drm_dev_ref() and drm_dev_unref() only carefully. | 333 | * drm_dev_get() and drm_dev_put() only carefully. |
| 334 | * | 334 | * |
| 335 | * It is recommended that drivers embed &struct drm_device into their own device | 335 | * It is recommended that drivers embed &struct drm_device into their own device |
| 336 | * structure, which is supported through drm_dev_init(). | 336 | * structure, which is supported through drm_dev_init(). |
| @@ -345,7 +345,7 @@ void drm_minor_release(struct drm_minor *minor) · 8 unmodified lines |
| 345 | * Cleans up all DRM device, calling drm_lastclose(). | 345 | * Cleans up all DRM device, calling drm_lastclose(). |
| 346 | * | 346 | * |
| 347 | * Note: Use of this function is deprecated. It will eventually go away | 347 | * Note: Use of this function is deprecated. It will eventually go away |
| 348 | * completely. Please use drm_dev_unregister() and drm_dev_unref() explicitly | 348 | * completely. Please use drm_dev_unregister() and drm_dev_put() explicitly |
| 349 | * instead to make sure that the device isn't userspace accessible any more | 349 | * instead to make sure that the device isn't userspace accessible any more |
| 350 | * while teardown is in progress, ensuring that userspace can't access an | 350 | * while teardown is in progress, ensuring that userspace can't access an |
| 351 | * inconsistent state. | 351 | * inconsistent state. |
| @@ -360,7 +360,7 @@ void drm_put_dev(struct drm_device *dev) · 8 unmodified lines |
| 360 | } | 360 | } |
| 361 | | 361 | |
| 362 | drm_dev_unregister(dev); | 362 | drm_dev_unregister(dev); |
| 363 | drm_dev_unref(dev); | 363 | drm_dev_put(dev); |
| 364 | } | 364 | } |
| 365 | EXPORT_SYMBOL(drm_put_dev); | 365 | EXPORT_SYMBOL(drm_put_dev); |
| 366 | | 366 | |
| @@ -386,7 +386,7 @@ void drm_dev_unplug(struct drm_device *dev) · 19 unmodified lines |
| 386 | mutex_lock(&drm_global_mutex); | 386 | mutex_lock(&drm_global_mutex); |
| 387 | drm_device_set_unplugged(dev); | 387 | drm_device_set_unplugged(dev); |
| 388 | if (dev->open_count == 0) | 388 | if (dev->open_count == 0) |
| 389 | drm_dev_unref(dev); | 389 | drm_dev_put(dev); |
| 390 | mutex_unlock(&drm_global_mutex); | 390 | mutex_unlock(&drm_global_mutex); |
| 391 | } | 391 | } |
| 392 | EXPORT_SYMBOL(drm_dev_unplug); | 392 | EXPORT_SYMBOL(drm_dev_unplug); |
| @@ -475,8 +475,8 @@ static void drm_fs_inode_free(struct inode *inode) · 82 unmodified lines |
| 475 | * initialization sequence to make sure userspace can't access an inconsistent | 475 | * initialization sequence to make sure userspace can't access an inconsistent |
| 476 | * state. | 476 | * state. |
| 477 | * | 477 | * |
| 478 | * The initial ref-count of the object is 1. Use drm_dev_ref() and | 478 | * The initial ref-count of the object is 1. Use drm_dev_get() and |
| 479 | * drm_dev_unref() to take and drop further ref-counts. | 479 | * drm_dev_put() to take and drop further ref-counts. |
| 480 | * | 480 | * |
| 481 | * Note that for purely virtual devices @parent can be NULL. | 481 | * Note that for purely virtual devices @parent can be NULL. |
| 482 | * | 482 | * |
| @@ -626,8 +626,8 @@ EXPORT_SYMBOL(drm_dev_fini); · 143 unmodified lines |
| 626 | * initialization sequence to make sure userspace can't access an inconsistent | 626 | * initialization sequence to make sure userspace can't access an inconsistent |
| 627 | * state. | 627 | * state. |
| 628 | * | 628 | * |
| 629 | * The initial ref-count of the object is 1. Use drm_dev_ref() and | 629 | * The initial ref-count of the object is 1. Use drm_dev_get() and |
| 630 | * drm_dev_unref() to take and drop further ref-counts. | 630 | * drm_dev_put() to take and drop further ref-counts. |
| 631 | * | 631 | * |
| 632 | * Note that for purely virtual devices @parent can be NULL. | 632 | * Note that for purely virtual devices @parent can be NULL. |
| 633 | * | 633 | * |
| @@ -670,36 +670,49 @@ static void drm_dev_release(struct kref *ref) · 36 unmodified lines |
| 670 | } | 670 | } |
| 671 | | 671 | |
| 672 | /** | 672 | /** |
| 673 | * drm_dev_ref - Take reference of a DRM device | 673 | * drm_dev_get - Take reference of a DRM device |
| 674 | * @dev: device to take reference of or NULL | 674 | * @dev: device to take reference of or NULL |
| 675 | * | 675 | * |
| 676 | * This increases the ref-count of @dev by one. You *must* already own a | 676 | * This increases the ref-count of @dev by one. You *must* already own a |
| 677 | * reference when calling this. Use drm_dev_unref() to drop this reference | 677 | * reference when calling this. Use drm_dev_put() to drop this reference |
| 678 | * again. | 678 | * again. |
| 679 | * | 679 | * |
| 680 | * This function never fails. However, this function does not provide *any* | 680 | * This function never fails. However, this function does not provide *any* |
| 681 | * guarantee whether the device is alive or running. It only provides a | 681 | * guarantee whether the device is alive or running. It only provides a |
| 682 | * reference to the object and the memory associated with it. | 682 | * reference to the object and the memory associated with it. |
| 683 | */ | 683 | */ |
| 684 | void drm_dev_ref(struct drm_device *dev) | 684 | void drm_dev_get(struct drm_device *dev) |
| 685 | { | 685 | { |
| 686 | if (dev) | 686 | if (dev) |
| 687 | kref_get(&dev->ref); | 687 | kref_get(&dev->ref); |
| 688 | } | 688 | } |
| 689 | EXPORT_SYMBOL(drm_dev_ref); | 689 | EXPORT_SYMBOL(drm_dev_get); |
| 690 | | 690 | |
| 691 | /** | 691 | /** |
| 692 | * drm_dev_unref - Drop reference of a DRM device | 692 | * drm_dev_put - Drop reference of a DRM device |
| 693 | * @dev: device to drop reference of or NULL | 693 | * @dev: device to drop reference of or NULL |
| 694 | * | 694 | * |
| 695 | * This decreases the ref-count of @dev by one. The device is destroyed if the | 695 | * This decreases the ref-count of @dev by one. The device is destroyed if the |
| 696 | * ref-count drops to zero. | 696 | * ref-count drops to zero. |
| 697 | */ | 697 | */ |
| 698 | void drm_dev_unref(struct drm_device *dev) | 698 | void drm_dev_put(struct drm_device *dev) |
| 699 | { | 699 | { |
| 700 | if (dev) | 700 | if (dev) |
| 701 | kref_put(&dev->ref, drm_dev_release); | 701 | kref_put(&dev->ref, drm_dev_release); |
| 702 | } | 702 | } |
| | 703 | EXPORT_SYMBOL(drm_dev_put); |
| | 704 | |
| | 705 | /** |
| | 706 | * drm_dev_unref - Drop reference of a DRM device |
| | 707 | * @dev: device to drop reference of or NULL |
| | 708 | * |
| | 709 | * This is a compatibility alias for drm_dev_put() and should not be used by new |
| | 710 | * code. |
| | 711 | */ |
| | 712 | void drm_dev_unref(struct drm_device *dev) |
| | 713 | { |
| | 714 | drm_dev_put(dev); |
| | 715 | } |
| 703 | EXPORT_SYMBOL(drm_dev_unref); | 716 | EXPORT_SYMBOL(drm_dev_unref); |
| 704 | | 717 | |
| 705 | static int create_compat_control_link(struct drm_device *dev) | 718 | static int create_compat_control_link(struct drm_device *dev) |
| @@ -839,7 +852,7 @@ EXPORT_SYMBOL(drm_dev_register); · 133 unmodified lines |
| 839 | * | 852 | * |
| 840 | * Unregister the DRM device from the system. This does the reverse of | 853 | * Unregister the DRM device from the system. This does the reverse of |
| 841 | * drm_dev_register() but does not deallocate the device. The caller must call | 854 | * drm_dev_register() but does not deallocate the device. The caller must call |
| 842 | * drm_dev_unref() to drop their final reference. | 855 | * drm_dev_put() to drop their final reference. |
| 843 | * | 856 | * |
| 844 | * A special form of unregistering for hotpluggable devices is drm_dev_unplug(), | 857 | * A special form of unregistering for hotpluggable devices is drm_dev_unplug(), |
| 845 | * which can be called while there are still open users of @dev. | 858 | * which can be called while there are still open users of @dev. |