| From: Chris Kennedy <[EMAIL PROTECTED]>

| On Tue, Feb 22, 2005 at 06:50:52PM -0500, D. Hugh Redelmeier wrote:

| > Thanks for accepting my patch to Unstable to support 64-bit machines.
| > 
| > Is there a reason that you rejected the parallel changes to Stable?

| It just didn't apply from what I remember, just not enough time to 
| go into too much exploration when things don't apply.

I have enclosed a patch against ivtv-0.2.0-rc3g.  I have not tested
it, but it does compile cleanly except for these messages:

/home/hugh/tba/ivtv/ivtv-0.2.0-rc3g/driver/msp3400.c:838: warning: 
`interruptible_sleep_on' is deprecated (declared at include/linux/wait.h:310)
/home/hugh/tba/ivtv/ivtv-0.2.0-rc3g/driver/msp3400.c:1125: warning: 
`interruptible_sleep_on' is deprecated (declared at include/linux/wait.h:310)
/home/hugh/tba/ivtv/ivtv-0.2.0-rc3g/driver/ivtv-ioctl.c:986: warning: 
`interruptible_sleep_on' is deprecated (declared at include/linux/wait.h:310)

===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-dma.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-dma.c
--- ivtv-0.2.0-rc3g/driver/ivtv-dma.c   2005/02/23 22:47:33     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-dma.c   2005/02/23 22:48:20
@@ -101,7 +101,7 @@
 {
         DECLARE_WAITQUEUE(wait, current);
         int rc = 0;
-        u32 then;
+        unsigned long then;
 
         then = jiffies;
         add_wait_queue(&itv->streams[type].waitq, &wait);
===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-driver.h,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-driver.h
--- ivtv-0.2.0-rc3g/driver/ivtv-driver.h        2005/02/23 22:52:34     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-driver.h        2005/02/23 22:53:00
@@ -806,7 +806,7 @@
 
 struct api_cmd {
         int marked;  /* is this used */
-        u64 jiffies; /* last command issued */
+        unsigned long jiffies; /* last command issued */
 
         u32 s_data[IVTV_MBOX_MAX_DATA]; /* send api data */
         u32 r_data[IVTV_MBOX_MAX_DATA]; /* returned api data */
===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-fileops.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-fileops.c
--- ivtv-0.2.0-rc3g/driver/ivtv-fileops.c       2005/02/23 22:47:33     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-fileops.c       2005/02/23 22:48:20
@@ -270,7 +270,8 @@
        DECLARE_WAITQUEUE(wait, current);
        int idx = itv->vbi_inserted_frame % 20;
        int blocking = !(filp->f_flags & O_NONBLOCK);
-       u32 old_trans_id, then;
+       u32 old_trans_id;
+       unsigned long then;
         u32 bytes_received = 0;
         LIST_HEAD(full_list);
 
===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-irq.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-irq.c
--- ivtv-0.2.0-rc3g/driver/ivtv-irq.c   2005/02/23 22:47:33     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-irq.c   2005/02/23 23:05:27
@@ -414,7 +414,7 @@
         struct ivtv_buffer *buf;
         LIST_HEAD(free_list);
        int xfer_pad;
-       u32 then;
+       unsigned long then;
        int redo_dma = 0;
        DECLARE_WAITQUEUE(wait, current);
        int rc = 0;
@@ -494,7 +494,6 @@
        if (type == 1)
                bytes_needed += (UVsize%itv->dma_cfg.enc_yuv_buf_size) + 
(size%itv->dma_cfg.enc_yuv_buf_size);
 
-        then = jiffies;
         add_wait_queue(&st->waitq, &wait);
         do {
                 set_current_state(TASK_INTERRUPTIBLE);
===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-kthreads.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-kthreads.c
--- ivtv-0.2.0-rc3g/driver/ivtv-kthreads.c      2005/02/23 22:47:33     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-kthreads.c      2005/02/23 22:55:37
@@ -373,7 +373,7 @@
         int type = IVTV_DEC_STREAM_TYPE_MPG;
         struct ivtv_stream *stream= &itv->streams[type];
        int ret = -1;
-       unsigned long then = 0; 
+       unsigned long then;
        int rc = 0;
         int x=0, bytes_written=0;
         struct ivtv_buffer *buf;
@@ -420,6 +420,8 @@
        ret = ivtv_api_getresult_nosleep(&itv->dec_mbox[9], 
                &result, &data[0]);
 
+               then = jiffies;
+
        /* Did xfer status fail? */
                if (ret) {
                        IVTV_DEBUG(IVTV_DEBUG_ERR,
@@ -431,7 +433,6 @@
 
        data[2] = ivtv_round_dma(data[2]);
 
-               then = jiffies;
                add_wait_queue(&stream->waitq, &wait);
                do {
                        set_current_state(TASK_INTERRUPTIBLE);
===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-osd.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-osd.c
--- ivtv-0.2.0-rc3g/driver/ivtv-osd.c   2005/02/23 22:47:33     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-osd.c   2005/02/23 22:56:43
@@ -773,7 +773,7 @@
                &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
        u32 data[IVTV_MBOX_MAX_DATA];
        int ret = 0;
-       u32 then;
+       unsigned long then;
        int redo_dma = 0;
        unsigned long flags;
 
@@ -945,7 +945,7 @@
        int rc = 0;
        struct ivtv_stream *stream = /* Use Decoder Stream for locking */
                &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
-       u32 then;
+       unsigned long then;
        DECLARE_WAITQUEUE(wait, current);
 
 
@@ -1154,10 +1154,10 @@
            if (ret) {
                 if (ret != -ERESTARTSYS) {
                    IVTV_DEBUG(IVTV_DEBUG_ERR,
-                            "OSD: DMA xfer from 0x%08x of "
+                            "OSD: DMA xfer from %p of "
                             "%d bytes "
                             "failed with (%d) offset = 0x%08lx, total %d\n",
-                            (u32)args.source, args.count, ret,
+                            args.source, args.count, ret,
                             args.dest_offset,
                             (args.count + (unsigned int)args.dest_offset));
                 } else {
===================================================================
RCS file: ivtv-0.2.0-rc3g/driver/RCS/ivtv-streams.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-0.2.0-rc3g/driver/ivtv-streams.c
--- ivtv-0.2.0-rc3g/driver/ivtv-streams.c       2005/02/23 22:47:33     1.1
+++ ivtv-0.2.0-rc3g/driver/ivtv-streams.c       2005/02/23 22:50:58
@@ -993,7 +993,8 @@
 int ivtv_stop_capture(struct ivtv *itv, int type)
 {
        struct ivtv_stream *st = &itv->streams[type];
-       int cap_type, then;
+       int cap_type;
+       unsigned long then;
        int x;
        int stopmode;
        u32 data[IVTV_MBOX_MAX_DATA], result;
@@ -1065,9 +1066,11 @@
        up(&st->mlock);
 
        if (!test_bit(IVTV_F_S_NO_DMA, &st->s_flags)) {
-                then = jiffies;
                 if ((type == IVTV_ENC_STREAM_TYPE_MPG) && itv->end_gop == 1) {
                         /* only run these if we're shutting down the last cap 
*/
+                        unsigned long duration;
+
+                        then = jiffies;
                         add_wait_queue(&itv->cap_w, &wait);
 
                         set_current_state(TASK_INTERRUPTIBLE);
@@ -1079,20 +1082,28 @@
                         {
                                 schedule_timeout(HZ/100);
                         }
-                        then = jiffies - then;
+
+                        /* To convert jiffies to ms, we must multiply by 1000
+                         * and divide by HZ.  To avoid runtime division, we
+                         * convert this to multiplication by 1000/HZ.
+                         * Since integer division truncates, we get the best
+                         * accuracy if we do a rounding calculation of the 
constant.
+                         * Think of the case where HZ is 1024.
+                         */
+                        duration = ((1000 + HZ/2) / HZ) * (jiffies - then);
 
                         if (!test_bit(IVTV_F_I_EOS, &itv->i_flags)) {
                                 IVTV_DEBUG(IVTV_DEBUG_ERR,
                                         "ENC: EOS interrupt not "
                                         "received! stopping anyway.\n");
                                 IVTV_DEBUG(IVTV_DEBUG_ERR,
-                                        "ENC: waited %d ms.\n",
-                                        (1000/HZ)*then);
+                                        "ENC: waited %lu ms.\n",
+                                        duration);
                         } else {
                                 IVTV_DEBUG(IVTV_DEBUG_ERR,
-                                        "ENC: EOS took %d "
+                                        "ENC: EOS took %lu "
                                         "ms to occur.\n",
-                                        (1000/HZ)*then);
+                                        duration);
                         }
                         set_current_state(TASK_RUNNING);
                         remove_wait_queue(&itv->cap_w, &wait);
@@ -1169,7 +1180,7 @@
 static void ivtv_stop_wait(struct ivtv *itv, int type) {
         DECLARE_WAITQUEUE(wait, current);
         int rc = 0;
-        u32 then;
+        unsigned long then;
 
         then = jiffies;
         add_wait_queue(&itv->streams[type].waitq, &wait);
================================================================


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
ivtv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ivtv-devel

Reply via email to