aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2010-04-12 08:11:41 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-14 17:08:02 -0400
commit9990b6f32b5d35e76b4c2a0dd9469f96350c4d9d (patch)
treed2fa24d5218f4212768091f88d4517d5edb72911 /drivers/ata/libata-core.c
parentb48d58f55aa1d2d0d12378e45663842d4021916e (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.c19
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)
6706subsys_initcall(ata_init); 6707subsys_initcall(ata_init);
6707module_exit(ata_exit); 6708module_exit(ata_exit);
6708 6709
6709static unsigned long ratelimit_time; 6710static DEFINE_RATELIMIT_STATE(ratelimit, HZ / 5, 1);
6710static DEFINE_SPINLOCK(ata_ratelimit_lock);
6711 6711
6712int ata_ratelimit(void) 6712int 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/**