drm: re-export drm_dev_set_unique

We still need it, for virtio-gpu for example.
Partial revert of commit a742946a1b.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2016-10-04 11:09:35 +02:00
parent a25f0944ba
commit a6b5fac59c
2 changed files with 25 additions and 14 deletions

View File

@ -313,9 +313,10 @@ void drm_minor_release(struct drm_minor *minor)
* callbacks implemented by the driver. The driver then needs to initialize all * callbacks implemented by the driver. The driver then needs to initialize all
* the various subsystems for the drm device like memory management, vblank * the various subsystems for the drm device like memory management, vblank
* handling, modesetting support and intial output configuration plus obviously * handling, modesetting support and intial output configuration plus obviously
* initialize all the corresponding hardware bits. Finally when everything is up * initialize all the corresponding hardware bits. An important part of this is
* and running and ready for userspace the device instance can be published * also calling drm_dev_set_unique() to set the userspace-visible unique name of
* using drm_dev_register(). * this device instance. Finally when everything is up and running and ready for
* userspace the device instance can be published using drm_dev_register().
* *
* There is also deprecated support for initalizing device instances using * There is also deprecated support for initalizing device instances using
* bus-specific helpers and the ->load() callback. But due to * bus-specific helpers and the ->load() callback. But due to
@ -337,17 +338,6 @@ void drm_minor_release(struct drm_minor *minor)
* dev_priv field of &drm_device. * dev_priv field of &drm_device.
*/ */
static int drm_dev_set_unique(struct drm_device *dev, const char *name)
{
if (!name)
return -EINVAL;
kfree(dev->unique);
dev->unique = kstrdup(name, GFP_KERNEL);
return dev->unique ? 0 : -ENOMEM;
}
/** /**
* drm_put_dev - Unregister and release a DRM device * drm_put_dev - Unregister and release a DRM device
* @dev: DRM device * @dev: DRM device
@ -764,6 +754,26 @@ void drm_dev_unregister(struct drm_device *dev)
} }
EXPORT_SYMBOL(drm_dev_unregister); EXPORT_SYMBOL(drm_dev_unregister);
/**
* drm_dev_set_unique - Set the unique name of a DRM device
* @dev: device of which to set the unique name
* @name: unique name
*
* Sets the unique name of a DRM device using the specified string. Drivers
* can use this at driver probe time if the unique name of the devices they
* drive is static.
*
* Return: 0 on success or a negative error code on failure.
*/
int drm_dev_set_unique(struct drm_device *dev, const char *name)
{
kfree(dev->unique);
dev->unique = kstrdup(name, GFP_KERNEL);
return dev->unique ? 0 : -ENOMEM;
}
EXPORT_SYMBOL(drm_dev_set_unique);
/* /*
* DRM Core * DRM Core
* The DRM core module initializes all global DRM objects and makes them * The DRM core module initializes all global DRM objects and makes them

View File

@ -1050,6 +1050,7 @@ void drm_dev_ref(struct drm_device *dev);
void drm_dev_unref(struct drm_device *dev); void drm_dev_unref(struct drm_device *dev);
int drm_dev_register(struct drm_device *dev, unsigned long flags); int drm_dev_register(struct drm_device *dev, unsigned long flags);
void drm_dev_unregister(struct drm_device *dev); void drm_dev_unregister(struct drm_device *dev);
int drm_dev_set_unique(struct drm_device *dev, const char *name);
struct drm_minor *drm_minor_acquire(unsigned int minor_id); struct drm_minor *drm_minor_acquire(unsigned int minor_id);
void drm_minor_release(struct drm_minor *minor); void drm_minor_release(struct drm_minor *minor);