aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-05 02:58:32 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-05 02:58:32 -0400
commit67846b30171cc4d706125f630193a76a26bb334a (patch)
tree5ba70c2b68086f471686eb1e56e38436eaf73416 /drivers/scsi/libata-core.c
parent643736a58d2668af94aee05670c5e9ae76e7b85f (diff)
libata: add ata_ratelimit(), use it in AHCI driver irq handler
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index f0894bfa908b..ceffaef37d17 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -48,6 +48,7 @@
48#include <linux/completion.h> 48#include <linux/completion.h>
49#include <linux/suspend.h> 49#include <linux/suspend.h>
50#include <linux/workqueue.h> 50#include <linux/workqueue.h>
51#include <linux/jiffies.h>
51#include <scsi/scsi.h> 52#include <scsi/scsi.h>
52#include "scsi.h" 53#include "scsi.h"
53#include "scsi_priv.h" 54#include "scsi_priv.h"
@@ -4688,6 +4689,27 @@ static void __exit ata_exit(void)
4688module_init(ata_init); 4689module_init(ata_init);
4689module_exit(ata_exit); 4690module_exit(ata_exit);
4690 4691
4692static unsigned long ratelimit_time;
4693static spinlock_t ata_ratelimit_lock = SPIN_LOCK_UNLOCKED;
4694
4695int ata_ratelimit(void)
4696{
4697 int rc;
4698 unsigned long flags;
4699
4700 spin_lock_irqsave(&ata_ratelimit_lock, flags);
4701
4702 if (time_after(jiffies, ratelimit_time)) {
4703 rc = 1;
4704 ratelimit_time = jiffies + (HZ/5);
4705 } else
4706 rc = 0;
4707
4708 spin_unlock_irqrestore(&ata_ratelimit_lock, flags);
4709
4710 return rc;
4711}
4712
4691/* 4713/*
4692 * libata is essentially a library of internal helper functions for 4714 * libata is essentially a library of internal helper functions for
4693 * low-level ATA host controller drivers. As such, the API/ABI is 4715 * low-level ATA host controller drivers. As such, the API/ABI is
@@ -4729,6 +4751,7 @@ EXPORT_SYMBOL_GPL(sata_phy_reset);
4729EXPORT_SYMBOL_GPL(__sata_phy_reset); 4751EXPORT_SYMBOL_GPL(__sata_phy_reset);
4730EXPORT_SYMBOL_GPL(ata_bus_reset); 4752EXPORT_SYMBOL_GPL(ata_bus_reset);
4731EXPORT_SYMBOL_GPL(ata_port_disable); 4753EXPORT_SYMBOL_GPL(ata_port_disable);
4754EXPORT_SYMBOL_GPL(ata_ratelimit);
4732EXPORT_SYMBOL_GPL(ata_scsi_ioctl); 4755EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
4733EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 4756EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
4734EXPORT_SYMBOL_GPL(ata_scsi_error); 4757EXPORT_SYMBOL_GPL(ata_scsi_error);