From: Domen Puncer <domen@coderock.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] drivers/scsi/u14-34f.c : Use of the time_before()
Date: Mon, 18 Jul 2005 16:48:50 +0000 [thread overview]
Message-ID: <20050718164850.GF2457@homer.coderock.org> (raw)
In-Reply-To: <42D8B640.4030705@feitoza.com.br>
[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]
On 16/07/05 04:24 -0300, Marcelo Feitoza Parisi wrote:
> Use of the time_before() macro, defined at linux/jiffies.h, which deal
> with wrapping correctly and are nicer to read.
>
> Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
>
> --- linux/drivers/scsi/u14-34f.c 2005-07-13 17:52:25.000000000 -0300
> +++ linux-kj/drivers/scsi/u14-34f.c 2005-07-16 01:11:52.217178840 -0300
> @@ -421,6 +421,7 @@
> #include <linux/init.h>
> #include <linux/ctype.h>
> #include <linux/spinlock.h>
> +#include <linux/jiffies.h>
> #include <asm/dma.h>
> #include <asm/irq.h>
>
> @@ -746,7 +747,8 @@
> static int board_inquiry(unsigned int j) {
> struct mscp *cpp;
> dma_addr_t id_dma_addr;
> - unsigned int time, limit = 0;
> + unsigned int limit = 0;
> + unsigned long time;
>
> id_dma_addr = pci_map_single(HD(j)->pdev, HD(j)->board_id,
> sizeof(HD(j)->board_id), PCI_DMA_BIDIRECTIONAL);
> @@ -779,7 +781,7 @@
>
> spin_unlock_irq(&driver_lock);
> time = jiffies;
> - while ((jiffies - time) < HZ && limit++ < 20000) udelay(100L);
> + while (time_before(jiffies, time + HZ) && limit++ < 20000) udelay(100L);
This looks similar, hehe. I wonder how many times it got copy
pasted.
ssleep() should be better.
> - while ((jiffies - time) < (10 * HZ) && limit++ < 200000) udelay(100L);
> + while (time_before(jiffies, time + (10 * HZ))
> + && limit++ < 200000) udelay(100L);
Ditto.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
prev parent reply other threads:[~2005-07-18 16:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-16 7:24 [KJ] [PATCH] drivers/scsi/u14-34f.c : Use of the time_before() macro Marcelo Feitoza Parisi
2005-07-18 16:48 ` Domen Puncer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050718164850.GF2457@homer.coderock.org \
--to=domen@coderock.org \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.