提交 95649c42 编写于 作者: P Peter Huewe 提交者: Greg Kroah-Hartman

staging/xgifb: Add mutext for fb_mmap locking

This adds a mutex for fb_mmap around smem_start and smem_len
so the mutex inside the fb_mmap() is actually used.  Changing of
these fields before calling the framebuffer_register() are not mutexed.

We check whether framebuffer_register has been called by reading
fbinfo->count.

See 537a1bf0 - "fbdev: add mutex for fb_mmap locking" by Krzysztof Helt
for details.
Signed-off-by: NPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 176f7842
...@@ -1350,10 +1350,17 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, ...@@ -1350,10 +1350,17 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
strncpy(fix->id, "XGI", sizeof(fix->id) - 1); strncpy(fix->id, "XGI", sizeof(fix->id) - 1);
fix->smem_start = xgifb_info->video_base; /* if register_framebuffer has been called, we must lock */
if (atomic_read(&info->count))
mutex_lock(&info->mm_lock);
fix->smem_start = xgifb_info->video_base;
fix->smem_len = xgifb_info->video_size; fix->smem_len = xgifb_info->video_size;
/* if register_framebuffer has been called, we can unlock */
if (atomic_read(&info->count))
mutex_unlock(&info->mm_lock);
fix->type = FB_TYPE_PACKED_PIXELS; fix->type = FB_TYPE_PACKED_PIXELS;
fix->type_aux = 0; fix->type_aux = 0;
if (xgifb_info->video_bpp == 8) if (xgifb_info->video_bpp == 8)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册