static int vfc_open(struct inode *inode, struct file *file) { struct vfc_dev *dev; spin_lock(&vfc_dev_lock); dev = vfc_get_dev_ptr(MINOR(inode->i_rdev)); if (dev == NULL) { spin_unlock(&vfc_dev_lock); return -ENODEV; } if (dev->busy) { spin_unlock(&vfc_dev_lock); return -EBUSY; } dev->busy = 1; spin_unlock(&vfc_dev_lock); vfc_lock_device(dev); vfc_csr_init(dev); vfc_pcf8584_init(dev); vfc_init_i2c_bus(dev); vfc_saa9051_init(dev); vfc_memptr_reset(dev); vfc_captstat_reset(dev); vfc_unlock_device(dev); return 0; }
int init_vfc_hw(struct vfc_dev *dev) { vfc_lock_device(dev); vfc_csr_init(dev); vfc_pcf8584_init(dev); vfc_init_i2c_bus(dev); /* hopefully this doesn't undo the magic sun code above*/ vfc_saa9051_init(dev); vfc_unlock_device(dev); return 0; }
static int vfc_open(struct inode *inode, struct file *file) { struct vfc_dev *dev; dev=vfc_get_dev_ptr(MINOR(inode->i_rdev)); if(!dev) return -ENODEV; if(dev->busy) return -EBUSY; dev->busy=1; MOD_INC_USE_COUNT; vfc_lock_device(dev); vfc_csr_init(dev); vfc_pcf8584_init(dev); vfc_init_i2c_bus(dev); vfc_saa9051_init(dev); vfc_memptr_reset(dev); vfc_captstat_reset(dev); vfc_unlock_device(dev); return 0; }