Lines 1616-1622
Link Here
|
1616 |
fd->maxrawdatalen = 0; /* Hopefully stops all ongoing captures, might need locking though */ |
1616 |
fd->maxrawdatalen = 0; /* Hopefully stops all ongoing captures, might need locking though */ |
1617 |
wake_up(&fd->wq); |
1617 |
wake_up(&fd->wq); |
1618 |
if (qcdebug&QC_DEBUGFRAME) PDEBUG("waiting=%i",fd->waiting); |
1618 |
if (qcdebug&QC_DEBUGFRAME) PDEBUG("waiting=%i",fd->waiting); |
1619 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_exit() : %i", qc, sem_getcount(&qc->lock)); |
1619 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_exit() : %i", qc, 0); |
1620 |
up(&qc->lock); /* The lock was down when entering this function */ |
1620 |
up(&qc->lock); /* The lock was down when entering this function */ |
1621 |
while (fd->waiting > 0) { |
1621 |
while (fd->waiting > 0) { |
1622 |
schedule(); |
1622 |
schedule(); |
Lines 1627-1633
Link Here
|
1627 |
} |
1627 |
} |
1628 |
#endif |
1628 |
#endif |
1629 |
} |
1629 |
} |
1630 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_exit() : %i", qc, sem_getcount(&qc->lock)); |
1630 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_exit() : %i", qc, 0); |
1631 |
down(&qc->lock); |
1631 |
down(&qc->lock); |
1632 |
vfree(fd->rawdatabuf); |
1632 |
vfree(fd->rawdatabuf); |
1633 |
POISON(fd->rawdatabuf); |
1633 |
POISON(fd->rawdatabuf); |
Lines 1656-1669
Link Here
|
1656 |
/* Wait until the next frame is available */ |
1656 |
/* Wait until the next frame is available */ |
1657 |
if (qcdebug&QC_DEBUGFRAME) PDEBUG("qc_frame_get/consume(qc=%p,tail=%i,head=%i)",qc,fd->tail,fd->head); |
1657 |
if (qcdebug&QC_DEBUGFRAME) PDEBUG("qc_frame_get/consume(qc=%p,tail=%i,head=%i)",qc,fd->tail,fd->head); |
1658 |
fd->waiting++; |
1658 |
fd->waiting++; |
1659 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_get() : %i", qc, sem_getcount(&qc->lock)); |
1659 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_get() : %i", qc, 0); |
1660 |
up(&qc->lock); /* Release lock while waiting */ |
1660 |
up(&qc->lock); /* Release lock while waiting */ |
1661 |
|
1661 |
|
1662 |
ret = wait_event_interruptible(fd->wq, fd->head!=fd->tail || fd->exiting); //FIXME:What if we get -ERESTARTSYS? |
1662 |
ret = wait_event_interruptible(fd->wq, fd->head!=fd->tail || fd->exiting); //FIXME:What if we get -ERESTARTSYS? |
1663 |
if(ret == -ERESTARTSYS) { |
1663 |
if(ret == -ERESTARTSYS) { |
1664 |
PDEBUG("wait_event_interruptible() returned ERESTARTSYS"); |
1664 |
PDEBUG("wait_event_interruptible() returned ERESTARTSYS"); |
1665 |
} |
1665 |
} |
1666 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_get() : %i", qc, sem_getcount(&qc->lock)); |
1666 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_get() : %i", qc, 0); |
1667 |
down(&qc->lock); |
1667 |
down(&qc->lock); |
1668 |
if (!ret) { |
1668 |
if (!ret) { |
1669 |
if (!fd->exiting) { |
1669 |
if (!fd->exiting) { |
Lines 2685-2696
Link Here
|
2685 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_INC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE)); |
2685 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_INC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE)); |
2686 |
MOD_INC_USE_COUNT; |
2686 |
MOD_INC_USE_COUNT; |
2687 |
|
2687 |
|
2688 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list) in qc_v4l_open() : %i", sem_getcount(&quickcam_list_lock)); |
2688 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list) in qc_v4l_open() : %i", 0); |
2689 |
|
2689 |
|
2690 |
r = qc_lock(qc); |
2690 |
r = qc_lock(qc); |
2691 |
if (r<0) goto fail1; |
2691 |
if (r<0) goto fail1; |
2692 |
|
2692 |
|
2693 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_open() : %i", qc, sem_getcount(&qc->lock)); |
2693 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_open() : %i", qc, 0); |
2694 |
if (down_interruptible(&qc->lock)) { |
2694 |
if (down_interruptible(&qc->lock)) { |
2695 |
r = -ERESTARTSYS; |
2695 |
r = -ERESTARTSYS; |
2696 |
goto fail2; |
2696 |
goto fail2; |
Lines 2705-2719
Link Here
|
2705 |
if (qcdebug&QC_DEBUGLOGIC) PDEBUG("First user, initializing"); |
2705 |
if (qcdebug&QC_DEBUGLOGIC) PDEBUG("First user, initializing"); |
2706 |
if ((r = qc_v4l_init(qc))<0) goto fail4; |
2706 |
if ((r = qc_v4l_init(qc))<0) goto fail4; |
2707 |
} |
2707 |
} |
2708 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open() : %i",qc, sem_getcount(&qc->lock)); |
2708 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open() : %i",qc, 0); |
2709 |
up(&qc->lock); |
2709 |
up(&qc->lock); |
2710 |
up(&quickcam_list_lock); |
2710 |
up(&quickcam_list_lock); |
2711 |
return 0; |
2711 |
return 0; |
2712 |
|
2712 |
|
2713 |
fail4: qc->users--; |
2713 |
fail4: qc->users--; |
2714 |
fail3: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open()=failed : %i",qc, sem_getcount(&qc->lock)); |
2714 |
fail3: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open()=failed : %i",qc, 0); |
2715 |
up(&qc->lock); |
2715 |
up(&qc->lock); |
2716 |
fail2: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_open()=failed : %i", sem_getcount(&qc->lock)); |
2716 |
fail2: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_open()=failed : %i", 0); |
2717 |
up(&quickcam_list_lock); |
2717 |
up(&quickcam_list_lock); |
2718 |
fail1: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE)); |
2718 |
fail1: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE)); |
2719 |
MOD_DEC_USE_COUNT; |
2719 |
MOD_DEC_USE_COUNT; |
Lines 2747-2755
Link Here
|
2747 |
#else |
2747 |
#else |
2748 |
TEST_BUG_MSG(qc==NULL, "qc==NULL"); |
2748 |
TEST_BUG_MSG(qc==NULL, "qc==NULL"); |
2749 |
#endif |
2749 |
#endif |
2750 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_v4l_close() : %i", sem_getcount(&quickcam_list_lock)); |
2750 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_v4l_close() : %i", 0); |
2751 |
down(&quickcam_list_lock); /* Can not interrupt, we must success */ |
2751 |
down(&quickcam_list_lock); /* Can not interrupt, we must success */ |
2752 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_v4l_close() : %i", qc, sem_getcount(&qc->lock)); |
2752 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_v4l_close() : %i", qc, 0); |
2753 |
down(&qc->lock); /* Can not interrupt, we must success */ |
2753 |
down(&qc->lock); /* Can not interrupt, we must success */ |
2754 |
qc->users--; |
2754 |
qc->users--; |
2755 |
PDEBUG("close users=%i", qc->users); |
2755 |
PDEBUG("close users=%i", qc->users); |
Lines 2764-2773
Link Here
|
2764 |
} |
2764 |
} |
2765 |
} |
2765 |
} |
2766 |
if (qc) { |
2766 |
if (qc) { |
2767 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_close() : %i", qc, sem_getcount(&qc->lock)); |
2767 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_close() : %i", qc, 0); |
2768 |
up(&qc->lock); |
2768 |
up(&qc->lock); |
2769 |
} |
2769 |
} |
2770 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_close() : %i", sem_getcount(&quickcam_list_lock)); |
2770 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_close() : %i", 0); |
2771 |
up(&quickcam_list_lock); |
2771 |
up(&quickcam_list_lock); |
2772 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_close() : %i", GET_USE_COUNT(THIS_MODULE)); |
2772 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_close() : %i", GET_USE_COUNT(THIS_MODULE)); |
2773 |
MOD_DEC_USE_COUNT; |
2773 |
MOD_DEC_USE_COUNT; |
Lines 2801-2807
Link Here
|
2801 |
PDEBUG("qc_read: no video_device available or no buffer attached :( EFAULT"); |
2801 |
PDEBUG("qc_read: no video_device available or no buffer attached :( EFAULT"); |
2802 |
return -EFAULT; |
2802 |
return -EFAULT; |
2803 |
} |
2803 |
} |
2804 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_read() : %i", qc, sem_getcount(&qc->lock)); |
2804 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_read() : %i", qc, 0); |
2805 |
if (down_interruptible(&qc->lock)) return -ERESTARTSYS; |
2805 |
if (down_interruptible(&qc->lock)) return -ERESTARTSYS; |
2806 |
if (!qc->connected) { |
2806 |
if (!qc->connected) { |
2807 |
r = -ENODEV; |
2807 |
r = -ENODEV; |
Lines 2823-2829
Link Here
|
2823 |
} |
2823 |
} |
2824 |
r = count; |
2824 |
r = count; |
2825 |
|
2825 |
|
2826 |
fail: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_read() : %i", qc, sem_getcount(&qc->lock)); |
2826 |
fail: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_read() : %i", qc, 0); |
2827 |
up(&qc->lock); |
2827 |
up(&qc->lock); |
2828 |
if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) if (r<0) PDEBUG("failed qc_v4l_read()=%i", (int)r); |
2828 |
if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) if (r<0) PDEBUG("failed qc_v4l_read()=%i", (int)r); |
2829 |
return r; |
2829 |
return r; |
Lines 2852-2865
Link Here
|
2852 |
struct vm_area_struct *vma = NULL; |
2852 |
struct vm_area_struct *vma = NULL; |
2853 |
#endif |
2853 |
#endif |
2854 |
if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_mmap(dev=%p,size=%li,qc=%p)",dev,size,qc); |
2854 |
if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_mmap(dev=%p,size=%li,qc=%p)",dev,size,qc); |
2855 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_mmap() : %i", qc, sem_getcount(&qc->lock)); |
2855 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_mmap() : %i", qc, 0); |
2856 |
if (down_interruptible(&qc->lock)) return -ERESTARTSYS; |
2856 |
if (down_interruptible(&qc->lock)) return -ERESTARTSYS; |
2857 |
if (!qc->connected) { ret = -ENODEV; goto fail; } |
2857 |
if (!qc->connected) { ret = -ENODEV; goto fail; } |
2858 |
frame_size = qc_capt_frameaddr(qc, &frame); |
2858 |
frame_size = qc_capt_frameaddr(qc, &frame); |
2859 |
if (frame_size<0) { ret = frame_size; goto fail; } /* Should never happen */ |
2859 |
if (frame_size<0) { ret = frame_size; goto fail; } /* Should never happen */ |
2860 |
ret = qc_mm_remap(vma, frame, frame_size, start, size); |
2860 |
ret = qc_mm_remap(vma, frame, frame_size, start, size); |
2861 |
|
2861 |
|
2862 |
fail: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_mmap() : %i", qc, sem_getcount(&qc->lock)); |
2862 |
fail: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_mmap() : %i", qc, 0); |
2863 |
up(&qc->lock); |
2863 |
up(&qc->lock); |
2864 |
if (ret<0) if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_v4l_mmap()=%i",ret); |
2864 |
if (ret<0) if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_v4l_mmap()=%i",ret); |
2865 |
return ret; |
2865 |
return ret; |
Lines 2881-2887
Link Here
|
2881 |
int i, retval = 0; |
2881 |
int i, retval = 0; |
2882 |
|
2882 |
|
2883 |
if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_ioctl(dev=%p,cmd=%u,arg=%p,qc=%p)",dev,cmd,argp,qc); |
2883 |
if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_ioctl(dev=%p,cmd=%u,arg=%p,qc=%p)",dev,cmd,argp,qc); |
2884 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_ioctl() : %i", qc, sem_getcount(&qc->lock)); |
2884 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_ioctl() : %i", qc, 0); |
2885 |
if (down_interruptible(&qc->lock)) return -ERESTARTSYS; |
2885 |
if (down_interruptible(&qc->lock)) return -ERESTARTSYS; |
2886 |
if (!qc->connected) { |
2886 |
if (!qc->connected) { |
2887 |
retval = -ENODEV; |
2887 |
retval = -ENODEV; |
Lines 3452-3458
Link Here
|
3452 |
retval = -ENOIOCTLCMD; |
3452 |
retval = -ENOIOCTLCMD; |
3453 |
break; |
3453 |
break; |
3454 |
} |
3454 |
} |
3455 |
fail: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_ioctl() : %i", qc, sem_getcount(&qc->lock)); |
3455 |
fail: if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_ioctl() : %i", qc, 0); |
3456 |
up(&qc->lock); |
3456 |
up(&qc->lock); |
3457 |
if (retval<0) if (qcdebug&(QC_DEBUGLOGIC|QC_DEBUGUSER|QC_DEBUGERRORS)) PDEBUG("failed qc_v4l_ioctl()=%i",retval); |
3457 |
if (retval<0) if (qcdebug&(QC_DEBUGLOGIC|QC_DEBUGUSER|QC_DEBUGERRORS)) PDEBUG("failed qc_v4l_ioctl()=%i",retval); |
3458 |
return retval; |
3458 |
return retval; |
Lines 3547-3567
Link Here
|
3547 |
|
3547 |
|
3548 |
/* Check if there is already a suitable quickcam struct that can be reused */ |
3548 |
/* Check if there is already a suitable quickcam struct that can be reused */ |
3549 |
reuse_qc = FALSE; |
3549 |
reuse_qc = FALSE; |
3550 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list_lock) in qc_usb_init() : %i", sem_getcount(&quickcam_list_lock)); |
3550 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list_lock) in qc_usb_init() : %i", 0); |
3551 |
if (down_interruptible(&quickcam_list_lock)) return NULL; |
3551 |
if (down_interruptible(&quickcam_list_lock)) return NULL; |
3552 |
list_for_each_entry(qc, &quickcam_list, list) { |
3552 |
list_for_each_entry(qc, &quickcam_list, list) { |
3553 |
if (qc->dev != NULL) { |
3553 |
if (qc->dev != NULL) { |
3554 |
continue; /* quickcam_list_lock protects this test */ |
3554 |
continue; /* quickcam_list_lock protects this test */ |
3555 |
} |
3555 |
} |
3556 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock)); |
3556 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_usb_init() : %i",qc, 0); |
3557 |
if (down_interruptible(&qc->lock)) { |
3557 |
if (down_interruptible(&qc->lock)) { |
3558 |
/* Failed to lock the camera. Move on in the list, skipping this camera */ |
3558 |
/* Failed to lock the camera. Move on in the list, skipping this camera */ |
3559 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("failed locking the camera %p in qc_usb_init() : %i",qc,sem_getcount(&qc->lock)); |
3559 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("failed locking the camera %p in qc_usb_init() : %i",qc,0); |
3560 |
continue; |
3560 |
continue; |
3561 |
} |
3561 |
} |
3562 |
if (qc->users<=0) { |
3562 |
if (qc->users<=0) { |
3563 |
PRINTK(KERN_NOTICE, "Unplugged unused camera detected!"); |
3563 |
PRINTK(KERN_NOTICE, "Unplugged unused camera detected!"); |
3564 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock)); |
3564 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, 0); |
3565 |
up(&qc->lock); |
3565 |
up(&qc->lock); |
3566 |
continue; |
3566 |
continue; |
3567 |
} |
3567 |
} |
Lines 3662-3668
Link Here
|
3662 |
#endif |
3662 |
#endif |
3663 |
/* Register input device for button */ |
3663 |
/* Register input device for button */ |
3664 |
qc->input_ptr->name = "Quickcam snapshot button"; |
3664 |
qc->input_ptr->name = "Quickcam snapshot button"; |
3665 |
qc->input_ptr->private = qc; |
3665 |
//qc->input_ptr->private = qc; |
3666 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) |
3666 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) |
3667 |
qc->input_ptr->evbit[0] = BIT_MASK(EV_KEY); |
3667 |
qc->input_ptr->evbit[0] = BIT_MASK(EV_KEY); |
3668 |
qc->input_ptr->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); |
3668 |
qc->input_ptr->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); |
Lines 3769-3777
Link Here
|
3769 |
qc_v4l_exit(qc); |
3769 |
qc_v4l_exit(qc); |
3770 |
#endif |
3770 |
#endif |
3771 |
|
3771 |
|
3772 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock)); |
3772 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, 0); |
3773 |
up(&qc->lock); |
3773 |
up(&qc->lock); |
3774 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init() : %i", sem_getcount(&quickcam_list_lock)); |
3774 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init() : %i", 0); |
3775 |
up(&quickcam_list_lock); |
3775 |
up(&quickcam_list_lock); |
3776 |
return qc; |
3776 |
return qc; |
3777 |
|
3777 |
|
Lines 3781-3794
Link Here
|
3781 |
fail2: |
3781 |
fail2: |
3782 |
qc->dev = NULL; |
3782 |
qc->dev = NULL; |
3783 |
qc->connected = FALSE; |
3783 |
qc->connected = FALSE; |
3784 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init()=failed : %i",qc, sem_getcount(&qc->lock)); |
3784 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init()=failed : %i",qc, 0); |
3785 |
up(&qc->lock); |
3785 |
up(&qc->lock); |
3786 |
|
3786 |
|
3787 |
if (!reuse_qc) { |
3787 |
if (!reuse_qc) { |
3788 |
kfree(qc); |
3788 |
kfree(qc); |
3789 |
} |
3789 |
} |
3790 |
fail1: if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_usb_init()=%i",r); |
3790 |
fail1: if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_usb_init()=%i",r); |
3791 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init()=failed : %i", sem_getcount(&quickcam_list_lock)); |
3791 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init()=failed : %i", 0); |
3792 |
up(&quickcam_list_lock); |
3792 |
up(&quickcam_list_lock); |
3793 |
return NULL; |
3793 |
return NULL; |
3794 |
} |
3794 |
} |
Lines 4057-4065
Link Here
|
4057 |
*/ |
4057 |
*/ |
4058 |
qc->connected = FALSE; |
4058 |
qc->connected = FALSE; |
4059 |
|
4059 |
|
4060 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_usb_disconnect() : %i", sem_getcount(&quickcam_list_lock)); |
4060 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_usb_disconnect() : %i", 0); |
4061 |
down(&quickcam_list_lock); /* Also avoids race condition with open() */ |
4061 |
down(&quickcam_list_lock); /* Also avoids race condition with open() */ |
4062 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_usb_disconnect() : %i", qc, sem_getcount(&qc->lock)); |
4062 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_usb_disconnect() : %i", qc, 0); |
4063 |
down(&qc->lock); /* Can not interrupt, we must success */ |
4063 |
down(&qc->lock); /* Can not interrupt, we must success */ |
4064 |
|
4064 |
|
4065 |
if (qc->users <= 0) { |
4065 |
if (qc->users <= 0) { |
Lines 4072-4082
Link Here
|
4072 |
qc_isoc_stop(qc); /* Unlink and free isochronous URBs */ |
4072 |
qc_isoc_stop(qc); /* Unlink and free isochronous URBs */ |
4073 |
qc_int_exit(qc); |
4073 |
qc_int_exit(qc); |
4074 |
qc->dev = NULL; /* Must be set to NULL only after interrupts are guaranteed to be disabled! */ |
4074 |
qc->dev = NULL; /* Must be set to NULL only after interrupts are guaranteed to be disabled! */ |
4075 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_disconnect() : %i",qc, sem_getcount(&qc->lock)); |
4075 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_disconnect() : %i",qc, 0); |
4076 |
up(&qc->lock); |
4076 |
up(&qc->lock); |
4077 |
} |
4077 |
} |
4078 |
|
4078 |
|
4079 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_disconnect() : %i", sem_getcount(&quickcam_list_lock)); |
4079 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_disconnect() : %i", 0); |
4080 |
up(&quickcam_list_lock); |
4080 |
up(&quickcam_list_lock); |
4081 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_usb_disconnect() : %i",GET_USE_COUNT(THIS_MODULE)); |
4081 |
if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_usb_disconnect() : %i",GET_USE_COUNT(THIS_MODULE)); |
4082 |
MOD_DEC_USE_COUNT; /* Release lock--if device is not open, module can be now freed */ |
4082 |
MOD_DEC_USE_COUNT; /* Release lock--if device is not open, module can be now freed */ |