diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2010-04-12 08:11:41 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-05-14 17:08:02 -0400 |
commit | 9990b6f32b5d35e76b4c2a0dd9469f96350c4d9d (patch) | |
tree | d2fa24d5218f4212768091f88d4517d5edb72911 /drivers/ata/libata-core.c | |
parent | b48d58f55aa1d2d0d12378e45663842d4021916e (diff) |
libata: use __ratelimit
Use __ratelimit() instead of its own private rate limit implementation.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 134b5df80ace..86f405b4831c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <linux/libata.h> | 65 | #include <linux/libata.h> |
66 | #include <asm/byteorder.h> | 66 | #include <asm/byteorder.h> |
67 | #include <linux/cdrom.h> | 67 | #include <linux/cdrom.h> |
68 | #include <linux/ratelimit.h> | ||
68 | 69 | ||
69 | #include "libata.h" | 70 | #include "libata.h" |
70 | 71 | ||
@@ -6706,25 +6707,11 @@ static void __exit ata_exit(void) | |||
6706 | subsys_initcall(ata_init); | 6707 | subsys_initcall(ata_init); |
6707 | module_exit(ata_exit); | 6708 | module_exit(ata_exit); |
6708 | 6709 | ||
6709 | static unsigned long ratelimit_time; | 6710 | static DEFINE_RATELIMIT_STATE(ratelimit, HZ / 5, 1); |
6710 | static DEFINE_SPINLOCK(ata_ratelimit_lock); | ||
6711 | 6711 | ||
6712 | int ata_ratelimit(void) | 6712 | int ata_ratelimit(void) |
6713 | { | 6713 | { |
6714 | int rc; | 6714 | return __ratelimit(&ratelimit); |
6715 | unsigned long flags; | ||
6716 | |||
6717 | spin_lock_irqsave(&ata_ratelimit_lock, flags); | ||
6718 | |||
6719 | if (time_after(jiffies, ratelimit_time)) { | ||
6720 | rc = 1; | ||
6721 | ratelimit_time = jiffies + (HZ/5); | ||
6722 | } else | ||
6723 | rc = 0; | ||
6724 | |||
6725 | spin_unlock_irqrestore(&ata_ratelimit_lock, flags); | ||
6726 | |||
6727 | return rc; | ||
6728 | } | 6715 | } |
6729 | 6716 | ||
6730 | /** | 6717 | /** |