PCI: pcie, aer: checkpatch style cleanup in pcie/aer/*
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Mon, 7 Sep 2009 08:07:29 +0000 (17:07 +0900)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 9 Sep 2009 20:46:18 +0000 (13:46 -0700)
Before:
 drivers/pci/pcie/aer/aer_inject.c
  total: 4 errors, 4 warnings, 473 lines checked
 drivers/pci/pcie/aer/aerdrv.c
  total: 5 errors, 2 warnings, 333 lines checked
 drivers/pci/pcie/aer/aerdrv.h
  total: 1 errors, 0 warnings, 139 lines checked
 drivers/pci/pcie/aer/aerdrv_core.c
  total: 4 errors, 3 warnings, 872 lines checked
 drivers/pci/pcie/aer/aerdrv_errprint.c
  total: 12 errors, 11 warnings, 248 lines checked

After:
 drivers/pci/pcie/aer/aer_inject.c
  total: 0 errors, 0 warnings, 466 lines checked
 drivers/pci/pcie/aer/aerdrv.c
  total: 0 errors, 0 warnings, 335 lines checked
 drivers/pci/pcie/aer/aerdrv.h
  total: 0 errors, 0 warnings, 139 lines checked
 drivers/pci/pcie/aer/aerdrv_core.c
  total: 0 errors, 0 warnings, 869 lines checked
 drivers/pci/pcie/aer/aerdrv_errprint.c
  total: 0 errors, 10 warnings, 247 lines checked

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/aer_inject.c
drivers/pci/pcie/aer/aerdrv.c
drivers/pci/pcie/aer/aerdrv.h
drivers/pci/pcie/aer/aerdrv_core.c
drivers/pci/pcie/aer/aerdrv_errprint.c

index d92ae21..62d15f6 100644 (file)
 #include <linux/miscdevice.h>
 #include <linux/pci.h>
 #include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "aerdrv.h"
 
-struct aer_error_inj
-{
+struct aer_error_inj {
        u8 bus;
        u8 dev;
        u8 fn;
@@ -38,8 +37,7 @@ struct aer_error_inj
        u32 header_log3;
 };
 
-struct aer_error
-{
+struct aer_error {
        struct list_head list;
        unsigned int bus;
        unsigned int devfn;
@@ -55,8 +53,7 @@ struct aer_error
        u32 source_id;
 };
 
-struct pci_bus_ops
-{
+struct pci_bus_ops {
        struct list_head list;
        struct pci_bus *bus;
        struct pci_ops *ops;
@@ -150,7 +147,7 @@ static u32 *find_pci_config_dword(struct aer_error *err, int where,
                target = &err->header_log1;
                break;
        case PCI_ERR_HEADER_LOG+8:
-               target = &err->header_log2;
+               target = &err->header_log2;
                break;
        case PCI_ERR_HEADER_LOG+12:
                target = &err->header_log3;
@@ -258,8 +255,7 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus)
        bus_ops = NULL;
 out:
        spin_unlock_irqrestore(&inject_lock, flags);
-       if (bus_ops)
-               kfree(bus_ops);
+       kfree(bus_ops);
        return 0;
 }
 
@@ -401,10 +397,8 @@ static int aer_inject(struct aer_error_inj *einj)
        else
                ret = -EINVAL;
 out_put:
-       if (err_alloc)
-               kfree(err_alloc);
-       if (rperr_alloc)
-               kfree(rperr_alloc);
+       kfree(err_alloc);
+       kfree(rperr_alloc);
        pci_dev_put(dev);
        return ret;
 }
@@ -458,8 +452,7 @@ static void __exit aer_inject_exit(void)
        }
 
        spin_lock_irqsave(&inject_lock, flags);
-       list_for_each_entry_safe(err, err_next,
-                                &pci_bus_ops_list, list) {
+       list_for_each_entry_safe(err, err_next, &pci_bus_ops_list, list) {
                list_del(&err->list);
                kfree(err);
        }
index 4770f13..10c0e62 100644 (file)
@@ -38,7 +38,7 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-static int __devinit aer_probe (struct pcie_device *dev);
+static int __devinit aer_probe(struct pcie_device *dev);
 static void aer_remove(struct pcie_device *dev);
 static pci_ers_result_t aer_error_detected(struct pci_dev *dev,
        enum pci_channel_state error);
@@ -47,7 +47,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev);
 
 static struct pci_error_handlers aer_error_handlers = {
        .error_detected = aer_error_detected,
-       .resume = aer_error_resume,
+       .resume         = aer_error_resume,
 };
 
 static struct pcie_port_service_driver aerdriver = {
@@ -134,12 +134,12 @@ EXPORT_SYMBOL_GPL(aer_irq);
  *
  * Invoked when Root Port's AER service is loaded.
  **/
-static struct aer_rpcaer_alloc_rpc(struct pcie_device *dev)
+static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev)
 {
        struct aer_rpc *rpc;
 
-       if (!(rpc = kzalloc(sizeof(struct aer_rpc),
-               GFP_KERNEL)))
+       rpc = kzalloc(sizeof(struct aer_rpc), GFP_KERNEL);
+       if (!rpc)
                return NULL;
 
        /*
@@ -189,26 +189,28 @@ static void aer_remove(struct pcie_device *dev)
  *
  * Invoked when PCI Express bus loads AER service driver.
  **/
-static int __devinit aer_probe (struct pcie_device *dev)
+static int __devinit aer_probe(struct pcie_device *dev)
 {
        int status;
        struct aer_rpc *rpc;
        struct device *device = &dev->device;
 
        /* Init */
-       if ((status = aer_init(dev)))
+       status = aer_init(dev);
+       if (status)
                return status;
 
        /* Alloc rpc data structure */
-       if (!(rpc = aer_alloc_rpc(dev))) {
+       rpc = aer_alloc_rpc(dev);
+       if (!rpc) {
                dev_printk(KERN_DEBUG, device, "alloc rpc failed\n");
                aer_remove(dev);
                return -ENOMEM;
        }
 
        /* Request IRQ ISR */
-       if ((status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv",
-                               dev))) {
+       status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv", dev);
+       if (status) {
                dev_printk(KERN_DEBUG, device, "request IRQ failed\n");
                aer_remove(dev);
                return status;
index bbd7428..820ea73 100644 (file)
@@ -21,7 +21,7 @@
 #define AER_ERROR(d)                   (d & AER_ERROR_MASK)
 
 /* Root Error Status Register Bits */
-#define ROOT_ERR_STATUS_MASKS                  0x0f
+#define ROOT_ERR_STATUS_MASKS          0x0f
 
 #define SYSTEM_ERROR_INTR_ON_MESG_MASK (PCI_EXP_RTCTL_SECEE|   \
                                        PCI_EXP_RTCTL_SENFEE|   \
@@ -65,7 +65,7 @@ struct aer_err_info {
        int severity;                   /* 0:NONFATAL | 1:FATAL | 2:COR */
        int flags;
        unsigned int status;            /* COR/UNCOR Error Status */
-       struct header_log_regs tlp;     /* TLP Header */
+       struct header_log_regs tlp;     /* TLP Header */
 };
 
 struct aer_err_source {
@@ -136,4 +136,4 @@ static inline int aer_osc_setup(struct pcie_device *pciedev)
 }
 #endif
 
-#endif //_AERDRV_H_
+#endif /* _AERDRV_H_ */
index 3d88727..d3f6df4 100644 (file)
@@ -49,10 +49,11 @@ int pci_enable_pcie_error_reporting(struct pci_dev *dev)
                PCI_EXP_DEVCTL_NFERE |
                PCI_EXP_DEVCTL_FERE |
                PCI_EXP_DEVCTL_URRE;
-       pci_write_config_word(dev, pos+PCI_EXP_DEVCTL,
-                       reg16);
+       pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, reg16);
+
        return 0;
 }
+EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
 
 int pci_disable_pcie_error_reporting(struct pci_dev *dev)
 {
@@ -68,10 +69,11 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev)
                        PCI_EXP_DEVCTL_NFERE |
                        PCI_EXP_DEVCTL_FERE |
                        PCI_EXP_DEVCTL_URRE);
-       pci_write_config_word(dev, pos+PCI_EXP_DEVCTL,
-                       reg16);
+       pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, reg16);
+
        return 0;
 }
+EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
 
 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
 {
@@ -92,6 +94,7 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
 
 #if 0
 int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
@@ -110,7 +113,6 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
 }
 #endif  /*  0  */
 
-
 static int set_device_error_reporting(struct pci_dev *dev, void *data)
 {
        bool enable = *((bool *)data);
@@ -164,8 +166,9 @@ static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev)
                e_info->dev[e_info->error_dev_num] = dev;
                e_info->error_dev_num++;
                return 1;
-       } else
-               return 0;
+       }
+
+       return 0;
 }
 
 
@@ -411,8 +414,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,
                        pci_cleanup_aer_uncorrect_error_status(dev);
                        dev->error_state = pci_channel_io_normal;
                }
-       }
-       else {
+       } else {
                /*
                 * If the error is reported by an end point, we think this
                 * error is related to the upstream link of the end point.
@@ -473,7 +475,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
        if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)
                udev = dev;
        else
-               udev= dev->bus->self;
+               udev = dev->bus->self;
 
        data.is_downstream = 0;
        data.aer_driver = NULL;
@@ -576,7 +578,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
  *
  * Invoked when an error being detected by Root Port.
  */
-static void handle_error_source(struct pcie_device * aerdev,
+static void handle_error_source(struct pcie_device *aerdev,
        struct pci_dev *dev,
        struct aer_err_info *info)
 {
@@ -682,7 +684,7 @@ static void disable_root_aer(struct aer_rpc *rpc)
  *
  * Invoked by DPC handler to consume an error.
  */
-static struct aer_err_sourceget_e_source(struct aer_rpc *rpc)
+static struct aer_err_source *get_e_source(struct aer_rpc *rpc)
 {
        struct aer_err_source *e_source;
        unsigned long flags;
@@ -865,8 +867,3 @@ int aer_init(struct pcie_device *dev)
 
        return AER_SUCCESS;
 }
-
-EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
-EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
-EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
-
index 0fc29ae..ccaeceb 100644 (file)
@@ -33,7 +33,7 @@
 #define AER_AGENT_COMPLETER_MASK       PCI_ERR_UNC_COMP_ABORT
 
 #define AER_AGENT_TRANSMITTER_MASK(t, e) (e & (PCI_ERR_COR_REP_ROLL| \
-       ((t == AER_CORRECTABLE) ? PCI_ERR_COR_REP_TIMER: 0)))
+       ((t == AER_CORRECTABLE) ? PCI_ERR_COR_REP_TIMER : 0)))
 
 #define AER_GET_AGENT(t, e)                                            \
        ((e & AER_AGENT_COMPLETER_MASK) ? AER_AGENT_COMPLETER :         \
 #define AER_PHYSICAL_LAYER_ERROR_MASK  PCI_ERR_COR_RCVR
 #define AER_DATA_LINK_LAYER_ERROR_MASK(t, e)   \
                (PCI_ERR_UNC_DLP|               \
-               PCI_ERR_COR_BAD_TLP|            \
+               PCI_ERR_COR_BAD_TLP|            \
                PCI_ERR_COR_BAD_DLLP|           \
-               PCI_ERR_COR_REP_ROLL|           \
+               PCI_ERR_COR_REP_ROLL|           \
                ((t == AER_CORRECTABLE) ?       \
-               PCI_ERR_COR_REP_TIMER: 0))
+               PCI_ERR_COR_REP_TIMER : 0))
 
 #define AER_PHYSICAL_LAYER_ERROR       0
 #define AER_DATA_LINK_LAYER_ERROR      1
        ((e & AER_PHYSICAL_LAYER_ERROR_MASK) ?                  \
        AER_PHYSICAL_LAYER_ERROR :                              \
        (e & AER_DATA_LINK_LAYER_ERROR_MASK(t, e)) ?            \
-               AER_DATA_LINK_LAYER_ERROR :                     \
+               AER_DATA_LINK_LAYER_ERROR :                     \
                AER_TRANSACTION_LAYER_ERROR)
 
 /*
  * AER error strings
  */
-static charaer_error_severity_string[] = {
+static char *aer_error_severity_string[] = {
        "Uncorrected (Non-Fatal)",
        "Uncorrected (Fatal)",
        "Corrected"
 };
 
-static charaer_error_layer[] = {
+static char *aer_error_layer[] = {
        "Physical Layer",
        "Data Link Layer",
        "Transaction Layer"
 };
-static charaer_correctable_error_string[] = {
-       "Receiver Error        ",       /* Bit Position 0       */
+static char *aer_correctable_error_string[] = {
+       "Receiver Error        ",       /* Bit Position 0       */
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
-       "Bad TLP               ",       /* Bit Position 6       */
-       "Bad DLLP              ",       /* Bit Position 7       */
-       "RELAY_NUM Rollover    ",       /* Bit Position 8       */
+       "Bad TLP               ",       /* Bit Position 6       */
+       "Bad DLLP              ",       /* Bit Position 7       */
+       "RELAY_NUM Rollover    ",       /* Bit Position 8       */
        NULL,
        NULL,
        NULL,
-       "Replay Timer Timeout  ",       /* Bit Position 12      */
-       "Advisory Non-Fatal    ",       /* Bit Position 13      */
+       "Replay Timer Timeout  ",       /* Bit Position 12      */
+       "Advisory Non-Fatal    ",       /* Bit Position 13      */
        NULL,
        NULL,
        NULL,
@@ -110,7 +110,7 @@ static char* aer_correctable_error_string[] = {
        NULL,
 };
 
-static charaer_uncorrectable_error_string[] = {
+static char *aer_uncorrectable_error_string[] = {
        NULL,
        NULL,
        NULL,
@@ -123,10 +123,10 @@ static char* aer_uncorrectable_error_string[] = {
        NULL,
        NULL,
        NULL,
-       "Poisoned TLP          ",       /* Bit Position 12      */
+       "Poisoned TLP          ",       /* Bit Position 12      */
        "Flow Control Protocol ",       /* Bit Position 13      */
-       "Completion Timeout    ",       /* Bit Position 14      */
-       "Completer Abort       ",       /* Bit Position 15      */
+       "Completion Timeout    ",       /* Bit Position 14      */
+       "Completer Abort       ",       /* Bit Position 15      */
        "Unexpected Completion ",       /* Bit Position 16      */
        "Receiver Overflow     ",       /* Bit Position 17      */
        "Malformed TLP         ",       /* Bit Position 18      */
@@ -145,19 +145,19 @@ static char* aer_uncorrectable_error_string[] = {
        NULL,
 };
 
-static charaer_agent_string[] = {
+static char *aer_agent_string[] = {
        "Receiver ID",
        "Requester ID",
        "Completer ID",
        "Transmitter ID"
 };
 
-static char * aer_get_error_source_name(int severity,
+static char *aer_get_error_source_name(int severity,
                        unsigned int status,
                        char errmsg_buff[])
 {
        int i;
-       char * errmsg = NULL;
+       char *errmsg = NULL;
 
        for (i = 0; i < 32; i++) {
                if (!(status & (1 << i)))
@@ -183,9 +183,9 @@ 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;
+       char *errmsg;
        int err_layer, agent;
-       char * loglevel;
+       char *loglevel;
 
        if (info->severity == AER_CORRECTABLE)
                loglevel = KERN_WARNING;
@@ -196,7 +196,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
        printk("%sError Severity\t\t: %s\n", loglevel,
                aer_error_severity_string[info->severity]);
 
-       if ( info->status == 0) {
+       if (info->status == 0) {
                printk("%sPCIE Bus Error type\t: (Unaccessible)\n", loglevel);
                printk("%sUnaccessible Received\t: %s\n", loglevel,
                        info->flags & AER_MULTI_ERROR_VALID_FLAG ?
@@ -245,4 +245,3 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
                }
        }
 }
-