Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 232700 | Differences between
and this patch

Collapse All | Expand All

(-)qc-usb-messenger-1.7-orig/qc-driver.c (-32 / +32 lines)
Lines 1612-1618 Link Here
1612
	fd->maxrawdatalen = 0;		/* Hopefully stops all ongoing captures, might need locking though */
1612
	fd->maxrawdatalen = 0;		/* Hopefully stops all ongoing captures, might need locking though */
1613
	wake_up(&fd->wq);
1613
	wake_up(&fd->wq);
1614
	if (qcdebug&QC_DEBUGFRAME) PDEBUG("waiting=%i",fd->waiting);
1614
	if (qcdebug&QC_DEBUGFRAME) PDEBUG("waiting=%i",fd->waiting);
1615
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_exit() : %i", qc, sem_getcount(&qc->lock));
1615
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_exit() : %i", qc, 0);
1616
	up(&qc->lock);			/* The lock was down when entering this function */
1616
	up(&qc->lock);			/* The lock was down when entering this function */
1617
	while (fd->waiting > 0) {
1617
	while (fd->waiting > 0) {
1618
		schedule();
1618
		schedule();
Lines 1623-1629 Link Here
1623
		}
1623
		}
1624
#endif
1624
#endif
1625
	}
1625
	}
1626
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_exit() : %i", qc, sem_getcount(&qc->lock));
1626
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_exit() : %i", qc, 0);
1627
	down(&qc->lock);
1627
	down(&qc->lock);
1628
	vfree(fd->rawdatabuf);
1628
	vfree(fd->rawdatabuf);
1629
	POISON(fd->rawdatabuf);
1629
	POISON(fd->rawdatabuf);
Lines 1652-1665 Link Here
1652
	/* Wait until the next frame is available */
1652
	/* Wait until the next frame is available */
1653
	if (qcdebug&QC_DEBUGFRAME) PDEBUG("qc_frame_get/consume(qc=%p,tail=%i,head=%i)",qc,fd->tail,fd->head);
1653
	if (qcdebug&QC_DEBUGFRAME) PDEBUG("qc_frame_get/consume(qc=%p,tail=%i,head=%i)",qc,fd->tail,fd->head);
1654
	fd->waiting++;
1654
	fd->waiting++;
1655
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_get() : %i", qc, sem_getcount(&qc->lock));
1655
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_get() : %i", qc, 0);
1656
	up(&qc->lock);					/* Release lock while waiting */
1656
	up(&qc->lock);					/* Release lock while waiting */
1657
1657
1658
	ret = wait_event_interruptible(fd->wq, fd->head!=fd->tail || fd->exiting);	//FIXME:What if we get -ERESTARTSYS?
1658
	ret = wait_event_interruptible(fd->wq, fd->head!=fd->tail || fd->exiting);	//FIXME:What if we get -ERESTARTSYS?
1659
	if(ret == -ERESTARTSYS) {
1659
	if(ret == -ERESTARTSYS) {
1660
	  PDEBUG("wait_event_interruptible() returned ERESTARTSYS");
1660
	  PDEBUG("wait_event_interruptible() returned ERESTARTSYS");
1661
	}
1661
	}
1662
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_get() : %i", qc, sem_getcount(&qc->lock));
1662
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_get() : %i", qc, 0);
1663
	down(&qc->lock);
1663
	down(&qc->lock);
1664
	if (!ret) {
1664
	if (!ret) {
1665
		if (!fd->exiting) {
1665
		if (!fd->exiting) {
Lines 2681-2692 Link Here
2681
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_INC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE));
2681
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_INC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE));
2682
	MOD_INC_USE_COUNT;
2682
	MOD_INC_USE_COUNT;
2683
2683
2684
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list) in qc_v4l_open() : %i", sem_getcount(&quickcam_list_lock));
2684
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list) in qc_v4l_open() : %i", 0);
2685
2685
2686
	r = qc_lock(qc);
2686
	r = qc_lock(qc);
2687
	if (r<0) goto fail1;
2687
	if (r<0) goto fail1;
2688
2688
2689
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_open() : %i", qc, sem_getcount(&qc->lock));
2689
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_open() : %i", qc, 0);
2690
	if (down_interruptible(&qc->lock)) {
2690
	if (down_interruptible(&qc->lock)) {
2691
		r = -ERESTARTSYS;
2691
		r = -ERESTARTSYS;
2692
		goto fail2;
2692
		goto fail2;
Lines 2701-2715 Link Here
2701
		if (qcdebug&QC_DEBUGLOGIC) PDEBUG("First user, initializing");
2701
		if (qcdebug&QC_DEBUGLOGIC) PDEBUG("First user, initializing");
2702
		if ((r = qc_v4l_init(qc))<0) goto fail4;
2702
		if ((r = qc_v4l_init(qc))<0) goto fail4;
2703
	}
2703
	}
2704
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open() : %i",qc, sem_getcount(&qc->lock));
2704
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open() : %i",qc, 0);
2705
	up(&qc->lock);
2705
	up(&qc->lock);
2706
	up(&quickcam_list_lock);
2706
	up(&quickcam_list_lock);
2707
	return 0;
2707
	return 0;
2708
2708
2709
fail4:	qc->users--;
2709
fail4:	qc->users--;
2710
fail3:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open()=failed : %i",qc, sem_getcount(&qc->lock));
2710
fail3:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open()=failed : %i",qc, 0);
2711
	up(&qc->lock);
2711
	up(&qc->lock);
2712
fail2:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_open()=failed : %i", sem_getcount(&qc->lock));
2712
fail2:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_open()=failed : %i", 0);
2713
	up(&quickcam_list_lock);
2713
	up(&quickcam_list_lock);
2714
fail1:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE));
2714
fail1:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE));
2715
	MOD_DEC_USE_COUNT;
2715
	MOD_DEC_USE_COUNT;
Lines 2743-2751 Link Here
2743
#else
2743
#else
2744
	TEST_BUG_MSG(qc==NULL, "qc==NULL");
2744
	TEST_BUG_MSG(qc==NULL, "qc==NULL");
2745
#endif
2745
#endif
2746
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_v4l_close() : %i", sem_getcount(&quickcam_list_lock));
2746
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_v4l_close() : %i", 0);
2747
	down(&quickcam_list_lock);	/* Can not interrupt, we must success */
2747
	down(&quickcam_list_lock);	/* Can not interrupt, we must success */
2748
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_v4l_close() : %i", qc, sem_getcount(&qc->lock));
2748
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_v4l_close() : %i", qc, 0);
2749
	down(&qc->lock);		/* Can not interrupt, we must success */
2749
	down(&qc->lock);		/* Can not interrupt, we must success */
2750
	qc->users--;
2750
	qc->users--;
2751
	PDEBUG("close users=%i", qc->users);
2751
	PDEBUG("close users=%i", qc->users);
Lines 2760-2769 Link Here
2760
		}
2760
		}
2761
	}
2761
	}
2762
	if (qc) {
2762
	if (qc) {
2763
		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_close() : %i", qc, sem_getcount(&qc->lock));
2763
		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_close() : %i", qc, 0);
2764
		up(&qc->lock);
2764
		up(&qc->lock);
2765
	}
2765
	}
2766
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_close() : %i", sem_getcount(&quickcam_list_lock));
2766
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_close() : %i", 0);
2767
	up(&quickcam_list_lock);
2767
	up(&quickcam_list_lock);
2768
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_close() : %i", GET_USE_COUNT(THIS_MODULE));
2768
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_close() : %i", GET_USE_COUNT(THIS_MODULE));
2769
	MOD_DEC_USE_COUNT;
2769
	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
	qc->input_ptr->evbit[0] = BIT(EV_KEY);
3666
	qc->input_ptr->evbit[0] = BIT(EV_KEY);
3667
	qc->input_ptr->keybit[(BTN_0)/BITS_PER_LONG] = BIT(BTN_0);
3667
	qc->input_ptr->keybit[(BTN_0)/BITS_PER_LONG] = BIT(BTN_0);
3668
3668
Lines 3764-3772 Link Here
3764
	qc_v4l_exit(qc);
3764
	qc_v4l_exit(qc);
3765
#endif
3765
#endif
3766
3766
3767
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock));
3767
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, 0);
3768
	up(&qc->lock);
3768
	up(&qc->lock);
3769
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init() : %i", sem_getcount(&quickcam_list_lock));
3769
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init() : %i", 0);
3770
	up(&quickcam_list_lock);
3770
	up(&quickcam_list_lock);
3771
	return qc;
3771
	return qc;
3772
3772
Lines 3776-3789 Link Here
3776
fail2:	
3776
fail2:	
3777
	qc->dev = NULL;
3777
	qc->dev = NULL;
3778
	qc->connected = FALSE;
3778
	qc->connected = FALSE;
3779
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init()=failed : %i",qc, sem_getcount(&qc->lock));
3779
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init()=failed : %i",qc, 0);
3780
	up(&qc->lock);
3780
	up(&qc->lock);
3781
3781
3782
	if (!reuse_qc) {
3782
	if (!reuse_qc) {
3783
	  kfree(qc);
3783
	  kfree(qc);
3784
	}
3784
	}
3785
fail1:	if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_usb_init()=%i",r);
3785
fail1:	if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_usb_init()=%i",r);
3786
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init()=failed : %i", sem_getcount(&quickcam_list_lock));
3786
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init()=failed : %i", 0);
3787
	up(&quickcam_list_lock);
3787
	up(&quickcam_list_lock);
3788
	return NULL;
3788
	return NULL;
3789
}
3789
}
Lines 4052-4060 Link Here
4052
	 */
4052
	 */
4053
	qc->connected = FALSE;
4053
	qc->connected = FALSE;
4054
4054
4055
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_usb_disconnect() : %i", sem_getcount(&quickcam_list_lock));
4055
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_usb_disconnect() : %i", 0);
4056
	down(&quickcam_list_lock);		/* Also avoids race condition with open() */
4056
	down(&quickcam_list_lock);		/* Also avoids race condition with open() */
4057
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_usb_disconnect() : %i", qc, sem_getcount(&qc->lock));
4057
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_usb_disconnect() : %i", qc, 0);
4058
	down(&qc->lock);			/* Can not interrupt, we must success */
4058
	down(&qc->lock);			/* Can not interrupt, we must success */
4059
4059
4060
	if (qc->users <= 0) {
4060
	if (qc->users <= 0) {
Lines 4067-4077 Link Here
4067
		qc_isoc_stop(qc);		/* Unlink and free isochronous URBs */
4067
		qc_isoc_stop(qc);		/* Unlink and free isochronous URBs */
4068
		qc_int_exit(qc);
4068
		qc_int_exit(qc);
4069
		qc->dev = NULL;			/* Must be set to NULL only after interrupts are guaranteed to be disabled! */
4069
		qc->dev = NULL;			/* Must be set to NULL only after interrupts are guaranteed to be disabled! */
4070
		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_disconnect() : %i",qc, sem_getcount(&qc->lock));
4070
		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_disconnect() : %i",qc, 0);
4071
		up(&qc->lock);
4071
		up(&qc->lock);
4072
	}
4072
	}
4073
4073
4074
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_disconnect() : %i", sem_getcount(&quickcam_list_lock));
4074
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_disconnect() : %i", 0);
4075
	up(&quickcam_list_lock);
4075
	up(&quickcam_list_lock);
4076
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_usb_disconnect() : %i",GET_USE_COUNT(THIS_MODULE));
4076
	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_usb_disconnect() : %i",GET_USE_COUNT(THIS_MODULE));
4077
	MOD_DEC_USE_COUNT;	/* Release lock--if device is not open, module can be now freed */
4077
	MOD_DEC_USE_COUNT;	/* Release lock--if device is not open, module can be now freed */
(-)qc-usb-messenger-1.7-orig/qc-memory.c (+4 lines)
Lines 204-210 Link Here
204
	memset(mem, 0, size); /* Clear the ram out, no junk to the user */
204
	memset(mem, 0, size); /* Clear the ram out, no junk to the user */
205
	adr = (unsigned long) mem;
205
	adr = (unsigned long) mem;
206
	while ((long)size > 0) {
206
	while ((long)size > 0) {
207
#ifndef SETPAGEFLAG
207
		SetPageReserved(vmalloc_to_page((void *)adr));
208
		SetPageReserved(vmalloc_to_page((void *)adr));
209
#endif
208
		adr += PAGE_SIZE;
210
		adr += PAGE_SIZE;
209
		size -= PAGE_SIZE;
211
		size -= PAGE_SIZE;
210
	}
212
	}
Lines 222-228 Link Here
222
224
223
	adr = (unsigned long) mem;
225
	adr = (unsigned long) mem;
224
	while ((long) size > 0) {
226
	while ((long) size > 0) {
227
#ifndef SETPAGEFLAG
225
		ClearPageReserved(vmalloc_to_page((void *)adr));
228
		ClearPageReserved(vmalloc_to_page((void *)adr));
229
#endif
226
		adr += PAGE_SIZE;
230
		adr += PAGE_SIZE;
227
		size -= PAGE_SIZE;
231
		size -= PAGE_SIZE;
228
	}
232
	}

Return to bug 232700