From patchwork Sun Dec 8 15:12:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 3307051 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7F6D59F384 for ; Sun, 8 Dec 2013 15:13:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBCD7202F8 for ; Sun, 8 Dec 2013 15:13:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D7C32022A for ; Sun, 8 Dec 2013 15:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759232Ab3LHPM5 (ORCPT ); Sun, 8 Dec 2013 10:12:57 -0500 Received: from mail.skyhub.de ([78.46.96.112]:36506 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758861Ab3LHPM4 (ORCPT ); Sun, 8 Dec 2013 10:12:56 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1386515575; bh=nh38x32UaQmdfWP7nP5rYHjAxM9484fuiBi5OH0GJrQ=; h=From:To:Cc:Subject:Date:Message-Id; b=HxTrcXG8Dv7Gira6zy9UN62M0d1 H9a6Eg2dD34IkB6i3lKzes1mq79I4NMqia/+ieCfeu+u1UCbt7ubM4GbiXeDiFCzGjs NcN+be+PVVjorRWwW0sm6bJNpP8gYS9fCupfgRYtymqVKRDR2mwxQVrDnD3hN9mcU5V yalj/7D/xA= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CFy+Z6M-bDOi; Sun, 8 Dec 2013 16:12:55 +0100 (CET) Received: from liondog.tnic (p4FF1D0C5.dip0.t-ipconnect.de [79.241.208.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id BE87024494B; Sun, 8 Dec 2013 16:12:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1386515575; bh=nh38x32UaQmdfWP7nP5rYHjAxM9484fuiBi5OH0GJrQ=; h=From:To:Cc:Subject:Date:Message-Id; b=HxTrcXG8Dv7Gira6zy9UN62M0d1 H9a6Eg2dD34IkB6i3lKzes1mq79I4NMqia/+ieCfeu+u1UCbt7ubM4GbiXeDiFCzGjs NcN+be+PVVjorRWwW0sm6bJNpP8gYS9fCupfgRYtymqVKRDR2mwxQVrDnD3hN9mcU5V yalj/7D/xA= Received: by liondog.tnic (Postfix, from userid 1000) id 02643100193; Sun, 8 Dec 2013 16:12:52 +0100 (CET) From: Borislav Petkov To: LKML Cc: Borislav Petkov , Bjorn Helgaas , Lance Ortiz , Tony Luck , "Rafael J. Wysocki" , linux-pci@vger.kernel.org Subject: [PATCH 1/2] PCI, AER: Add a TLP header print helper Date: Sun, 8 Dec 2013 16:12:50 +0100 Message-Id: <1386515571-23252-1-git-send-email-bp@alien8.de> X-Mailer: git-send-email 1.8.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Borislav Petkov ... and call it instead of duplicating the large printk format statement. No functionality change. Signed-off-by: Borislav Petkov --- drivers/pci/pcie/aer/aerdrv_errprint.c | 44 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 2c7c9f5f592c..32efc5e0d2eb 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c @@ -124,6 +124,21 @@ static const char *aer_agent_string[] = { "Transmitter ID" }; +static void __print_tlp_header(struct pci_dev *dev, + struct aer_header_log_regs *t) +{ + unsigned char *tlp = (unsigned char *)&t; + + dev_err(&dev->dev, " TLP Header:" + " %02x%02x%02x%02x %02x%02x%02x%02x" + " %02x%02x%02x%02x %02x%02x%02x%02x\n", + *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, + *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), + *(tlp + 11), *(tlp + 10), *(tlp + 9), + *(tlp + 8), *(tlp + 15), *(tlp + 14), + *(tlp + 13), *(tlp + 12)); +} + static void __aer_print_error(struct pci_dev *dev, struct aer_err_info *info) { @@ -178,17 +193,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) __aer_print_error(dev, info); - if (info->tlp_header_valid) { - unsigned char *tlp = (unsigned char *) &info->tlp; - dev_err(&dev->dev, " TLP Header:" - " %02x%02x%02x%02x %02x%02x%02x%02x" - " %02x%02x%02x%02x %02x%02x%02x%02x\n", - *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, - *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), - *(tlp + 11), *(tlp + 10), *(tlp + 9), - *(tlp + 8), *(tlp + 15), *(tlp + 14), - *(tlp + 13), *(tlp + 12)); - } + if (info->tlp_header_valid) + __print_tlp_header(dev, &info->tlp); } if (info->id && info->error_dev_num > 1 && info->id == id) @@ -250,18 +256,10 @@ void cper_print_aer(struct pci_dev *dev, int cper_severity, if (aer_severity != AER_CORRECTABLE) dev_err(&dev->dev, "aer_uncor_severity: 0x%08x\n", aer->uncor_severity); - if (tlp_header_valid) { - const unsigned char *tlp; - tlp = (const unsigned char *)&aer->header_log; - dev_err(&dev->dev, "aer_tlp_header:" - " %02x%02x%02x%02x %02x%02x%02x%02x" - " %02x%02x%02x%02x %02x%02x%02x%02x\n", - *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, - *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), - *(tlp + 11), *(tlp + 10), *(tlp + 9), - *(tlp + 8), *(tlp + 15), *(tlp + 14), - *(tlp + 13), *(tlp + 12)); - } + + if (tlp_header_valid) + __print_tlp_header(dev, &aer->header_log); + trace_aer_event(dev_name(&dev->dev), (status & ~mask), aer_severity); }