Messages in this thread |  | | | Date | Tue, 15 Apr 2008 22:17:07 -0700 | | From | Andrew Morton <> | | Subject | Re: [Linux-fbdev-devel] [PATCH] fb: Remove use of lock_kernel / unlock_kernel in fbmem | |
On Sun, 13 Apr 2008 11:50:07 -0300 Thiago Galesi <thiagogalesi@gmail.com> wrote:
> This patch removes lock_kernel(), unlock_kernel() usage in fbmem.c and replaces it with a mutex
It isn't that simple, alas.
vfs_ioctl() runs lock_kernel() prior to calling fb_ioctl(), so the
lock_kernel()s in fb_compat_ioctl() are actually providing exclusion against
fb_ioctl(). Your patch would break that.
A suitable fix might be to do
__fb_ioctl(...)
{
<copy fb_ioctl() into here>
}
fb_ioctl(...)
{
mutex_lock(&info->hwlock);
__fb_ioctl(...);
mutex_unlock(&info->hwlock);
}
and then change fb_compat_ioctl() to call __fb_ioctl(). All the other
callers of fb_ioctl() would need to be reviewed - see if they need to take
the mutex then call __fb_ioctl(), or they might be OK as they are, calling
fb_ioctl().
Then we can switch fb_fops over to
.ioctl = NULL,
.unlocked_ioctl = fb_ioctl,
|  |