drivers/edac: core Lindent cleanup

Run the EDAC CORE files through Lindent for cleanup

Signed-off-by: Douglas Thompson <dougthompson@xmission.com>
Signed-off-by: Dave Jiang <djiang@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Douglas Thompson
2007-07-19 01:49:58 -07:00
committed by Linus Torvalds
parent 4de78c6877
commit 079708b917
11 changed files with 722 additions and 821 deletions
+29 -34
View File
@@ -211,7 +211,7 @@ enum scrub_type {
#define OP_RUNNING_POLL_INTR 0x203
#define OP_OFFLINE 0x300
extern char * edac_align_ptr(void *ptr, unsigned size);
extern char *edac_align_ptr(void *ptr, unsigned size);
/*
* There are several things to be aware of that aren't at all obvious:
@@ -345,13 +345,13 @@ struct mem_ctl_info {
internal representation and configures whatever else needs
to be configured.
*/
int (*set_sdram_scrub_rate) (struct mem_ctl_info *mci, u32 *bw);
int (*set_sdram_scrub_rate) (struct mem_ctl_info * mci, u32 * bw);
/* Get the current sdram memory scrub rate from the internal
representation and converts it to the closest matching
bandwith in bytes/sec.
*/
int (*get_sdram_scrub_rate) (struct mem_ctl_info *mci, u32 *bw);
int (*get_sdram_scrub_rate) (struct mem_ctl_info * mci, u32 * bw);
/* pointer to edac checking routine */
void (*edac_check) (struct mem_ctl_info * mci);
@@ -462,7 +462,6 @@ struct edac_attrib_spec {
#define EDAC_ATTR_CHAR 0x02
};
/* Attribute control structure
* In this structure is a pointer to the driver's edac_attrib_spec
* The life of this pointer is inclusive in the life of the driver's
@@ -509,7 +508,6 @@ struct edac_device_instance {
struct completion kobj_complete;
};
/*
* Abstract edac_device control info structure
*
@@ -553,7 +551,7 @@ struct edac_device_ctl_info {
void *pvt_info; /* pointer to 'private driver' info */
unsigned long start_time;/* edac_device load start time (jiffies)*/
unsigned long start_time; /* edac_device load start time (jiffies) */
/* these are for safe removal of mc devices from global list while
* NMI handlers may be traversing list
@@ -594,8 +592,7 @@ struct edac_device_ctl_info {
container_of(w,struct edac_device_ctl_info,work)
/* Function to calc the number of delay jiffies from poll_msec */
static inline void edac_device_calc_delay(
struct edac_device_ctl_info *edac_dev)
static inline void edac_device_calc_delay(struct edac_device_ctl_info *edac_dev)
{
/* convert from msec to jiffies */
edac_dev->delay = edac_dev->poll_msec * HZ / 1000;
@@ -616,8 +613,7 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info(
unsigned nr_blocks,
unsigned offset_value,
struct edac_attrib_spec *attrib_spec,
unsigned nr_attribs
);
unsigned nr_attribs);
/* The offset value can be:
* -1 indicating no offset value
@@ -627,7 +623,7 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info(
*/
#define BLOCK_OFFSET_VALUE_OFF ((unsigned) -1)
extern void edac_device_free_ctl_info( struct edac_device_ctl_info *ctl_info);
extern void edac_device_free_ctl_info(struct edac_device_ctl_info *ctl_info);
#ifdef CONFIG_PCI
@@ -672,7 +668,7 @@ struct edac_pci_ctl_info {
void *pvt_info; /* pointer to 'private driver' info */
unsigned long start_time;/* edac_pci load start time (jiffies)*/
unsigned long start_time; /* edac_pci load start time (jiffies) */
/* these are for safe removal of devices from global list while
* NMI handlers may be traversing list
@@ -752,9 +748,9 @@ static inline void pci_write_bits32(struct pci_dev *pdev, int offset,
#endif /* CONFIG_PCI */
extern struct mem_ctl_info * edac_mc_find(int idx);
extern int edac_mc_add_mc(struct mem_ctl_info *mci,int mc_idx);
extern struct mem_ctl_info * edac_mc_del_mc(struct device *dev);
extern struct mem_ctl_info *edac_mc_find(int idx);
extern int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx);
extern struct mem_ctl_info *edac_mc_del_mc(struct device *dev);
extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
unsigned long page);
@@ -769,25 +765,23 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
* statement clutter and extra function arguments.
*/
extern void edac_mc_handle_ce(struct mem_ctl_info *mci,
unsigned long page_frame_number, unsigned long offset_in_page,
unsigned long page_frame_number,
unsigned long offset_in_page,
unsigned long syndrome, int row, int channel,
const char *msg);
extern void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci,
const char *msg);
extern void edac_mc_handle_ue(struct mem_ctl_info *mci,
unsigned long page_frame_number, unsigned long offset_in_page,
int row, const char *msg);
unsigned long page_frame_number,
unsigned long offset_in_page, int row,
const char *msg);
extern void edac_mc_handle_ue_no_info(struct mem_ctl_info *mci,
const char *msg);
extern void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
unsigned int csrow,
unsigned int channel0,
unsigned int channel1,
char *msg);
extern void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,
unsigned int csrow,
unsigned int channel,
extern void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci, unsigned int csrow,
unsigned int channel0, unsigned int channel1,
char *msg);
extern void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci, unsigned int csrow,
unsigned int channel, char *msg);
/*
* edac_device APIs
@@ -795,8 +789,9 @@ extern void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,
extern struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
unsigned nr_chans);
extern void edac_mc_free(struct mem_ctl_info *mci);
extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx);
extern struct edac_device_ctl_info * edac_device_del_device(struct device *dev);
extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev,
int edac_idx);
extern struct edac_device_ctl_info *edac_device_del_device(struct device *dev);
extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
int inst_nr, int block_nr, const char *msg);
extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
@@ -805,8 +800,8 @@ extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
/*
* edac_pci APIs
*/
extern struct edac_pci_ctl_info *
edac_pci_alloc_ctl_info(unsigned int sz_pvt, const char *edac_pci_name);
extern struct edac_pci_ctl_info *edac_pci_alloc_ctl_info(unsigned int sz_pvt, const char
*edac_pci_name);
extern void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci);
@@ -814,10 +809,10 @@ extern void
edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci, unsigned long value);
extern int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx);
extern struct edac_pci_ctl_info * edac_pci_del_device(struct device *dev);
extern struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev);
extern struct edac_pci_ctl_info *
edac_pci_create_generic_ctl(struct device *dev, const char *mod_name);
extern struct edac_pci_ctl_info *edac_pci_create_generic_ctl(struct device *dev, const char
*mod_name);
extern void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci);
extern int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci);
@@ -826,6 +821,6 @@ extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
/*
* edac misc APIs
*/
extern char * edac_op_state_toString(int op_state);
extern char *edac_op_state_toString(int op_state);
#endif /* _EDAC_CORE_H_ */
+58 -60
View File
@@ -35,7 +35,6 @@
static DECLARE_MUTEX(device_ctls_mutex);
static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list);
static inline void lock_device_list(void)
{
down(&device_ctls_mutex);
@@ -46,11 +45,10 @@ static inline void unlock_device_list(void)
up(&device_ctls_mutex);
}
#ifdef CONFIG_EDAC_DEBUG
static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
{
debugf3("\tedac_dev = %p dev_idx=%d \n", edac_dev,edac_dev->dev_idx);
debugf3("\tedac_dev = %p dev_idx=%d \n", edac_dev, edac_dev->dev_idx);
debugf4("\tedac_dev->edac_check = %p\n", edac_dev->edac_check);
debugf3("\tdev = %p\n", edac_dev->dev);
debugf3("\tmod_name:ctl_name = %s:%s\n",
@@ -71,7 +69,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
char *edac_block_name,
unsigned nr_blocks,
unsigned offset_value,
struct edac_attrib_spec *attrib_spec,
struct edac_attrib_spec
*attrib_spec,
unsigned nr_attribs)
{
struct edac_device_ctl_info *dev_ctl;
@@ -84,35 +83,35 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
void *pvt;
debugf1("%s() instances=%d blocks=%d\n",
__func__,nr_instances,nr_blocks);
__func__, nr_instances, nr_blocks);
/* Figure out the offsets of the various items from the start of an
* ctl_info structure. We want the alignment of each item
* to be at least as stringent as what the compiler would
* provide if we could simply hardcode everything into a single struct.
*/
dev_ctl = (struct edac_device_ctl_info *) 0;
dev_ctl = (struct edac_device_ctl_info *)0;
/* Calc the 'end' offset past the ctl_info structure */
dev_inst = (struct edac_device_instance *)
edac_align_ptr(&dev_ctl[1],sizeof(*dev_inst));
edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst));
/* Calc the 'end' offset past the instance array */
dev_blk = (struct edac_device_block *)
edac_align_ptr(&dev_inst[nr_instances],sizeof(*dev_blk));
edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk));
/* Calc the 'end' offset past the dev_blk array */
count = nr_instances * nr_blocks;
dev_attrib = (struct edac_attrib *)
edac_align_ptr(&dev_blk[count],sizeof(*dev_attrib));
edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib));
/* Check for case of NO attributes specified */
if (nr_attribs > 0)
count *= nr_attribs;
/* Calc the 'end' offset past the attributes array */
pvt = edac_align_ptr(&dev_attrib[count],sz_private);
total_size = ((unsigned long) pvt) + sz_private;
pvt = edac_align_ptr(&dev_attrib[count], sz_private);
total_size = ((unsigned long)pvt) + sz_private;
/* Allocate the amount of memory for the set of control structures */
if ((dev_ctl = kmalloc(total_size, GFP_KERNEL)) == NULL)
@@ -122,13 +121,12 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
* rather than an imaginary chunk of memory located at address 0.
*/
dev_inst = (struct edac_device_instance *)
(((char *) dev_ctl) + ((unsigned long) dev_inst));
(((char *)dev_ctl) + ((unsigned long)dev_inst));
dev_blk = (struct edac_device_block *)
(((char *) dev_ctl) + ((unsigned long) dev_blk));
(((char *)dev_ctl) + ((unsigned long)dev_blk));
dev_attrib = (struct edac_attrib *)
(((char *) dev_ctl) + ((unsigned long) dev_attrib));
pvt = sz_private ?
(((char *) dev_ctl) + ((unsigned long) pvt)) : NULL;
(((char *)dev_ctl) + ((unsigned long)dev_attrib));
pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL;
memset(dev_ctl, 0, total_size); /* clear all fields */
dev_ctl->nr_instances = nr_instances;
@@ -136,8 +134,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
dev_ctl->pvt_info = pvt;
/* Name of this edac device, ensure null terminated */
snprintf(dev_ctl->name,sizeof(dev_ctl->name),"%s", edac_device_name);
dev_ctl->name[sizeof(dev_ctl->name)-1] = '\0';
snprintf(dev_ctl->name, sizeof(dev_ctl->name), "%s", edac_device_name);
dev_ctl->name[sizeof(dev_ctl->name) - 1] = '\0';
/* Initialize every Instance */
for (instance = 0; instance < nr_instances; instance++) {
@@ -150,23 +148,21 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
/* name of this instance */
snprintf(inst->name, sizeof(inst->name),
"%s%u", edac_device_name, instance);
inst->name[sizeof(inst->name)-1] = '\0';
inst->name[sizeof(inst->name) - 1] = '\0';
/* Initialize every block in each instance */
for ( block = 0;
block < nr_blocks;
block++) {
for (block = 0; block < nr_blocks; block++) {
blk = &blk_p[block];
blk->instance = inst;
blk->nr_attribs = nr_attribs;
attrib_p = &dev_attrib[block * nr_attribs];
blk->attribs = attrib_p;
snprintf(blk->name, sizeof(blk->name),
"%s%d", edac_block_name,block+1);
blk->name[sizeof(blk->name)-1] = '\0';
"%s%d", edac_block_name, block + 1);
blk->name[sizeof(blk->name) - 1] = '\0';
debugf1("%s() instance=%d block=%d name=%s\n",
__func__, instance,block,blk->name);
__func__, instance, block, blk->name);
if (attrib_spec != NULL) {
/* when there is an attrib_spec passed int then
@@ -190,6 +186,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
return dev_ctl;
}
EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info);
/*
@@ -197,19 +194,18 @@ EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info);
* frees the memory allocated by the edac_device_alloc_ctl_info()
* function
*/
void edac_device_free_ctl_info( struct edac_device_ctl_info *ctl_info) {
void edac_device_free_ctl_info(struct edac_device_ctl_info *ctl_info)
{
kfree(ctl_info);
}
EXPORT_SYMBOL_GPL(edac_device_free_ctl_info);
/*
* find_edac_device_by_dev
* scans the edac_device list for a specific 'struct device *'
*/
static struct edac_device_ctl_info *
find_edac_device_by_dev(struct device *dev)
static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev)
{
struct edac_device_ctl_info *edac_dev;
struct list_head *item;
@@ -234,7 +230,7 @@ find_edac_device_by_dev(struct device *dev)
* 0 on success
* 1 on failure.
*/
static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev)
static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev)
{
struct list_head *item, *insert_before;
struct edac_device_ctl_info *rover;
@@ -261,17 +257,18 @@ static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev)
list_add_tail_rcu(&edac_dev->link, insert_before);
return 0;
fail0:
fail0:
edac_printk(KERN_WARNING, EDAC_MC,
"%s (%s) %s %s already assigned %d\n",
rover->dev->bus_id, dev_name(rover),
rover->mod_name, rover->ctl_name, rover->dev_idx);
return 1;
fail1:
fail1:
edac_printk(KERN_WARNING, EDAC_MC,
"bug in low-level driver: attempt to assign\n"
" duplicate dev_idx %d in %s()\n", rover->dev_idx, __func__);
" duplicate dev_idx %d in %s()\n", rover->dev_idx,
__func__);
return 1;
}
@@ -290,8 +287,8 @@ static void complete_edac_device_list_del(struct rcu_head *head)
/*
* del_edac_device_from_global_list
*/
static void del_edac_device_from_global_list(
struct edac_device_ctl_info *edac_device)
static void del_edac_device_from_global_list(struct edac_device_ctl_info
*edac_device)
{
list_del_rcu(&edac_device->link);
init_completion(&edac_device->complete);
@@ -308,7 +305,7 @@ static void del_edac_device_from_global_list(
*
* Caller must hold device_ctls_mutex.
*/
struct edac_device_ctl_info * edac_device_find(int idx)
struct edac_device_ctl_info *edac_device_find(int idx)
{
struct list_head *item;
struct edac_device_ctl_info *edac_dev;
@@ -328,8 +325,8 @@ struct edac_device_ctl_info * edac_device_find(int idx)
return NULL;
}
EXPORT_SYMBOL(edac_device_find);
EXPORT_SYMBOL(edac_device_find);
/*
* edac_device_workq_function
@@ -338,14 +335,13 @@ EXPORT_SYMBOL(edac_device_find);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
static void edac_device_workq_function(struct work_struct *work_req)
{
struct delayed_work *d_work = (struct delayed_work*) work_req;
struct edac_device_ctl_info *edac_dev =
to_edac_device_ctl_work(d_work);
struct delayed_work *d_work = (struct delayed_work *)work_req;
struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
#else
static void edac_device_workq_function(void *ptr)
{
struct edac_device_ctl_info *edac_dev =
(struct edac_device_ctl_info *) ptr;
(struct edac_device_ctl_info *)ptr;
#endif
//debugf0("%s() here and running\n", __func__);
@@ -360,7 +356,7 @@ static void edac_device_workq_function(void *ptr)
unlock_device_list();
/* Reschedule */
queue_delayed_work(edac_workqueue,&edac_dev->work, edac_dev->delay);
queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay);
}
/*
@@ -403,8 +399,7 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
* edac_device_reset_delay_period
*/
void edac_device_reset_delay_period(
struct edac_device_ctl_info *edac_dev,
void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
unsigned long value)
{
lock_device_list();
@@ -468,7 +463,6 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
edac_dev->op_state = OP_RUNNING_INTERRUPT;
}
/* Report action taken */
edac_device_printk(edac_dev, KERN_INFO,
"Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n",
@@ -481,14 +475,15 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
unlock_device_list();
return 0;
fail1:
fail1:
/* Some error, so remove the entry from the lsit */
del_edac_device_from_global_list(edac_dev);
fail0:
fail0:
unlock_device_list();
return 1;
}
EXPORT_SYMBOL_GPL(edac_device_add_device);
/**
@@ -504,7 +499,7 @@ EXPORT_SYMBOL_GPL(edac_device_add_device);
* Pointer to removed edac_device structure,
* OR NULL if device not found.
*/
struct edac_device_ctl_info * edac_device_del_device(struct device *dev)
struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
{
struct edac_device_ctl_info *edac_dev;
@@ -534,14 +529,12 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev)
edac_printk(KERN_INFO, EDAC_MC,
"Removed device %d for %s %s: DEV %s\n",
edac_dev->dev_idx,
edac_dev->mod_name,
edac_dev->ctl_name,
dev_name(edac_dev));
edac_dev->mod_name, edac_dev->ctl_name, dev_name(edac_dev));
return edac_dev;
}
EXPORT_SYMBOL_GPL(edac_device_del_device);
EXPORT_SYMBOL_GPL(edac_device_del_device);
static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev)
{
@@ -553,8 +546,8 @@ static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
return edac_dev->log_ue;
}
static inline int edac_device_get_panic_on_ue(
struct edac_device_ctl_info *edac_dev)
static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info
*edac_dev)
{
return edac_dev->panic_on_ue;
}
@@ -572,7 +565,8 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) {
edac_device_printk(edac_dev, KERN_ERR,
"INTERNAL ERROR: 'instance' out of range "
"(%d >= %d)\n", inst_nr, edac_dev->nr_instances);
"(%d >= %d)\n", inst_nr,
edac_dev->nr_instances);
return;
}
@@ -581,7 +575,8 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) {
edac_device_printk(edac_dev, KERN_ERR,
"INTERNAL ERROR: instance %d 'block' out of range "
"(%d >= %d)\n", inst_nr, block_nr, instance->nr_blocks);
"(%d >= %d)\n", inst_nr, block_nr,
instance->nr_blocks);
return;
}
@@ -600,6 +595,7 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
edac_dev->ctl_name, instance->name,
block ? block->name : "N/A", msg);
}
EXPORT_SYMBOL_GPL(edac_device_handle_ce);
/*
@@ -615,7 +611,8 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) {
edac_device_printk(edac_dev, KERN_ERR,
"INTERNAL ERROR: 'instance' out of range "
"(%d >= %d)\n", inst_nr, edac_dev->nr_instances);
"(%d >= %d)\n", inst_nr,
edac_dev->nr_instances);
return;
}
@@ -624,7 +621,8 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) {
edac_device_printk(edac_dev, KERN_ERR,
"INTERNAL ERROR: instance %d 'block' out of range "
"(%d >= %d)\n", inst_nr, block_nr, instance->nr_blocks);
"(%d >= %d)\n", inst_nr, block_nr,
instance->nr_blocks);
return;
}
@@ -648,5 +646,5 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
edac_dev->ctl_name, instance->name,
block ? block->name : "N/A", msg);
}
EXPORT_SYMBOL_GPL(edac_device_handle_ue);
EXPORT_SYMBOL_GPL(edac_device_handle_ue);
File diff suppressed because it is too large Load Diff
+50 -46
View File
@@ -34,7 +34,6 @@
#include "edac_core.h"
#include "edac_module.h"
/* lock to memory controller's control array */
static DEFINE_MUTEX(mem_ctls_mutex);
static struct list_head mc_devices = LIST_HEAD_INIT(mc_devices);
@@ -54,13 +53,11 @@ static void edac_mc_dump_csrow(struct csrow_info *csrow)
{
debugf4("\tcsrow = %p\n", csrow);
debugf4("\tcsrow->csrow_idx = %d\n", csrow->csrow_idx);
debugf4("\tcsrow->first_page = 0x%lx\n",
csrow->first_page);
debugf4("\tcsrow->first_page = 0x%lx\n", csrow->first_page);
debugf4("\tcsrow->last_page = 0x%lx\n", csrow->last_page);
debugf4("\tcsrow->page_mask = 0x%lx\n", csrow->page_mask);
debugf4("\tcsrow->nr_pages = 0x%x\n", csrow->nr_pages);
debugf4("\tcsrow->nr_channels = %d\n",
csrow->nr_channels);
debugf4("\tcsrow->nr_channels = %d\n", csrow->nr_channels);
debugf4("\tcsrow->channels = %p\n", csrow->channels);
debugf4("\tcsrow->mci = %p\n\n", csrow->mci);
}
@@ -75,8 +72,7 @@ static void edac_mc_dump_mci(struct mem_ctl_info *mci)
debugf3("\tmci->nr_csrows = %d, csrows = %p\n",
mci->nr_csrows, mci->csrows);
debugf3("\tdev = %p\n", mci->dev);
debugf3("\tmod_name:ctl_name = %s:%s\n",
mci->mod_name, mci->ctl_name);
debugf3("\tmod_name:ctl_name = %s:%s\n", mci->mod_name, mci->ctl_name);
debugf3("\tpvt_info = %p\n\n", mci->pvt_info);
}
@@ -89,7 +85,7 @@ static void edac_mc_dump_mci(struct mem_ctl_info *mci)
* If 'size' is a constant, the compiler will optimize this whole function
* down to either a no-op or the addition of a constant to the value of 'ptr'.
*/
char * edac_align_ptr(void *ptr, unsigned size)
char *edac_align_ptr(void *ptr, unsigned size)
{
unsigned align, r;
@@ -106,14 +102,14 @@ char * edac_align_ptr(void *ptr, unsigned size)
else if (size > sizeof(char))
align = sizeof(short);
else
return (char *) ptr;
return (char *)ptr;
r = size % align;
if (r == 0)
return (char *) ptr;
return (char *)ptr;
return (char *) (((unsigned long) ptr) + align - r);
return (char *)(((unsigned long)ptr) + align - r);
}
/**
@@ -147,12 +143,12 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
* stringent as what the compiler would provide if we could simply
* hardcode everything into a single struct.
*/
mci = (struct mem_ctl_info *) 0;
mci = (struct mem_ctl_info *)0;
csi = (struct csrow_info *)edac_align_ptr(&mci[1], sizeof(*csi));
chi = (struct channel_info *)
edac_align_ptr(&csi[nr_csrows], sizeof(*chi));
pvt = edac_align_ptr(&chi[nr_chans * nr_csrows], sz_pvt);
size = ((unsigned long) pvt) + sz_pvt;
size = ((unsigned long)pvt) + sz_pvt;
if ((mci = kmalloc(size, GFP_KERNEL)) == NULL)
return NULL;
@@ -160,9 +156,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
/* Adjust pointers so they point within the memory we just allocated
* rather than an imaginary chunk of memory located at address 0.
*/
csi = (struct csrow_info *) (((char *) mci) + ((unsigned long) csi));
chi = (struct channel_info *) (((char *) mci) + ((unsigned long) chi));
pvt = sz_pvt ? (((char *) mci) + ((unsigned long) pvt)) : NULL;
csi = (struct csrow_info *)(((char *)mci) + ((unsigned long)csi));
chi = (struct channel_info *)(((char *)mci) + ((unsigned long)chi));
pvt = sz_pvt ? (((char *)mci) + ((unsigned long)pvt)) : NULL;
memset(mci, 0, size); /* clear all fields */
mci->csrows = csi;
@@ -188,6 +184,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
return mci;
}
EXPORT_SYMBOL_GPL(edac_mc_alloc);
/**
@@ -198,6 +195,7 @@ void edac_mc_free(struct mem_ctl_info *mci)
{
kfree(mci);
}
EXPORT_SYMBOL_GPL(edac_mc_free);
static struct mem_ctl_info *find_mci_by_dev(struct device *dev)
@@ -224,7 +222,7 @@ static int edac_mc_assert_error_check_and_clear(void)
{
int old_state;
if(edac_op_state == EDAC_OPSTATE_POLL)
if (edac_op_state == EDAC_OPSTATE_POLL)
return 1;
old_state = edac_err_assert;
@@ -240,12 +238,12 @@ static int edac_mc_assert_error_check_and_clear(void)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
static void edac_mc_workq_function(struct work_struct *work_req)
{
struct delayed_work *d_work = (struct delayed_work*) work_req;
struct delayed_work *d_work = (struct delayed_work *)work_req;
struct mem_ctl_info *mci = to_edac_mem_ctl_work(d_work);
#else
static void edac_mc_workq_function(void *ptr)
{
struct mem_ctl_info *mci = (struct mem_ctl_info *) ptr;
struct mem_ctl_info *mci = (struct mem_ctl_info *)ptr;
#endif
mutex_lock(&mem_ctls_mutex);
@@ -320,7 +318,7 @@ void edac_reset_delay_period(struct mem_ctl_info *mci, unsigned long value)
* Before calling this function, caller must
* assign a unique value to mci->mc_idx.
*/
static int add_mc_to_global_list (struct mem_ctl_info *mci)
static int add_mc_to_global_list(struct mem_ctl_info *mci)
{
struct list_head *item, *insert_before;
struct mem_ctl_info *p;
@@ -346,13 +344,13 @@ static int add_mc_to_global_list (struct mem_ctl_info *mci)
atomic_inc(&edac_handlers);
return 0;
fail0:
fail0:
edac_printk(KERN_WARNING, EDAC_MC,
"%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx);
return 1;
fail1:
fail1:
edac_printk(KERN_WARNING, EDAC_MC,
"bug in low-level driver: attempt to assign\n"
" duplicate mc_idx %d in %s()\n", p->mc_idx, __func__);
@@ -385,7 +383,7 @@ static void del_mc_from_global_list(struct mem_ctl_info *mci)
*
* Caller must hold mem_ctls_mutex.
*/
struct mem_ctl_info * edac_mc_find(int idx)
struct mem_ctl_info *edac_mc_find(int idx)
{
struct list_head *item;
struct mem_ctl_info *mci;
@@ -403,6 +401,7 @@ struct mem_ctl_info * edac_mc_find(int idx)
return NULL;
}
EXPORT_SYMBOL(edac_mc_find);
/**
@@ -433,8 +432,8 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
edac_mc_dump_csrow(&mci->csrows[i]);
for (j = 0; j < mci->csrows[i].nr_channels; j++)
edac_mc_dump_channel(
&mci->csrows[i].channels[j]);
edac_mc_dump_channel(&mci->csrows[i].
channels[j]);
}
}
#endif
@@ -469,13 +468,14 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
mutex_unlock(&mem_ctls_mutex);
return 0;
fail1:
fail1:
del_mc_from_global_list(mci);
fail0:
fail0:
mutex_unlock(&mem_ctls_mutex);
return 1;
}
EXPORT_SYMBOL_GPL(edac_mc_add_mc);
/**
@@ -485,7 +485,7 @@ EXPORT_SYMBOL_GPL(edac_mc_add_mc);
*
* Return pointer to removed mci structure, or NULL if device not found.
*/
struct mem_ctl_info * edac_mc_del_mc(struct device *dev)
struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
{
struct mem_ctl_info *mci;
@@ -511,6 +511,7 @@ struct mem_ctl_info * edac_mc_del_mc(struct device *dev)
mci->mod_name, mci->ctl_name, dev_name(mci));
return mci;
}
EXPORT_SYMBOL_GPL(edac_mc_del_mc);
static void edac_mc_scrub_block(unsigned long page, unsigned long offset,
@@ -523,7 +524,7 @@ static void edac_mc_scrub_block(unsigned long page, unsigned long offset,
debugf3("%s()\n", __func__);
/* ECC error page was not in our memory. Ignore it. */
if(!pfn_valid(page))
if (!pfn_valid(page))
return;
/* Find the actual page structure then map it and fix */
@@ -576,17 +577,19 @@ int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page)
if (row == -1)
edac_mc_printk(mci, KERN_ERR,
"could not look up page error address %lx\n",
(unsigned long) page);
(unsigned long)page);
return row;
}
EXPORT_SYMBOL_GPL(edac_mc_find_csrow_by_page);
/* FIXME - setable log (warning/emerg) levels */
/* FIXME - integrate with evlog: http://evlog.sourceforge.net/ */
void edac_mc_handle_ce(struct mem_ctl_info *mci,
unsigned long page_frame_number, unsigned long offset_in_page,
unsigned long syndrome, int row, int channel, const char *msg)
unsigned long page_frame_number,
unsigned long offset_in_page, unsigned long syndrome,
int row, int channel, const char *msg)
{
unsigned long remapped_page;
@@ -643,6 +646,7 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,
mci->csrows[row].grain);
}
}
EXPORT_SYMBOL_GPL(edac_mc_handle_ce);
void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci, const char *msg)
@@ -654,11 +658,12 @@ void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci, const char *msg)
mci->ce_noinfo_count++;
mci->ce_count++;
}
EXPORT_SYMBOL_GPL(edac_mc_handle_ce_no_info);
void edac_mc_handle_ue(struct mem_ctl_info *mci,
unsigned long page_frame_number, unsigned long offset_in_page,
int row, const char *msg)
unsigned long page_frame_number,
unsigned long offset_in_page, int row, const char *msg)
{
int len = EDAC_MC_LABEL_LEN * 4;
char labels[len + 1];
@@ -695,8 +700,8 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,
edac_mc_printk(mci, KERN_EMERG,
"UE page 0x%lx, offset 0x%lx, grain %d, row %d, "
"labels \"%s\": %s\n", page_frame_number,
offset_in_page, mci->csrows[row].grain, row, labels,
msg);
offset_in_page, mci->csrows[row].grain, row,
labels, msg);
if (edac_mc_get_panic_on_ue())
panic("EDAC MC%d: UE page 0x%lx, offset 0x%lx, grain %d, "
@@ -707,6 +712,7 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,
mci->ue_count++;
mci->csrows[row].ue_count++;
}
EXPORT_SYMBOL_GPL(edac_mc_handle_ue);
void edac_mc_handle_ue_no_info(struct mem_ctl_info *mci, const char *msg)
@@ -720,8 +726,8 @@ void edac_mc_handle_ue_no_info(struct mem_ctl_info *mci, const char *msg)
mci->ue_noinfo_count++;
mci->ue_count++;
}
EXPORT_SYMBOL_GPL(edac_mc_handle_ue_no_info);
EXPORT_SYMBOL_GPL(edac_mc_handle_ue_no_info);
/*************************************************************
* On Fully Buffered DIMM modules, this help function is
@@ -730,8 +736,7 @@ EXPORT_SYMBOL_GPL(edac_mc_handle_ue_no_info);
void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
unsigned int csrow,
unsigned int channela,
unsigned int channelb,
char *msg)
unsigned int channelb, char *msg)
{
int len = EDAC_MC_LABEL_LEN * 4;
char labels[len + 1];
@@ -773,7 +778,8 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
/* Generate the DIMM labels from the specified channels */
chars = snprintf(pos, len + 1, "%s",
mci->csrows[csrow].channels[channela].label);
len -= chars; pos += chars;
len -= chars;
pos += chars;
chars = snprintf(pos, len + 1, "-%s",
mci->csrows[csrow].channels[channelb].label);
@@ -788,6 +794,7 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,
"labels \"%s\": %s\n", csrow, channela,
channelb, labels, msg);
}
EXPORT_SYMBOL(edac_mc_handle_fbd_ue);
/*************************************************************
@@ -795,9 +802,7 @@ EXPORT_SYMBOL(edac_mc_handle_fbd_ue);
* called to process CE events
*/
void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,
unsigned int csrow,
unsigned int channel,
char *msg)
unsigned int csrow, unsigned int channel, char *msg)
{
/* Ensure boundary values */
@@ -823,15 +828,14 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,
edac_mc_printk(mci, KERN_WARNING,
"CE row %d, channel %d, label \"%s\": %s\n",
csrow, channel,
mci->csrows[csrow].channels[channel].label,
msg);
mci->csrows[csrow].channels[channel].label, msg);
mci->ce_count++;
mci->csrows[csrow].ce_count++;
mci->csrows[csrow].channels[channel].ce_count++;
}
EXPORT_SYMBOL(edac_mc_handle_fbd_ce);
EXPORT_SYMBOL(edac_mc_handle_fbd_ce);
/*
* Iterate over all MC instances and check for ECC, et al, errors
-2
View File
@@ -1,9 +1,7 @@
/*
* Older .h file for edac, until all drivers are modified
*
*/
#include "edac_core.h"
File diff suppressed because it is too large Load Diff
+6 -8
View File
@@ -37,7 +37,7 @@ static int edac_class_valid = 0;
/*
* edac_op_state_toString()
*/
char * edac_op_state_toString(int opstate)
char *edac_op_state_toString(int opstate)
{
if (opstate == OP_RUNNING_POLL)
return "POLLED";
@@ -60,7 +60,7 @@ char * edac_op_state_toString(int opstate)
*/
struct sysdev_class *edac_get_edac_class(void)
{
struct sysdev_class *classptr=NULL;
struct sysdev_class *classptr = NULL;
if (edac_class_valid)
classptr = &edac_class;
@@ -133,7 +133,6 @@ static void edac_workqueue_teardown(void)
}
}
/*
* edac_init
* module initialization entry point
@@ -182,11 +181,11 @@ static int __init edac_init(void)
return 0;
/* Error teardown stack */
error_mem:
error_mem:
edac_sysfs_memctrl_teardown();
error_sysfs:
error_sysfs:
edac_unregister_sysfs_edac_name();
error:
error:
return err;
}
@@ -198,7 +197,7 @@ static void __exit edac_exit(void)
{
debugf0("%s()\n", __func__);
/* tear down the various subsystems*/
/* tear down the various subsystems */
edac_workqueue_teardown();
edac_sysfs_memctrl_teardown();
edac_unregister_sysfs_edac_name();
@@ -220,4 +219,3 @@ MODULE_DESCRIPTION("Core library routines for EDAC reporting");
module_param(edac_debug_level, int, 0644);
MODULE_PARM_DESC(edac_debug_level, "Debug level");
#endif
+2 -6
View File
@@ -42,10 +42,8 @@ extern struct workqueue_struct *edac_workqueue;
extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
unsigned msec);
extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev);
extern void edac_device_reset_delay_period(
struct edac_device_ctl_info *edac_dev,
unsigned long value);
extern void edac_device_reset_delay_period(struct edac_device_ctl_info
*edac_dev, unsigned long value);
/*
* EDAC PCI functions
@@ -67,6 +65,4 @@ extern int edac_pci_get_poll_msec(void);
#define edac_pci_get_poll_msec()
#endif /* CONFIG_PCI */
#endif /* __EDAC_MODULE_H__ */
+24 -21
View File
@@ -46,8 +46,7 @@ static inline void edac_unlock_pci_list(void)
* structure. The chip driver will allocate one of these for each
* edac_pci it is going to control/register with the EDAC CORE.
*/
struct edac_pci_ctl_info * edac_pci_alloc_ctl_info(
unsigned int sz_pvt,
struct edac_pci_ctl_info *edac_pci_alloc_ctl_info(unsigned int sz_pvt,
const char *edac_pci_name)
{
struct edac_pci_ctl_info *pci;
@@ -67,10 +66,11 @@ struct edac_pci_ctl_info * edac_pci_alloc_ctl_info(
pci->op_state = OP_ALLOC;
snprintf(pci->name, strlen(edac_pci_name)+1, "%s", edac_pci_name);
snprintf(pci->name, strlen(edac_pci_name) + 1, "%s", edac_pci_name);
return pci;
}
EXPORT_SYMBOL_GPL(edac_pci_alloc_ctl_info);
/*
@@ -81,13 +81,14 @@ void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci)
{
kfree(pci);
}
EXPORT_SYMBOL_GPL(edac_pci_free_ctl_info);
/*
* find_edac_pci_by_dev()
* scans the edac_pci list for a specific 'struct device *'
*/
static struct edac_pci_ctl_info * find_edac_pci_by_dev(struct device *dev)
static struct edac_pci_ctl_info *find_edac_pci_by_dev(struct device *dev)
{
struct edac_pci_ctl_info *pci;
struct list_head *item;
@@ -139,17 +140,18 @@ static int add_edac_pci_to_global_list(struct edac_pci_ctl_info *pci)
list_add_tail_rcu(&pci->link, insert_before);
return 0;
fail0:
fail0:
edac_printk(KERN_WARNING, EDAC_PCI,
"%s (%s) %s %s already assigned %d\n",
rover->dev->bus_id, dev_name(rover),
rover->mod_name, rover->ctl_name, rover->pci_idx);
return 1;
fail1:
fail1:
edac_printk(KERN_WARNING, EDAC_PCI,
"but in low-level driver: attempt to assign\n"
"\tduplicate pci_idx %d in %s()\n", rover->pci_idx, __func__);
"\tduplicate pci_idx %d in %s()\n", rover->pci_idx,
__func__);
return 1;
}
@@ -185,7 +187,7 @@ static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci)
*
* Caller must hold pci_ctls_mutex.
*/
struct edac_pci_ctl_info * edac_pci_find(int idx)
struct edac_pci_ctl_info *edac_pci_find(int idx)
{
struct list_head *item;
struct edac_pci_ctl_info *pci;
@@ -205,6 +207,7 @@ struct edac_pci_ctl_info * edac_pci_find(int idx)
return NULL;
}
EXPORT_SYMBOL_GPL(edac_pci_find);
/*
@@ -225,8 +228,7 @@ static void edac_pci_workq_function(void *ptr)
edac_lock_pci_list();
if ((pci->op_state == OP_RUNNING_POLL) &&
(pci->edac_check != NULL) &&
(edac_pci_get_check_errors()))
(pci->edac_check != NULL) && (edac_pci_get_check_errors()))
pci->edac_check(pci);
edac_unlock_pci_list();
@@ -282,6 +284,7 @@ void edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci,
edac_unlock_pci_list();
}
EXPORT_SYMBOL_GPL(edac_pci_reset_delay_period);
/*
@@ -328,18 +331,18 @@ int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx)
" DEV '%s' (%s)\n",
pci->mod_name,
pci->ctl_name,
dev_name(pci),
edac_op_state_toString(pci->op_state));
dev_name(pci), edac_op_state_toString(pci->op_state));
edac_unlock_pci_list();
return 0;
fail1:
fail1:
del_edac_pci_from_global_list(pci);
fail0:
fail0:
edac_unlock_pci_list();
return 1;
}
EXPORT_SYMBOL_GPL(edac_pci_add_device);
/*
@@ -355,7 +358,7 @@ EXPORT_SYMBOL_GPL(edac_pci_add_device);
* Pointer to removed edac_pci structure,
* or NULL if device not found
*/
struct edac_pci_ctl_info * edac_pci_del_device(struct device *dev)
struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev)
{
struct edac_pci_ctl_info *pci;
@@ -380,13 +383,11 @@ struct edac_pci_ctl_info * edac_pci_del_device(struct device *dev)
edac_printk(KERN_INFO, EDAC_PCI,
"Removed device %d for %s %s: DEV %s\n",
pci->pci_idx,
pci->mod_name,
pci->ctl_name,
dev_name(pci));
pci->pci_idx, pci->mod_name, pci->ctl_name, dev_name(pci));
return pci;
}
EXPORT_SYMBOL_GPL(edac_pci_del_device);
void edac_pci_generic_check(struct edac_pci_ctl_info *pci)
@@ -401,8 +402,8 @@ struct edac_pci_gen_data {
int edac_idx;
};
struct edac_pci_ctl_info *
edac_pci_create_generic_ctl(struct device *dev, const char *mod_name)
struct edac_pci_ctl_info *edac_pci_create_generic_ctl(struct device *dev,
const char *mod_name)
{
struct edac_pci_ctl_info *pci;
struct edac_pci_gen_data *pdata;
@@ -430,6 +431,7 @@ edac_pci_create_generic_ctl(struct device *dev, const char *mod_name)
return pci;
}
EXPORT_SYMBOL_GPL(edac_pci_create_generic_ctl);
void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci)
@@ -437,4 +439,5 @@ void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci)
edac_pci_del_device(pci->dev);
edac_pci_free_ctl_info(pci);
}
EXPORT_SYMBOL_GPL(edac_pci_release_generic_ctl);
+27 -31
View File
@@ -13,7 +13,6 @@
#include "edac_core.h"
#include "edac_module.h"
#ifdef CONFIG_PCI
#define EDAC_PCI_SYMLINK "device"
@@ -58,13 +57,13 @@ int edac_pci_get_poll_msec(void)
/**************************** EDAC PCI sysfs instance *******************/
static ssize_t instance_pe_count_show(struct edac_pci_ctl_info *pci, char *data)
{
return sprintf(data,"%u\n", atomic_read(&pci->counters.pe_count));
return sprintf(data, "%u\n", atomic_read(&pci->counters.pe_count));
}
static ssize_t instance_npe_count_show(struct edac_pci_ctl_info *pci,
char *data)
{
return sprintf(data,"%u\n", atomic_read(&pci->counters.npe_count));
return sprintf(data, "%u\n", atomic_read(&pci->counters.npe_count));
}
#define to_instance(k) container_of(k, struct edac_pci_ctl_info, kobj)
@@ -84,14 +83,13 @@ static void edac_pci_instance_release(struct kobject *kobj)
/* instance specific attribute structure */
struct instance_attribute {
struct attribute attr;
ssize_t (*show)(struct edac_pci_ctl_info *, char *);
ssize_t (*store)(struct edac_pci_ctl_info *, const char *, size_t);
ssize_t(*show) (struct edac_pci_ctl_info *, char *);
ssize_t(*store) (struct edac_pci_ctl_info *, const char *, size_t);
};
/* Function to 'show' fields from the edac_pci 'instance' structure */
static ssize_t edac_pci_instance_show(struct kobject *kobj,
struct attribute *attr,
char *buffer)
struct attribute *attr, char *buffer)
{
struct edac_pci_ctl_info *pci = to_instance(kobj);
struct instance_attribute *instance_attr = to_instance_attr(attr);
@@ -101,7 +99,6 @@ static ssize_t edac_pci_instance_show(struct kobject *kobj,
return -EIO;
}
/* Function to 'store' fields into the edac_pci 'instance' structure */
static ssize_t edac_pci_instance_store(struct kobject *kobj,
struct attribute *attr,
@@ -182,7 +179,7 @@ edac_pci_delete_instance_kobj(struct edac_pci_ctl_info *pci, int idx)
static ssize_t edac_pci_int_show(void *ptr, char *buffer)
{
int *value = ptr;
return sprintf(buffer,"%d\n",*value);
return sprintf(buffer, "%d\n", *value);
}
static ssize_t edac_pci_int_store(void *ptr, const char *buffer, size_t count)
@@ -190,7 +187,7 @@ static ssize_t edac_pci_int_store(void *ptr, const char *buffer, size_t count)
int *value = ptr;
if (isdigit(*buffer))
*value = simple_strtoul(buffer,NULL,0);
*value = simple_strtoul(buffer, NULL, 0);
return count;
}
@@ -198,8 +195,8 @@ static ssize_t edac_pci_int_store(void *ptr, const char *buffer, size_t count)
struct edac_pci_dev_attribute {
struct attribute attr;
void *value;
ssize_t (*show)(void *,char *);
ssize_t (*store)(void *, const char *,size_t);
ssize_t(*show) (void *, char *);
ssize_t(*store) (void *, const char *, size_t);
};
/* Set of show/store abstract level functions for PCI Parity object */
@@ -207,7 +204,7 @@ static ssize_t edac_pci_dev_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{
struct edac_pci_dev_attribute *edac_pci_dev;
edac_pci_dev= (struct edac_pci_dev_attribute*)attr;
edac_pci_dev = (struct edac_pci_dev_attribute *)attr;
if (edac_pci_dev->show)
return edac_pci_dev->show(edac_pci_dev->value, buffer);
@@ -215,10 +212,11 @@ static ssize_t edac_pci_dev_show(struct kobject *kobj, struct attribute *attr,
}
static ssize_t edac_pci_dev_store(struct kobject *kobj,
struct attribute *attr, const char *buffer, size_t count)
struct attribute *attr, const char *buffer,
size_t count)
{
struct edac_pci_dev_attribute *edac_pci_dev;
edac_pci_dev= (struct edac_pci_dev_attribute*)attr;
edac_pci_dev = (struct edac_pci_dev_attribute *)attr;
if (edac_pci_dev->show)
return edac_pci_dev->store(edac_pci_dev->value, buffer, count);
@@ -247,13 +245,13 @@ static struct edac_pci_dev_attribute edac_pci_attr_##_name = { \
};
/* PCI Parity control files */
EDAC_PCI_ATTR(check_pci_errors, S_IRUGO|S_IWUSR, edac_pci_int_show,
EDAC_PCI_ATTR(check_pci_errors, S_IRUGO | S_IWUSR, edac_pci_int_show,
edac_pci_int_store);
EDAC_PCI_ATTR(edac_pci_log_pe, S_IRUGO|S_IWUSR, edac_pci_int_show,
EDAC_PCI_ATTR(edac_pci_log_pe, S_IRUGO | S_IWUSR, edac_pci_int_show,
edac_pci_int_store);
EDAC_PCI_ATTR(edac_pci_log_npe, S_IRUGO|S_IWUSR, edac_pci_int_show,
EDAC_PCI_ATTR(edac_pci_log_npe, S_IRUGO | S_IWUSR, edac_pci_int_show,
edac_pci_int_store);
EDAC_PCI_ATTR(edac_pci_panic_on_pe, S_IRUGO|S_IWUSR, edac_pci_int_show,
EDAC_PCI_ATTR(edac_pci_panic_on_pe, S_IRUGO | S_IWUSR, edac_pci_int_show,
edac_pci_int_store);
EDAC_PCI_ATTR(pci_parity_count, S_IRUGO, edac_pci_int_show, NULL);
EDAC_PCI_ATTR(pci_nonparity_count, S_IRUGO, edac_pci_int_show, NULL);
@@ -283,7 +281,7 @@ static void edac_pci_release(struct kobject *kobj)
static struct kobj_type ktype_edac_pci = {
.release = edac_pci_release,
.sysfs_ops = &edac_pci_sysfs_ops,
.default_attrs = (struct attribute **) edac_pci_attr,
.default_attrs = (struct attribute **)edac_pci_attr,
};
/**
@@ -310,7 +308,7 @@ int edac_pci_register_main_kobj(void)
edac_pci_kobj.parent = &edac_class->kset.kobj;
err = kobject_set_name(&edac_pci_kobj, "pci");
if(err)
if (err)
return err;
/* Instanstiate the pci object */
@@ -359,12 +357,9 @@ int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci)
edac_pci_unregister_main_kobj();
}
debugf0("%s() idx=%d\n", __func__, pci->pci_idx);
err = sysfs_create_link(edac_kobj,
&pci->dev->kobj,
EDAC_PCI_SYMLINK);
err = sysfs_create_link(edac_kobj, &pci->dev->kobj, EDAC_PCI_SYMLINK);
if (err) {
debugf0("%s() sysfs_create_link() returned err= %d\n",
__func__, err);
@@ -419,7 +414,7 @@ static u16 get_pci_parity_status(struct pci_dev *dev, int secondary)
return status;
}
typedef void (*pci_parity_check_fn_t) (struct pci_dev *dev);
typedef void (*pci_parity_check_fn_t) (struct pci_dev * dev);
/* Clear any PCI parity errors logged by this device. */
static void edac_pci_dev_parity_clear(struct pci_dev *dev)
@@ -448,7 +443,7 @@ static void edac_pci_dev_parity_test(struct pci_dev *dev)
*/
status = get_pci_parity_status(dev, 0);
debugf2("PCI STATUS= 0x%04x %s\n", status, dev->dev.bus_id );
debugf2("PCI STATUS= 0x%04x %s\n", status, dev->dev.bus_id);
/* check the status reg for errors */
if (status) {
@@ -479,14 +474,13 @@ static void edac_pci_dev_parity_test(struct pci_dev *dev)
/* read the device TYPE, looking for bridges */
pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type);
debugf2("PCI HEADER TYPE= 0x%02x %s\n", header_type, dev->dev.bus_id );
debugf2("PCI HEADER TYPE= 0x%02x %s\n", header_type, dev->dev.bus_id);
if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {
/* On bridges, need to examine secondary status register */
status = get_pci_parity_status(dev, 1);
debugf2("PCI SEC_STATUS= 0x%04x %s\n",
status, dev->dev.bus_id );
debugf2("PCI SEC_STATUS= 0x%04x %s\n", status, dev->dev.bus_id);
/* check the secondary status reg for errors */
if (status) {
@@ -529,7 +523,7 @@ static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn)
* and while we are looking at it have its reference count
* bumped until we are done with it
*/
while((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
fn(dev);
}
}
@@ -590,6 +584,7 @@ void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg)
*/
edac_pci_do_parity_check();
}
EXPORT_SYMBOL_GPL(edac_pci_handle_pe);
void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, const char *msg)
@@ -609,6 +604,7 @@ void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, const char *msg)
*/
edac_pci_do_parity_check();
}
EXPORT_SYMBOL_GPL(edac_pci_handle_npe);
/*
+2
View File
@@ -30,6 +30,7 @@ inline int edac_handler_set(void)
return atomic_read(&edac_handlers);
}
EXPORT_SYMBOL(edac_handler_set);
/*
@@ -39,4 +40,5 @@ inline void edac_atomic_assert_error(void)
{
edac_err_assert++;
}
EXPORT_SYMBOL(edac_atomic_assert_error);