Re: [PATCH 15/38] drivers/infiniband: Use time_before, time_before_eq, etc.
On Tue, 25 Dec 2007, YOSHIFUJI Hideaki / µÈÆ£±ÑÌÀ wrote: > In article <[EMAIL PROTECTED]> (at Mon, 24 Dec 2007 15:28:42 +0100 (CET)), > Julia Lawall <[EMAIL PROTECTED]> says: > > > diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_mad.c > > b/drivers/infiniband/hw/ipath/ipath_mad.c > > --- a/drivers/infiniband/hw/ipath/ipath_mad.c 2007-10-22 > > 11:25:09.0 +0200 > > +++ b/drivers/infiniband/hw/ipath/ipath_mad.c 2007-12-23 > > 20:35:37.0 +0100 > > @@ -1334,7 +1334,8 @@ static int process_subn(struct ib_device > > } > > > > /* Is the mkey in the process of expiring? */ > > - if (dev->mkey_lease_timeout && jiffies >= dev->mkey_lease_timeout) { > > + if (dev->mkey_lease_timeout && > > + time_before_eq(jiffies, dev->mkey_lease_timeout)) { > > /* Clear timeout and mkey protection field. */ > > dev->mkey_lease_timeout = 0; > > dev->mkeyprot = 0; > > time_after_eq() I see that there are quite a lot of problems like this. I will have to start over... julia
Re: [PATCH 15/38] drivers/infiniband: Use time_before, time_before_eq, etc.
In article <[EMAIL PROTECTED]> (at Mon, 24 Dec 2007 15:28:42 +0100 (CET)), Julia Lawall <[EMAIL PROTECTED]> says: > diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_mad.c > b/drivers/infiniband/hw/ipath/ipath_mad.c > --- a/drivers/infiniband/hw/ipath/ipath_mad.c 2007-10-22 11:25:09.0 > +0200 > +++ b/drivers/infiniband/hw/ipath/ipath_mad.c 2007-12-23 20:35:37.0 > +0100 > @@ -1334,7 +1334,8 @@ static int process_subn(struct ib_device > } > > /* Is the mkey in the process of expiring? */ > - if (dev->mkey_lease_timeout && jiffies >= dev->mkey_lease_timeout) { > + if (dev->mkey_lease_timeout && > + time_before_eq(jiffies, dev->mkey_lease_timeout)) { > /* Clear timeout and mkey protection field. */ > dev->mkey_lease_timeout = 0; > dev->mkeyprot = 0; time_after_eq() --yoshfuji -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 15/38] drivers/infiniband: Use time_before, time_before_eq, etc.
From: Julia Lawall <[EMAIL PROTECTED]> The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. A simplified version of the semantic patch making this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ change_compare_np @ expression E; @@ ( - jiffies <= E + time_before_eq(jiffies,E) | - jiffies >= E + time_after_eq(jiffies,E) | - jiffies < E + time_before(jiffies,E) | - jiffies > E + time_after(jiffies,E) ) @ include depends on change_compare_np @ @@ #include @ no_include depends on !include && change_compare_np @ @@ #include + #include // Signed-off-by: Julia Lawall <[EMAIL PROTECTED]> --- diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c --- a/drivers/infiniband/hw/ipath/ipath_intr.c 2007-11-01 10:30:39.0 +0100 +++ b/drivers/infiniband/hw/ipath/ipath_intr.c 2007-12-23 20:30:39.0 +0100 @@ -32,6 +32,7 @@ */ #include +#include #include "ipath_kernel.h" #include "ipath_verbs.h" @@ -94,7 +95,7 @@ static void ipath_disarm_senderrbufs(str if (sbuf[0] || sbuf[1] || (piobcnt > 128 && (sbuf[2] || sbuf[3]))) { int i; if (ipath_debug & (__IPATH_PKTDBG|__IPATH_DBG) && - dd->ipath_lastcancel > jiffies) { + time_before(jiffies, dd->ipath_lastcancel)) { __IPATH_DBG_WHICH(__IPATH_PKTDBG|__IPATH_DBG, "SendbufErrs %lx %lx", sbuf[0], sbuf[1]); @@ -635,7 +636,7 @@ static int handle_errors(struct ipath_de /* likely due to cancel, so suppress */ if ((errs & (INFINIPATH_E_SPKTLEN | INFINIPATH_E_SPIOARMLAUNCH)) && - dd->ipath_lastcancel > jiffies) { + time_before(jiffies, dd->ipath_lastcancel)) { ipath_dbg("Suppressed armlaunch/spktlen after error send cancel\n"); errs &= ~(INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SPKTLEN); } diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c --- a/drivers/infiniband/hw/ipath/ipath_mad.c 2007-10-22 11:25:09.0 +0200 +++ b/drivers/infiniband/hw/ipath/ipath_mad.c 2007-12-23 20:35:37.0 +0100 @@ -1334,7 +1334,8 @@ static int process_subn(struct ib_device } /* Is the mkey in the process of expiring? */ - if (dev->mkey_lease_timeout && jiffies >= dev->mkey_lease_timeout) { + if (dev->mkey_lease_timeout && + time_before_eq(jiffies, dev->mkey_lease_timeout)) { /* Clear timeout and mkey protection field. */ dev->mkey_lease_timeout = 0; dev->mkeyprot = 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 15/38] drivers/infiniband: Use time_before, time_before_eq, etc.
From: Julia Lawall [EMAIL PROTECTED] The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. A simplified version of the semantic patch making this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @ change_compare_np @ expression E; @@ ( - jiffies = E + time_before_eq(jiffies,E) | - jiffies = E + time_after_eq(jiffies,E) | - jiffies E + time_before(jiffies,E) | - jiffies E + time_after(jiffies,E) ) @ include depends on change_compare_np @ @@ #include linux/jiffies.h @ no_include depends on !include change_compare_np @ @@ #include linux/... + #include linux/jiffies.h // /smpl Signed-off-by: Julia Lawall [EMAIL PROTECTED] --- diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c --- a/drivers/infiniband/hw/ipath/ipath_intr.c 2007-11-01 10:30:39.0 +0100 +++ b/drivers/infiniband/hw/ipath/ipath_intr.c 2007-12-23 20:30:39.0 +0100 @@ -32,6 +32,7 @@ */ #include linux/pci.h +#include linux/jiffies.h #include ipath_kernel.h #include ipath_verbs.h @@ -94,7 +95,7 @@ static void ipath_disarm_senderrbufs(str if (sbuf[0] || sbuf[1] || (piobcnt 128 (sbuf[2] || sbuf[3]))) { int i; if (ipath_debug (__IPATH_PKTDBG|__IPATH_DBG) - dd-ipath_lastcancel jiffies) { + time_before(jiffies, dd-ipath_lastcancel)) { __IPATH_DBG_WHICH(__IPATH_PKTDBG|__IPATH_DBG, SendbufErrs %lx %lx, sbuf[0], sbuf[1]); @@ -635,7 +636,7 @@ static int handle_errors(struct ipath_de /* likely due to cancel, so suppress */ if ((errs (INFINIPATH_E_SPKTLEN | INFINIPATH_E_SPIOARMLAUNCH)) - dd-ipath_lastcancel jiffies) { + time_before(jiffies, dd-ipath_lastcancel)) { ipath_dbg(Suppressed armlaunch/spktlen after error send cancel\n); errs = ~(INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SPKTLEN); } diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c --- a/drivers/infiniband/hw/ipath/ipath_mad.c 2007-10-22 11:25:09.0 +0200 +++ b/drivers/infiniband/hw/ipath/ipath_mad.c 2007-12-23 20:35:37.0 +0100 @@ -1334,7 +1334,8 @@ static int process_subn(struct ib_device } /* Is the mkey in the process of expiring? */ - if (dev-mkey_lease_timeout jiffies = dev-mkey_lease_timeout) { + if (dev-mkey_lease_timeout + time_before_eq(jiffies, dev-mkey_lease_timeout)) { /* Clear timeout and mkey protection field. */ dev-mkey_lease_timeout = 0; dev-mkeyprot = 0; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 15/38] drivers/infiniband: Use time_before, time_before_eq, etc.
In article [EMAIL PROTECTED] (at Mon, 24 Dec 2007 15:28:42 +0100 (CET)), Julia Lawall [EMAIL PROTECTED] says: diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c --- a/drivers/infiniband/hw/ipath/ipath_mad.c 2007-10-22 11:25:09.0 +0200 +++ b/drivers/infiniband/hw/ipath/ipath_mad.c 2007-12-23 20:35:37.0 +0100 @@ -1334,7 +1334,8 @@ static int process_subn(struct ib_device } /* Is the mkey in the process of expiring? */ - if (dev-mkey_lease_timeout jiffies = dev-mkey_lease_timeout) { + if (dev-mkey_lease_timeout + time_before_eq(jiffies, dev-mkey_lease_timeout)) { /* Clear timeout and mkey protection field. */ dev-mkey_lease_timeout = 0; dev-mkeyprot = 0; time_after_eq() --yoshfuji -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 15/38] drivers/infiniband: Use time_before, time_before_eq, etc.
On Tue, 25 Dec 2007, YOSHIFUJI Hideaki / µÈÆ£±ÑÌÀ wrote: In article [EMAIL PROTECTED] (at Mon, 24 Dec 2007 15:28:42 +0100 (CET)), Julia Lawall [EMAIL PROTECTED] says: diff -r -u -p a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c --- a/drivers/infiniband/hw/ipath/ipath_mad.c 2007-10-22 11:25:09.0 +0200 +++ b/drivers/infiniband/hw/ipath/ipath_mad.c 2007-12-23 20:35:37.0 +0100 @@ -1334,7 +1334,8 @@ static int process_subn(struct ib_device } /* Is the mkey in the process of expiring? */ - if (dev-mkey_lease_timeout jiffies = dev-mkey_lease_timeout) { + if (dev-mkey_lease_timeout + time_before_eq(jiffies, dev-mkey_lease_timeout)) { /* Clear timeout and mkey protection field. */ dev-mkey_lease_timeout = 0; dev-mkeyprot = 0; time_after_eq() I see that there are quite a lot of problems like this. I will have to start over... julia