X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fsbus%2Fchar%2Fvfc_dev.c;h=1f6cb8ae2784cddaf76aa949033381b271126037;hb=5ab0854dd77a520abe7c3b9c7770972fd3e61e90;hp=9269f7fbd36364957f0cdc97a90357f4e987fd1f;hpb=dd9cd6d4351076c78bb8c0f9146d1904b481fdbb;p=linux-2.6 diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index 9269f7fbd3..1f6cb8ae27 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -22,7 +22,9 @@ #include #include #include +#include #include +#include #include #include @@ -54,12 +56,12 @@ static unsigned char saa9051_init_array[VFC_SAA9051_NR] = { void vfc_lock_device(struct vfc_dev *dev) { - down(&dev->device_lock_sem); + mutex_lock(&dev->device_lock_mtx); } void vfc_unlock_device(struct vfc_dev *dev) { - up(&dev->device_lock_sem); + mutex_unlock(&dev->device_lock_mtx); } @@ -133,7 +135,7 @@ int init_vfc_hw(struct vfc_dev *dev) int init_vfc_devstruct(struct vfc_dev *dev, int instance) { dev->instance=instance; - init_MUTEX(&dev->device_lock_sem); + mutex_init(&dev->device_lock_mtx); dev->control_reg=0; dev->busy=0; return 0; @@ -177,14 +179,17 @@ static int vfc_open(struct inode *inode, struct file *file) { struct vfc_dev *dev; + lock_kernel(); spin_lock(&vfc_dev_lock); dev = vfc_get_dev_ptr(iminor(inode)); if (dev == NULL) { spin_unlock(&vfc_dev_lock); + unlock_kernel(); return -ENODEV; } if (dev->busy) { spin_unlock(&vfc_dev_lock); + unlock_kernel(); return -EBUSY; } @@ -201,6 +206,7 @@ static int vfc_open(struct inode *inode, struct file *file) vfc_captstat_reset(dev); vfc_unlock_device(dev); + unlock_kernel(); return 0; }