提交 f55f1f91 编写于 作者: D Dave Airlie

drm/mode: move framebuffer_free up above framebuffer_init

A later patch will use it in framebuffer_init, and I want
to keep the diff cleaner.
Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 7c8f6d25
...@@ -389,6 +389,35 @@ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, ...@@ -389,6 +389,35 @@ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
} }
EXPORT_SYMBOL(drm_mode_object_find); EXPORT_SYMBOL(drm_mode_object_find);
/* dev->mode_config.fb_lock must be held! */
static void __drm_framebuffer_unregister(struct drm_device *dev,
struct drm_framebuffer *fb)
{
drm_mode_object_put(dev, &fb->base);
fb->base.id = 0;
}
static void drm_framebuffer_free(struct kref *kref)
{
struct drm_framebuffer *fb =
container_of(kref, struct drm_framebuffer, refcount);
struct drm_device *dev = fb->dev;
/*
* The lookup idr holds a weak reference, which has not necessarily been
* removed at this point. Check for that.
*/
mutex_lock(&dev->mode_config.fb_lock);
if (fb->base.id) {
/* Mark fb as reaped and drop idr ref. */
__drm_framebuffer_unregister(dev, fb);
}
mutex_unlock(&dev->mode_config.fb_lock);
fb->funcs->destroy(fb);
}
/** /**
* drm_framebuffer_init - initialize a framebuffer * drm_framebuffer_init - initialize a framebuffer
* @dev: DRM device * @dev: DRM device
...@@ -431,35 +460,6 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, ...@@ -431,35 +460,6 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
} }
EXPORT_SYMBOL(drm_framebuffer_init); EXPORT_SYMBOL(drm_framebuffer_init);
/* dev->mode_config.fb_lock must be held! */
static void __drm_framebuffer_unregister(struct drm_device *dev,
struct drm_framebuffer *fb)
{
drm_mode_object_put(dev, &fb->base);
fb->base.id = 0;
}
static void drm_framebuffer_free(struct kref *kref)
{
struct drm_framebuffer *fb =
container_of(kref, struct drm_framebuffer, refcount);
struct drm_device *dev = fb->dev;
/*
* The lookup idr holds a weak reference, which has not necessarily been
* removed at this point. Check for that.
*/
mutex_lock(&dev->mode_config.fb_lock);
if (fb->base.id) {
/* Mark fb as reaped and drop idr ref. */
__drm_framebuffer_unregister(dev, fb);
}
mutex_unlock(&dev->mode_config.fb_lock);
fb->funcs->destroy(fb);
}
static struct drm_framebuffer *__drm_framebuffer_lookup(struct drm_device *dev, static struct drm_framebuffer *__drm_framebuffer_lookup(struct drm_device *dev,
uint32_t id) uint32_t id)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册