X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fsbus%2Fchar%2Fvfc_dev.c;h=25181bb7d627752de1d4f6932f96d8d4ec2bbb8e;hb=04489eeb02a40bc15029886cef7285ada3ab0de6;hp=d4f8fcded51d8615e1da7cd5996ac715b0defd9e;hpb=43cd73658d8077ee6899b0b5029aad0cba1e9f92;p=linux-2.6 diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index d4f8fcded5..25181bb7d6 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,7 @@ #include static const struct file_operations vfc_fops; -struct vfc_dev **vfc_dev_lst; +static struct vfc_dev **vfc_dev_lst; static char vfcstr[]="vfc"; static unsigned char saa9051_init_array[VFC_SAA9051_NR] = { 0x00, 0x64, 0x72, 0x52, @@ -53,18 +54,18 @@ static unsigned char saa9051_init_array[VFC_SAA9051_NR] = { 0x3e }; -void vfc_lock_device(struct vfc_dev *dev) +static void vfc_lock_device(struct vfc_dev *dev) { mutex_lock(&dev->device_lock_mtx); } -void vfc_unlock_device(struct vfc_dev *dev) +static void vfc_unlock_device(struct vfc_dev *dev) { mutex_unlock(&dev->device_lock_mtx); } -void vfc_captstat_reset(struct vfc_dev *dev) +static void vfc_captstat_reset(struct vfc_dev *dev) { dev->control_reg |= VFC_CONTROL_CAPTRESET; sbus_writel(dev->control_reg, &dev->regs->control); @@ -74,7 +75,7 @@ void vfc_captstat_reset(struct vfc_dev *dev) sbus_writel(dev->control_reg, &dev->regs->control); } -void vfc_memptr_reset(struct vfc_dev *dev) +static void vfc_memptr_reset(struct vfc_dev *dev) { dev->control_reg |= VFC_CONTROL_MEMPTR; sbus_writel(dev->control_reg, &dev->regs->control); @@ -84,7 +85,7 @@ void vfc_memptr_reset(struct vfc_dev *dev) sbus_writel(dev->control_reg, &dev->regs->control); } -int vfc_csr_init(struct vfc_dev *dev) +static int vfc_csr_init(struct vfc_dev *dev) { dev->control_reg = 0x80000000; sbus_writel(dev->control_reg, &dev->regs->control); @@ -106,7 +107,7 @@ int vfc_csr_init(struct vfc_dev *dev) return 0; } -int vfc_saa9051_init(struct vfc_dev *dev) +static int vfc_saa9051_init(struct vfc_dev *dev) { int i; @@ -118,7 +119,7 @@ int vfc_saa9051_init(struct vfc_dev *dev) return 0; } -int init_vfc_hw(struct vfc_dev *dev) +static int init_vfc_hw(struct vfc_dev *dev) { vfc_lock_device(dev); vfc_csr_init(dev); @@ -131,7 +132,7 @@ int init_vfc_hw(struct vfc_dev *dev) return 0; } -int init_vfc_devstruct(struct vfc_dev *dev, int instance) +static int init_vfc_devstruct(struct vfc_dev *dev, int instance) { dev->instance=instance; mutex_init(&dev->device_lock_mtx); @@ -140,7 +141,8 @@ int init_vfc_devstruct(struct vfc_dev *dev, int instance) return 0; } -int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) +static int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, + int instance) { if(dev == NULL) { printk(KERN_ERR "VFC: Bogus pointer passed\n"); @@ -167,7 +169,7 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) } -struct vfc_dev *vfc_get_dev_ptr(int instance) +static struct vfc_dev *vfc_get_dev_ptr(int instance) { return vfc_dev_lst[instance]; } @@ -178,14 +180,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; } @@ -202,6 +207,7 @@ static int vfc_open(struct inode *inode, struct file *file) vfc_captstat_reset(dev); vfc_unlock_device(dev); + unlock_kernel(); return 0; } @@ -287,7 +293,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, void __user *argp) return 0; } -int vfc_capture_start(struct vfc_dev *dev) +static int vfc_capture_start(struct vfc_dev *dev) { vfc_captstat_reset(dev); dev->control_reg = sbus_readl(&dev->regs->control); @@ -309,7 +315,7 @@ int vfc_capture_start(struct vfc_dev *dev) return 0; } -int vfc_capture_poll(struct vfc_dev *dev) +static int vfc_capture_poll(struct vfc_dev *dev) { int timeout = 1000; @@ -385,8 +391,8 @@ static int vfc_set_control_ioctl(struct inode *inode, struct file *file, } -int vfc_port_change_ioctl(struct inode *inode, struct file *file, - struct vfc_dev *dev, unsigned long arg) +static int vfc_port_change_ioctl(struct inode *inode, struct file *file, + struct vfc_dev *dev, unsigned long arg) { int ret = 0; int cmd; @@ -455,8 +461,8 @@ int vfc_port_change_ioctl(struct inode *inode, struct file *file, return ret; } -int vfc_set_video_ioctl(struct inode *inode, struct file *file, - struct vfc_dev *dev, unsigned long arg) +static int vfc_set_video_ioctl(struct inode *inode, struct file *file, + struct vfc_dev *dev, unsigned long arg) { int ret = 0; int cmd; @@ -506,8 +512,8 @@ int vfc_set_video_ioctl(struct inode *inode, struct file *file, return ret; } -int vfc_get_video_ioctl(struct inode *inode, struct file *file, - struct vfc_dev *dev, unsigned long arg) +static int vfc_get_video_ioctl(struct inode *inode, struct file *file, + struct vfc_dev *dev, unsigned long arg) { int ret = 0; unsigned int status = NO_LOCK;