diff options
author | Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 2009-02-05 15:36:10 +0100 |
---|---|---|
committer | Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 2009-02-05 15:38:31 +0100 |
commit | a0f198572ad28e8a576d3afaedc66bff28eb4334 (patch) | |
tree | ce1324f22b112eb0b09d40a5e907fe03daee243d | |
parent | 72ee1c68baa24ea612af2fc2d6a53a8b38668c9a (diff) |
openchrome: Use the BKL for old drm ioctls as some of them don't appear thread-safe, but keep unlocked_ioctl for opencrhome- and TTM code.
-rw-r--r-- | linux-core/openchrome/via_drv.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/linux-core/openchrome/via_drv.c b/linux-core/openchrome/via_drv.c index 928697d5..6b0b8a1d 100644 --- a/linux-core/openchrome/via_drv.c +++ b/linux-core/openchrome/via_drv.c @@ -116,6 +116,33 @@ static struct drm_ioctl_desc via_ioctls[] = { DRM_AUTH) }; +static long via_unlocked_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) +{ + struct drm_file *file_priv = filp->private_data; + struct drm_device *dev = file_priv->minor->dev; + unsigned int nr = DRM_IOCTL_NR(cmd); + long ret; + + /* + * The driver private ioctls and TTM ioctls should be + * thread-safe. + */ + + if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END) + && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) + return drm_unlocked_ioctl(filp, cmd, arg); + + /* + * Not all old drm ioctls are thread-safe. + */ + + lock_kernel(); + ret = drm_unlocked_ioctl(filp, cmd, arg); + unlock_kernel(); + return ret; +} + static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static struct drm_driver driver = { .driver_features = @@ -147,7 +174,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = via_open, .release = via_release, - .unlocked_ioctl = drm_unlocked_ioctl, + .unlocked_ioctl = via_unlocked_ioctl, .mmap = via_mmap, .poll = drm_poll, .fasync = drm_fasync, |