mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 15:58:47 +00:00
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>
This commit is contained in:
parent
b48d58f55a
commit
9990b6f32b
@ -65,6 +65,7 @@
|
|||||||
#include <linux/libata.h>
|
#include <linux/libata.h>
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#include <linux/cdrom.h>
|
#include <linux/cdrom.h>
|
||||||
|
#include <linux/ratelimit.h>
|
||||||
|
|
||||||
#include "libata.h"
|
#include "libata.h"
|
||||||
|
|
||||||
@ -6706,25 +6707,11 @@ static void __exit ata_exit(void)
|
|||||||
subsys_initcall(ata_init);
|
subsys_initcall(ata_init);
|
||||||
module_exit(ata_exit);
|
module_exit(ata_exit);
|
||||||
|
|
||||||
static unsigned long ratelimit_time;
|
static DEFINE_RATELIMIT_STATE(ratelimit, HZ / 5, 1);
|
||||||
static DEFINE_SPINLOCK(ata_ratelimit_lock);
|
|
||||||
|
|
||||||
int ata_ratelimit(void)
|
int ata_ratelimit(void)
|
||||||
{
|
{
|
||||||
int rc;
|
return __ratelimit(&ratelimit);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user