]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/ivtv/ivtv-mailbox.c
lockd: Specify address family for source address
[linux-2.6-omap-h63xx.git] / drivers / media / video / ivtv / ivtv-mailbox.c
index b05436da7136d04ec422e0c7c31d3ebd3abbefa8..1b5c0ac09a8552cb0c71db7a31fed5cb2a4124ef 100644 (file)
@@ -177,7 +177,8 @@ static int get_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int f
 
                /* Sleep before a retry, if not atomic */
                if (!(flags & API_NO_WAIT_MB)) {
-                       if (jiffies - then > msecs_to_jiffies(10*retries))
+                       if (time_after(jiffies,
+                                      then + msecs_to_jiffies(10*retries)))
                               break;
                        ivtv_msleep_timeout(10, 0);
                }
@@ -244,7 +245,9 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
           data, then just return 0 as there is no need to issue this command again.
           Just an optimization to prevent unnecessary use of mailboxes. */
        if (itv->api_cache[cmd].last_jiffies &&
-           jiffies - itv->api_cache[cmd].last_jiffies < msecs_to_jiffies(1800000) &&
+           time_before(jiffies,
+                       itv->api_cache[cmd].last_jiffies +
+                       msecs_to_jiffies(1800000)) &&
            !memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) {
                itv->api_cache[cmd].last_jiffies = jiffies;
                return 0;
@@ -299,7 +302,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
                }
        }
        while (!(readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)) {
-               if (jiffies - then > api_timeout) {
+               if (time_after(jiffies, then + api_timeout)) {
                        IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name);
                        /* reset the mailbox, but it is likely too late already */
                        write_sync(0, &mbox->flags);
@@ -311,7 +314,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
                else
                        ivtv_msleep_timeout(1, 0);
        }
-       if (jiffies - then > msecs_to_jiffies(100))
+       if (time_after(jiffies, then + msecs_to_jiffies(100)))
                IVTV_DEBUG_WARN("%s took %u jiffies\n",
                                api_info[cmd].name,
                                jiffies_to_msecs(jiffies - then));
@@ -333,7 +336,7 @@ int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[])
        return (res == -EBUSY) ? ivtv_api_call(itv, cmd, args, data) : res;
 }
 
-int ivtv_api_func(void *priv, int cmd, int in, int out, u32 data[CX2341X_MBOX_MAX_DATA])
+int ivtv_api_func(void *priv, u32 cmd, int in, int out, u32 data[CX2341X_MBOX_MAX_DATA])
 {
        return ivtv_api(priv, cmd, in, data);
 }