diff mbox

eliminate the usage of printk_ratelimit

Message ID 1292408294-30584-2-git-send-email-gong.chen@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chen Gong Dec. 15, 2010, 10:18 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 51905d0..29d38ad 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -180,13 +180,15 @@  static int ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len,
 static int ghes_read_estatus(struct ghes *ghes, int silent)
 {
 	struct acpi_hest_generic *g = ghes->generic;
+	/* Not more than 2 messages every 5 seconds */
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5*HZ, 2);
 	u64 buf_paddr;
 	u32 len;
 	int rc;
 
 	rc = acpi_atomic_read(&buf_paddr, &g->error_status_address);
 	if (rc) {
-		if (!silent && printk_ratelimit())
+		if (!silent && __ratelimit(&ratelimit))
 			pr_warning(FW_WARN GHES_PFX
 "Failed to read error status block address for hardware error source: %d.\n",
 				   g->header.source_id);