From 9990b6f32b5d35e76b4c2a0dd9469f96350c4d9d Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Mon, 12 Apr 2010 21:11:41 +0900 Subject: [PATCH] libata: use __ratelimit Use __ratelimit() instead of its own private rate limit implementation. Signed-off-by: Akinobu Mita Cc: Jeff Garzik Cc: linux-ide@vger.kernel.org Signed-off-by: Jeff Garzik --- drivers/ata/libata-core.c | 19 +++---------------- 1 file 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 @@ #include #include #include +#include #include "libata.h" @@ -6706,25 +6707,11 @@ static void __exit ata_exit(void) subsys_initcall(ata_init); module_exit(ata_exit); -static unsigned long ratelimit_time; -static DEFINE_SPINLOCK(ata_ratelimit_lock); +static DEFINE_RATELIMIT_STATE(ratelimit, HZ / 5, 1); int ata_ratelimit(void) { - int rc; - unsigned long flags; - - spin_lock_irqsave(&ata_ratelimit_lock, flags); - - if (time_after(jiffies, ratelimit_time)) { - rc = 1; - ratelimit_time = jiffies + (HZ/5); - } else - rc = 0; - - spin_unlock_irqrestore(&ata_ratelimit_lock, flags); - - return rc; + return __ratelimit(&ratelimit); } /** -- 2.20.1