This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / media / video / meye.c
index 6f3fe23..bb6e40d 100644 (file)
@@ -203,7 +203,7 @@ static int ptable_alloc(void) {
                                          PAGE_SIZE,
                                          meye.mchip_ptable_toc,
                                          meye.mchip_dmahandle);
-                       meye.mchip_ptable_toc = NULL;
+                       meye.mchip_ptable_toc = 0;
                        meye.mchip_dmahandle = 0;
                        return -1;
                }
@@ -232,7 +232,7 @@ static void ptable_free(void) {
                                  meye.mchip_dmahandle);
 
        memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
-       meye.mchip_ptable_toc = NULL;
+       meye.mchip_ptable_toc = 0;
        meye.mchip_dmahandle = 0;
 }
 
@@ -473,6 +473,16 @@ static u16 *jpeg_huffman_tables(int *size) {
 /* MCHIP low-level functions                                                */
 /****************************************************************************/
 
+/* waits for the specified miliseconds */
+static inline void wait_ms(unsigned int ms) {
+       if (!in_interrupt()) {
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(1 + ms * HZ / 1000);
+       }
+       else
+               mdelay(ms);
+}
+
 /* returns the horizontal capture size */
 static inline int mchip_hsize(void) {
        return meye.params.subsample ? 320 : 640;
@@ -630,12 +640,12 @@ static void mchip_hic_stop(void) {
                for (j = 0; j < 100; ++j) {
                        if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
                                return;
-                       msleep(1);
+                       wait_ms(1);
                }
                printk(KERN_ERR "meye: need to reset HIC!\n");
        
                mchip_set(MCHIP_HIC_CTL, MCHIP_HIC_CTL_SOFT_RESET);
-               msleep(250);
+               wait_ms(250);
        }
        printk(KERN_ERR "meye: resetting HIC hanged!\n");
 }
@@ -731,7 +741,7 @@ static void mchip_take_picture(void) {
        for (i = 0; i < 100; ++i) {
                if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
                        break;
-               msleep(1);
+               wait_ms(1);
        }
 }
 
@@ -747,7 +757,7 @@ static void mchip_get_picture(u8 *buf, int bufsize) {
        for (i = 0; i < 100; ++i) {
                if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
                        break;
-               msleep(1);
+               wait_ms(1);
        }
        for (i = 0; i < 4 ; ++i) {
                v = mchip_get_frame();
@@ -789,7 +799,7 @@ static int mchip_compress_frame(u8 *buf, int bufsize) {
        for (i = 0; i < 100; ++i) {
                if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
                        break;
-               msleep(1);
+               wait_ms(1);
        }
 
        for (i = 0; i < 4 ; ++i) {
@@ -1250,11 +1260,11 @@ static int meye_resume(struct pci_dev *pdev)
 
        mchip_delay(MCHIP_HIC_CMD, 0);
        mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE);
-       msleep(1);
+       wait_ms(1);
        mchip_set(MCHIP_VRJ_SOFT_RESET, 1);
-       msleep(1);
+       wait_ms(1);
        mchip_set(MCHIP_MM_PCI_MODE, 5);
-       msleep(1);
+       wait_ms(1);
        mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
 
        switch (meye.pm_mchip_mode) {
@@ -1339,13 +1349,13 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
        mchip_delay(MCHIP_HIC_CMD, 0);
        mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE);
 
-       msleep(1);
+       wait_ms(1);
        mchip_set(MCHIP_VRJ_SOFT_RESET, 1);
 
-       msleep(1);
+       wait_ms(1);
        mchip_set(MCHIP_MM_PCI_MODE, 5);
 
-       msleep(1);
+       wait_ms(1);
        mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
 
        if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {