PCI: pcie, aer: remove spinlock in aerdrv_errprint.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, September 16, 2009 - 8:00 am

Gitweb:     http://git.kernel.org/linus/24dbb7beb2a207f423006c46830dfaacca5a1139
Commit:     24dbb7beb2a207f423006c46830dfaacca5a1139
Parent:     0d465f23502e0810443c90a9cf1cf5686c4af4f2
Author:     Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
AuthorDate: Mon Sep 7 17:11:29 2009 +0900
Committer:  Jesse Barnes <jbarnes@virtuousgeek.org>
CommitDate: Wed Sep 9 13:48:19 2009 -0700

    PCI: pcie, aer: remove spinlock in aerdrv_errprint.c
    
    The static buffer errmsg_buff[] is used only for building error
    message in fixed format, and is protected by a spinlock.
    
    This patch removes this buffer and the spinlock.
    
    Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
    Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
    Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/pci/pcie/aer/aerdrv_errprint.c |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index a2a4b39..95c3f1c 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
@@ -152,38 +152,31 @@ static char *aer_agent_string[] = {
 	"Transmitter ID"
 };
 
-static char *aer_get_error_source_name(int severity,
-			unsigned int status,
-			char errmsg_buff[])
+static void aer_print_error_source(struct aer_err_info *info)
 {
 	int i;
 	char *errmsg = NULL;
 
 	for (i = 0; i < 32; i++) {
-		if (!(status & (1 << i)))
+		if (!(info->status & (1 << i)))
 			continue;
 
-		if (severity == AER_CORRECTABLE)
+		if (info->severity == AER_CORRECTABLE)
 			errmsg = aer_correctable_error_string[i];
 		else
 			errmsg = aer_uncorrectable_error_string[i];
 
-		if (!errmsg) {
-			sprintf(errmsg_buff, "Unknown Error Bit %2d  ", i);
-			errmsg = errmsg_buff;
-		}
+		if (errmsg)
+			AER_PR(info, "%s\t:\n", errmsg);
+		else
+			AER_PR(info, "Unknown Error Bit %2d  \t:\n", i);
 
 		break;
 	}
-
-	return errmsg;
 }
 
-static DEFINE_SPINLOCK(logbuf_lock);
-static char errmsg_buff[100];
 void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
 {
-	char *errmsg;
 	int err_layer, agent;
 	int id = ((dev->bus->number << 8) | dev->devfn);
 
@@ -199,12 +192,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
 		AER_PR(info, "PCIE Bus Error type\t: %s\n",
 			aer_error_layer[err_layer]);
 
-		spin_lock(&logbuf_lock);
-		errmsg = aer_get_error_source_name(info->severity,
-				info->status,
-				errmsg_buff);
-		AER_PR(info, "%s\t:\n", errmsg);
-		spin_unlock(&logbuf_lock);
+		aer_print_error_source(info);
 
 		agent = AER_GET_AGENT(info->severity, info->status);
 		AER_PR(info, "%s\t\t: %04x\n", aer_agent_string[agent], id);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
PCI: pcie, aer: remove spinlock in aerdrv_errprint.c, Linux Kernel Mailing ..., (Wed Sep 16, 8:00 am)