Commit c9a91883 authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by Jesse Barnes

PCI: pcie, aer: checkpatch style cleanup in pcie/aer/*

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: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: default avatarAndrew Patterson <andrew.patterson@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent b439b1d4
...@@ -22,11 +22,10 @@ ...@@ -22,11 +22,10 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include "aerdrv.h" #include "aerdrv.h"
struct aer_error_inj struct aer_error_inj {
{
u8 bus; u8 bus;
u8 dev; u8 dev;
u8 fn; u8 fn;
...@@ -38,8 +37,7 @@ struct aer_error_inj ...@@ -38,8 +37,7 @@ struct aer_error_inj
u32 header_log3; u32 header_log3;
}; };
struct aer_error struct aer_error {
{
struct list_head list; struct list_head list;
unsigned int bus; unsigned int bus;
unsigned int devfn; unsigned int devfn;
...@@ -55,8 +53,7 @@ struct aer_error ...@@ -55,8 +53,7 @@ struct aer_error
u32 source_id; u32 source_id;
}; };
struct pci_bus_ops struct pci_bus_ops {
{
struct list_head list; struct list_head list;
struct pci_bus *bus; struct pci_bus *bus;
struct pci_ops *ops; struct pci_ops *ops;
...@@ -258,7 +255,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus) ...@@ -258,7 +255,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus)
bus_ops = NULL; bus_ops = NULL;
out: out:
spin_unlock_irqrestore(&inject_lock, flags); spin_unlock_irqrestore(&inject_lock, flags);
if (bus_ops)
kfree(bus_ops); kfree(bus_ops);
return 0; return 0;
} }
...@@ -401,9 +397,7 @@ static int aer_inject(struct aer_error_inj *einj) ...@@ -401,9 +397,7 @@ static int aer_inject(struct aer_error_inj *einj)
else else
ret = -EINVAL; ret = -EINVAL;
out_put: out_put:
if (err_alloc)
kfree(err_alloc); kfree(err_alloc);
if (rperr_alloc)
kfree(rperr_alloc); kfree(rperr_alloc);
pci_dev_put(dev); pci_dev_put(dev);
return ret; return ret;
...@@ -458,8 +452,7 @@ static void __exit aer_inject_exit(void) ...@@ -458,8 +452,7 @@ static void __exit aer_inject_exit(void)
} }
spin_lock_irqsave(&inject_lock, flags); spin_lock_irqsave(&inject_lock, flags);
list_for_each_entry_safe(err, err_next, list_for_each_entry_safe(err, err_next, &pci_bus_ops_list, list) {
&pci_bus_ops_list, list) {
list_del(&err->list); list_del(&err->list);
kfree(err); kfree(err);
} }
......
...@@ -38,7 +38,7 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -38,7 +38,7 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); 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 void aer_remove(struct pcie_device *dev);
static pci_ers_result_t aer_error_detected(struct pci_dev *dev, static pci_ers_result_t aer_error_detected(struct pci_dev *dev,
enum pci_channel_state error); enum pci_channel_state error);
...@@ -134,12 +134,12 @@ EXPORT_SYMBOL_GPL(aer_irq); ...@@ -134,12 +134,12 @@ EXPORT_SYMBOL_GPL(aer_irq);
* *
* Invoked when Root Port's AER service is loaded. * Invoked when Root Port's AER service is loaded.
**/ **/
static struct aer_rpc* aer_alloc_rpc(struct pcie_device *dev) static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev)
{ {
struct aer_rpc *rpc; struct aer_rpc *rpc;
if (!(rpc = kzalloc(sizeof(struct aer_rpc), rpc = kzalloc(sizeof(struct aer_rpc), GFP_KERNEL);
GFP_KERNEL))) if (!rpc)
return NULL; return NULL;
/* /*
...@@ -189,26 +189,28 @@ static void aer_remove(struct pcie_device *dev) ...@@ -189,26 +189,28 @@ static void aer_remove(struct pcie_device *dev)
* *
* Invoked when PCI Express bus loads AER service driver. * 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; int status;
struct aer_rpc *rpc; struct aer_rpc *rpc;
struct device *device = &dev->device; struct device *device = &dev->device;
/* Init */ /* Init */
if ((status = aer_init(dev))) status = aer_init(dev);
if (status)
return status; return status;
/* Alloc rpc data structure */ /* 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"); dev_printk(KERN_DEBUG, device, "alloc rpc failed\n");
aer_remove(dev); aer_remove(dev);
return -ENOMEM; return -ENOMEM;
} }
/* Request IRQ ISR */ /* Request IRQ ISR */
if ((status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv", status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv", dev);
dev))) { if (status) {
dev_printk(KERN_DEBUG, device, "request IRQ failed\n"); dev_printk(KERN_DEBUG, device, "request IRQ failed\n");
aer_remove(dev); aer_remove(dev);
return status; return status;
......
...@@ -136,4 +136,4 @@ static inline int aer_osc_setup(struct pcie_device *pciedev) ...@@ -136,4 +136,4 @@ static inline int aer_osc_setup(struct pcie_device *pciedev)
} }
#endif #endif
#endif //_AERDRV_H_ #endif /* _AERDRV_H_ */
...@@ -49,10 +49,11 @@ int pci_enable_pcie_error_reporting(struct pci_dev *dev) ...@@ -49,10 +49,11 @@ int pci_enable_pcie_error_reporting(struct pci_dev *dev)
PCI_EXP_DEVCTL_NFERE | PCI_EXP_DEVCTL_NFERE |
PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_FERE |
PCI_EXP_DEVCTL_URRE; PCI_EXP_DEVCTL_URRE;
pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, reg16);
reg16);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
int pci_disable_pcie_error_reporting(struct pci_dev *dev) int pci_disable_pcie_error_reporting(struct pci_dev *dev)
{ {
...@@ -68,10 +69,11 @@ 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_NFERE |
PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_FERE |
PCI_EXP_DEVCTL_URRE); PCI_EXP_DEVCTL_URRE);
pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, reg16);
reg16);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) 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) ...@@ -92,6 +94,7 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
#if 0 #if 0
int pci_cleanup_aer_correct_error_status(struct pci_dev *dev) 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) ...@@ -110,7 +113,6 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
} }
#endif /* 0 */ #endif /* 0 */
static int set_device_error_reporting(struct pci_dev *dev, void *data) static int set_device_error_reporting(struct pci_dev *dev, void *data)
{ {
bool enable = *((bool *)data); bool enable = *((bool *)data);
...@@ -164,7 +166,8 @@ static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev) ...@@ -164,7 +166,8 @@ 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->dev[e_info->error_dev_num] = dev;
e_info->error_dev_num++; e_info->error_dev_num++;
return 1; return 1;
} else }
return 0; return 0;
} }
...@@ -411,8 +414,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, ...@@ -411,8 +414,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,
pci_cleanup_aer_uncorrect_error_status(dev); pci_cleanup_aer_uncorrect_error_status(dev);
dev->error_state = pci_channel_io_normal; dev->error_state = pci_channel_io_normal;
} }
} } else {
else {
/* /*
* If the error is reported by an end point, we think this * If the error is reported by an end point, we think this
* error is related to the upstream link of the end point. * 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, ...@@ -473,7 +475,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)
udev = dev; udev = dev;
else else
udev= dev->bus->self; udev = dev->bus->self;
data.is_downstream = 0; data.is_downstream = 0;
data.aer_driver = NULL; data.aer_driver = NULL;
...@@ -576,7 +578,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev, ...@@ -576,7 +578,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
* *
* Invoked when an error being detected by Root Port. * 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 pci_dev *dev,
struct aer_err_info *info) struct aer_err_info *info)
{ {
...@@ -682,7 +684,7 @@ static void disable_root_aer(struct aer_rpc *rpc) ...@@ -682,7 +684,7 @@ static void disable_root_aer(struct aer_rpc *rpc)
* *
* Invoked by DPC handler to consume an error. * Invoked by DPC handler to consume an error.
*/ */
static struct aer_err_source* get_e_source(struct aer_rpc *rpc) static struct aer_err_source *get_e_source(struct aer_rpc *rpc)
{ {
struct aer_err_source *e_source; struct aer_err_source *e_source;
unsigned long flags; unsigned long flags;
...@@ -865,8 +867,3 @@ int aer_init(struct pcie_device *dev) ...@@ -865,8 +867,3 @@ int aer_init(struct pcie_device *dev)
return AER_SUCCESS; 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);
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define AER_AGENT_COMPLETER_MASK PCI_ERR_UNC_COMP_ABORT #define AER_AGENT_COMPLETER_MASK PCI_ERR_UNC_COMP_ABORT
#define AER_AGENT_TRANSMITTER_MASK(t, e) (e & (PCI_ERR_COR_REP_ROLL| \ #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) \ #define AER_GET_AGENT(t, e) \
((e & AER_AGENT_COMPLETER_MASK) ? AER_AGENT_COMPLETER : \ ((e & AER_AGENT_COMPLETER_MASK) ? AER_AGENT_COMPLETER : \
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
PCI_ERR_COR_BAD_DLLP| \ PCI_ERR_COR_BAD_DLLP| \
PCI_ERR_COR_REP_ROLL| \ PCI_ERR_COR_REP_ROLL| \
((t == AER_CORRECTABLE) ? \ ((t == AER_CORRECTABLE) ? \
PCI_ERR_COR_REP_TIMER: 0)) PCI_ERR_COR_REP_TIMER : 0))
#define AER_PHYSICAL_LAYER_ERROR 0 #define AER_PHYSICAL_LAYER_ERROR 0
#define AER_DATA_LINK_LAYER_ERROR 1 #define AER_DATA_LINK_LAYER_ERROR 1
...@@ -64,18 +64,18 @@ ...@@ -64,18 +64,18 @@
/* /*
* AER error strings * AER error strings
*/ */
static char* aer_error_severity_string[] = { static char *aer_error_severity_string[] = {
"Uncorrected (Non-Fatal)", "Uncorrected (Non-Fatal)",
"Uncorrected (Fatal)", "Uncorrected (Fatal)",
"Corrected" "Corrected"
}; };
static char* aer_error_layer[] = { static char *aer_error_layer[] = {
"Physical Layer", "Physical Layer",
"Data Link Layer", "Data Link Layer",
"Transaction Layer" "Transaction Layer"
}; };
static char* aer_correctable_error_string[] = { static char *aer_correctable_error_string[] = {
"Receiver Error ", /* Bit Position 0 */ "Receiver Error ", /* Bit Position 0 */
NULL, NULL,
NULL, NULL,
...@@ -110,7 +110,7 @@ static char* aer_correctable_error_string[] = { ...@@ -110,7 +110,7 @@ static char* aer_correctable_error_string[] = {
NULL, NULL,
}; };
static char* aer_uncorrectable_error_string[] = { static char *aer_uncorrectable_error_string[] = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
...@@ -145,19 +145,19 @@ static char* aer_uncorrectable_error_string[] = { ...@@ -145,19 +145,19 @@ static char* aer_uncorrectable_error_string[] = {
NULL, NULL,
}; };
static char* aer_agent_string[] = { static char *aer_agent_string[] = {
"Receiver ID", "Receiver ID",
"Requester ID", "Requester ID",
"Completer ID", "Completer ID",
"Transmitter ID" "Transmitter ID"
}; };
static char * aer_get_error_source_name(int severity, static char *aer_get_error_source_name(int severity,
unsigned int status, unsigned int status,
char errmsg_buff[]) char errmsg_buff[])
{ {
int i; int i;
char * errmsg = NULL; char *errmsg = NULL;
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (!(status & (1 << i))) if (!(status & (1 << i)))
...@@ -183,9 +183,9 @@ static DEFINE_SPINLOCK(logbuf_lock); ...@@ -183,9 +183,9 @@ static DEFINE_SPINLOCK(logbuf_lock);
static char errmsg_buff[100]; static char errmsg_buff[100];
void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
{ {
char * errmsg; char *errmsg;
int err_layer, agent; int err_layer, agent;
char * loglevel; char *loglevel;
if (info->severity == AER_CORRECTABLE) if (info->severity == AER_CORRECTABLE)
loglevel = KERN_WARNING; loglevel = KERN_WARNING;
...@@ -196,7 +196,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) ...@@ -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, printk("%sError Severity\t\t: %s\n", loglevel,
aer_error_severity_string[info->severity]); aer_error_severity_string[info->severity]);
if ( info->status == 0) { if (info->status == 0) {
printk("%sPCIE Bus Error type\t: (Unaccessible)\n", loglevel); printk("%sPCIE Bus Error type\t: (Unaccessible)\n", loglevel);
printk("%sUnaccessible Received\t: %s\n", loglevel, printk("%sUnaccessible Received\t: %s\n", loglevel,
info->flags & AER_MULTI_ERROR_VALID_FLAG ? info->flags & AER_MULTI_ERROR_VALID_FLAG ?
...@@ -245,4 +245,3 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) ...@@ -245,4 +245,3 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment