diff options
author | Douglas Thompson <dougthompson@xmission.com> | 2007-07-19 01:49:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 10:04:54 -0700 |
commit | 079708b9173595bf74b31b14c36e946359ae6c7e (patch) | |
tree | 79ed508a2ccdcf8d8095923cb4613594ed0af54d | |
parent | 4de78c6877ec21142582ac19453c2d453d1ea298 (diff) |
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>
-rw-r--r-- | drivers/edac/edac_core.h | 173 | ||||
-rw-r--r-- | drivers/edac/edac_device.c | 186 | ||||
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 389 | ||||
-rw-r--r-- | drivers/edac/edac_mc.c | 202 | ||||
-rw-r--r-- | drivers/edac/edac_mc.h | 2 | ||||
-rw-r--r-- | drivers/edac/edac_mc_sysfs.c | 336 | ||||
-rw-r--r-- | drivers/edac/edac_module.c | 22 | ||||
-rw-r--r-- | drivers/edac/edac_module.h | 16 | ||||
-rw-r--r-- | drivers/edac/edac_pci.c | 75 | ||||
-rw-r--r-- | drivers/edac/edac_pci_sysfs.c | 140 | ||||
-rw-r--r-- | drivers/edac/edac_stub.c | 2 |
11 files changed, 722 insertions, 821 deletions
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index 5371e230a4a..c511ad4de90 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h @@ -84,7 +84,7 @@ extern int edac_debug_level; #define debugf3( ... ) edac_debug_printk(3, __VA_ARGS__ ) #define debugf4( ... ) edac_debug_printk(4, __VA_ARGS__ ) -#else /* !CONFIG_EDAC_DEBUG */ +#else /* !CONFIG_EDAC_DEBUG */ #define debugf0( ... ) #define debugf1( ... ) @@ -92,7 +92,7 @@ extern int edac_debug_level; #define debugf3( ... ) #define debugf4( ... ) -#endif /* !CONFIG_EDAC_DEBUG */ +#endif /* !CONFIG_EDAC_DEBUG */ #define BIT(x) (1 << (x)) @@ -135,9 +135,9 @@ enum mem_type { MEM_DDR, /* Double data rate SDRAM */ MEM_RDDR, /* Registered Double data rate SDRAM */ MEM_RMBS, /* Rambus DRAM */ - MEM_DDR2, /* DDR2 RAM */ - MEM_FB_DDR2, /* fully buffered DDR2 */ - MEM_RDDR2, /* Registered DDR2 RAM */ + MEM_DDR2, /* DDR2 RAM */ + MEM_FB_DDR2, /* fully buffered DDR2 */ + MEM_RDDR2, /* Registered DDR2 RAM */ }; #define MEM_FLAG_EMPTY BIT(MEM_EMPTY) @@ -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: @@ -298,7 +298,7 @@ extern char * edac_align_ptr(void *ptr, unsigned size); struct channel_info { int chan_idx; /* channel index */ u32 ce_count; /* Correctable Errors for this CHANNEL */ - char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */ + char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */ struct csrow_info *csrow; /* the parent */ }; @@ -327,7 +327,7 @@ struct csrow_info { }; struct mem_ctl_info { - struct list_head link; /* for global list of mem_ctl_info structs */ + struct list_head link; /* for global list of mem_ctl_info structs */ unsigned long mtype_cap; /* memory types supported by mc */ unsigned long edac_ctl_cap; /* Mem controller EDAC capabilities */ unsigned long edac_cap; /* configuration capabilities - this is @@ -344,14 +344,14 @@ struct mem_ctl_info { /* Translates sdram memory scrub rate given in bytes/sec to the 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); @@ -362,7 +362,7 @@ struct mem_ctl_info { */ /* FIXME - why not send the phys page to begin with? */ unsigned long (*ctl_page_to_phys) (struct mem_ctl_info * mci, - unsigned long page); + unsigned long page); int mc_idx; int nr_csrows; struct csrow_info *csrows; @@ -444,8 +444,8 @@ struct mem_ctl_info { */ struct edac_device_counter { - u32 ue_count; - u32 ce_count; + u32 ue_count; + u32 ce_count; }; #define INC_COUNTER(cnt) (cnt++) @@ -455,14 +455,13 @@ struct edac_device_counter { * to specify attributes of the edac_block */ struct edac_attrib_spec { - char name[EDAC_DEVICE_NAME_LEN + 1]; + char name[EDAC_DEVICE_NAME_LEN + 1]; int type; #define EDAC_ATTR_INT 0x01 #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 @@ -471,9 +470,9 @@ struct edac_attrib_spec { struct edac_attrib { struct edac_device_block *block; /* Up Pointer */ - struct edac_attrib_spec *spec; /* ptr to module spec entry */ + struct edac_attrib_spec *spec; /* ptr to module spec entry */ - union { /* actual value */ + union { /* actual value */ int edac_attrib_int_value; char edac_attrib_char_value[EDAC_ATTRIB_VALUE_LEN + 1]; } edac_attrib_value; @@ -482,12 +481,12 @@ struct edac_attrib { /* device block control structure */ struct edac_device_block { struct edac_device_instance *instance; /* Up Pointer */ - char name[EDAC_DEVICE_NAME_LEN + 1]; + char name[EDAC_DEVICE_NAME_LEN + 1]; struct edac_device_counter counters; /* basic UE and CE counters */ - int nr_attribs; /* how many attributes */ - struct edac_attrib *attribs; /* this block's attributes */ + int nr_attribs; /* how many attributes */ + struct edac_attrib *attribs; /* this block's attributes */ /* edac sysfs device control */ struct kobject kobj; @@ -501,7 +500,7 @@ struct edac_device_instance { struct edac_device_counter counters; /* instance counters */ - u32 nr_blocks; /* how many blocks */ + u32 nr_blocks; /* how many blocks */ struct edac_device_block *blocks; /* block array */ /* edac sysfs device control */ @@ -509,7 +508,6 @@ struct edac_device_instance { struct completion kobj_complete; }; - /* * Abstract edac_device control info structure * @@ -539,9 +537,9 @@ struct edac_device_ctl_info { #endif /* pointer to edac polling checking routine: - * If NOT NULL: points to polling check routine - * If NULL: Then assumes INTERRUPT operation, where - * MC driver will receive events + * If NOT NULL: points to polling check routine + * If NULL: Then assumes INTERRUPT operation, where + * MC driver will receive events */ void (*edac_check) (struct edac_device_ctl_info * edac_dev); @@ -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 @@ -563,10 +561,10 @@ struct edac_device_ctl_info { /* sysfs top name under 'edac' directory * and instance name: - * cpu/cpu0/... - * cpu/cpu1/... - * cpu/cpu2/... - * ... + * cpu/cpu0/... + * cpu/cpu1/... + * cpu/cpu2/... + * ... */ char name[EDAC_DEVICE_NAME_LEN + 1]; @@ -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; @@ -609,15 +606,14 @@ static inline void edac_device_calc_delay( * it is going to control/register with the EDAC CORE. */ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info( - unsigned sizeof_private, - char *edac_device_name, - unsigned nr_instances, - char *edac_block_name, - unsigned nr_blocks, - unsigned offset_value, - struct edac_attrib_spec *attrib_spec, - unsigned nr_attribs -); + unsigned sizeof_private, + char *edac_device_name, + unsigned nr_instances, + char *edac_block_name, + unsigned nr_blocks, + unsigned offset_value, + struct edac_attrib_spec *attrib_spec, + unsigned nr_attribs); /* The offset value can be: * -1 indicating no offset value @@ -627,13 +623,13 @@ 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 struct edac_pci_counter { - atomic_t pe_count; - atomic_t npe_count; + atomic_t pe_count; + atomic_t npe_count; }; /* @@ -658,9 +654,9 @@ struct edac_pci_ctl_info { #endif /* pointer to edac polling checking routine: - * If NOT NULL: points to polling check routine - * If NULL: Then assumes INTERRUPT operation, where - * MC driver will receive events + * If NOT NULL: points to polling check routine + * If NULL: Then assumes INTERRUPT operation, where + * MC driver will receive events */ void (*edac_check) (struct edac_pci_ctl_info * edac_dev); @@ -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 @@ -682,10 +678,10 @@ struct edac_pci_ctl_info { /* sysfs top name under 'edac' directory * and instance name: - * cpu/cpu0/... - * cpu/cpu1/... - * cpu/cpu2/... - * ... + * cpu/cpu0/... + * cpu/cpu1/... + * cpu/cpu2/... + * ... */ char name[EDAC_DEVICE_NAME_LEN + 1]; @@ -704,7 +700,7 @@ struct edac_pci_ctl_info { /* write all or some bits in a byte-register*/ static inline void pci_write_bits8(struct pci_dev *pdev, int offset, u8 value, - u8 mask) + u8 mask) { if (mask != 0xff) { u8 buf; @@ -720,7 +716,7 @@ static inline void pci_write_bits8(struct pci_dev *pdev, int offset, u8 value, /* write all or some bits in a word-register*/ static inline void pci_write_bits16(struct pci_dev *pdev, int offset, - u16 value, u16 mask) + u16 value, u16 mask) { if (mask != 0xffff) { u16 buf; @@ -736,7 +732,7 @@ static inline void pci_write_bits16(struct pci_dev *pdev, int offset, /* write all or some bits in a dword-register*/ static inline void pci_write_bits32(struct pci_dev *pdev, int offset, - u32 value, u32 mask) + u32 value, u32 mask) { if (mask != 0xffff) { u32 buf; @@ -750,13 +746,13 @@ static inline void pci_write_bits32(struct pci_dev *pdev, int offset, pci_write_config_dword(pdev, offset, value); } -#endif /* CONFIG_PCI */ +#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); + unsigned long page); /* * The no info errors are used when error overflows are reported. @@ -769,44 +765,43 @@ 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 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); extern void edac_mc_handle_ce_no_info(struct mem_ctl_info *mci, - const char *msg); + 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, - char *msg); + 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, char *msg); /* * edac_device APIs */ extern struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows, - unsigned nr_chans); + 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); + int inst_nr, int block_nr, const char *msg); extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, - int inst_nr, int block_nr, const char *msg); + int inst_nr, int block_nr, const char *msg); /* * 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_ */ diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index 3db8effa1fd..4ce978b72d3 100644 --- a/drivers/edac/edac_device.c +++ b/drivers/edac/edac_device.c @@ -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,18 +45,17 @@ 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", edac_dev->mod_name, edac_dev->ctl_name); debugf3("\tpvt_info = %p\n\n", edac_dev->pvt_info); } -#endif /* CONFIG_EDAC_DEBUG */ +#endif /* CONFIG_EDAC_DEBUG */ /* * The alloc() and free() functions for the 'edac_device' control info @@ -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,22 +121,21 @@ 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 */ + memset(dev_ctl, 0, total_size); /* clear all fields */ dev_ctl->nr_instances = nr_instances; dev_ctl->instances = dev_inst; 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++) { @@ -149,24 +147,22 @@ 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'; + "%s%u", edac_device_name, instance); + 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 @@ -178,7 +174,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( /* Link each attribute to the caller's * spec entry, for name and type - */ + */ attrib->spec = &attrib_spec[attr]; } } @@ -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); - +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); + "%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__); + "bug in low-level driver: attempt to assign\n" + " 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__); @@ -353,14 +349,14 @@ static void edac_device_workq_function(void *ptr) /* Only poll controllers that are running polled and have a check */ if ((edac_dev->op_state == OP_RUNNING_POLL) && - (edac_dev->edac_check != NULL)) { + (edac_dev->edac_check != NULL)) { edac_dev->edac_check(edac_dev); } 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); } /* @@ -369,7 +365,7 @@ static void edac_device_workq_function(void *ptr) * passing in the new delay period in msec */ void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, - unsigned msec) + unsigned msec) { debugf0("%s()\n", __func__); @@ -403,9 +399,8 @@ 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, - unsigned long value) +void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, + unsigned long value) { lock_device_list(); @@ -450,7 +445,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) /* create this instance's sysfs entries */ if (edac_device_create_sysfs(edac_dev)) { edac_device_printk(edac_dev, KERN_WARNING, - "failed to create sysfs device\n"); + "failed to create sysfs device\n"); goto fail1; } @@ -468,27 +463,27 @@ 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", - edac_dev->mod_name, - edac_dev->ctl_name, - dev_name(edac_dev), - edac_op_state_toString(edac_dev->op_state) - ); + "Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n", + edac_dev->mod_name, + edac_dev->ctl_name, + dev_name(edac_dev), + edac_op_state_toString(edac_dev->op_state) + ); 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; @@ -532,16 +527,14 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev) unlock_device_list(); 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)); + "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)); 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; } @@ -564,15 +557,16 @@ static inline int edac_device_get_panic_on_ue( * perform a common output and handling of an 'edac_dev' CE event */ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, - int inst_nr, int block_nr, const char *msg) + int inst_nr, int block_nr, const char *msg) { struct edac_device_instance *instance; struct edac_device_block *block = NULL; 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); + "INTERNAL ERROR: 'instance' out of range " + "(%d >= %d)\n", inst_nr, + edac_dev->nr_instances); return; } @@ -580,8 +574,9 @@ 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); + "INTERNAL ERROR: instance %d 'block' out of range " + "(%d >= %d)\n", inst_nr, block_nr, + instance->nr_blocks); return; } @@ -596,10 +591,11 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, if (edac_device_get_log_ce(edac_dev)) edac_device_printk(edac_dev, KERN_WARNING, - "CE ctl: %s, instance: %s, block: %s: %s\n", - edac_dev->ctl_name, instance->name, - block ? block->name : "N/A", msg); + "CE ctl: %s, instance: %s, block: %s: %s\n", + edac_dev->ctl_name, instance->name, + block ? block->name : "N/A", msg); } + EXPORT_SYMBOL_GPL(edac_device_handle_ce); /* @@ -607,15 +603,16 @@ EXPORT_SYMBOL_GPL(edac_device_handle_ce); * perform a common output and handling of an 'edac_dev' UE event */ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, - int inst_nr, int block_nr, const char *msg) + int inst_nr, int block_nr, const char *msg) { struct edac_device_instance *instance; struct edac_device_block *block = NULL; 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); + "INTERNAL ERROR: 'instance' out of range " + "(%d >= %d)\n", inst_nr, + edac_dev->nr_instances); return; } @@ -623,8 +620,9 @@ 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); + "INTERNAL ERROR: instance %d 'block' out of range " + "(%d >= %d)\n", inst_nr, block_nr, + instance->nr_blocks); return; } @@ -639,14 +637,14 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, if (edac_device_get_log_ue(edac_dev)) edac_device_printk(edac_dev, KERN_EMERG, - "UE ctl: %s, instance: %s, block: %s: %s\n", - edac_dev->ctl_name, instance->name, - block ? block->name : "N/A", msg); + "UE ctl: %s, instance: %s, block: %s: %s\n", + edac_dev->ctl_name, instance->name, + block ? block->name : "N/A", msg); if (edac_device_get_panic_on_ue(edac_dev)) panic("EDAC %s: UE instance: %s, block %s: %s\n", - edac_dev->ctl_name, instance->name, - block ? block->name : "N/A", msg); + 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); diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index afb19050264..69305e63781 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c @@ -16,7 +16,6 @@ #include "edac_core.h" #include "edac_module.h" - #define EDAC_DEVICE_SYMLINK "device" #define to_edacdev(k) container_of(k, struct edac_device_ctl_info, kobj) @@ -25,43 +24,41 @@ #ifdef DKT static ssize_t edac_dev_ue_count_show(struct edac_device_ctl_info *edac_dev, - char *data) + char *data) { - return sprintf(data,"%d\n", edac_dev->ue_count); + return sprintf(data, "%d\n", edac_dev->ue_count); } static ssize_t edac_dev_ce_count_show(struct edac_device_ctl_info *edac_dev, - char *data) + char *data) { - return sprintf(data,"%d\n", edac_dev->ce_count); + return sprintf(data, "%d\n", edac_dev->ce_count); } static ssize_t edac_dev_seconds_show(struct edac_device_ctl_info *edac_dev, - char *data) + char *data) { - return sprintf(data,"%ld\n", (jiffies - edac_dev->start_time) / HZ); + return sprintf(data, "%ld\n", (jiffies - edac_dev->start_time) / HZ); } static ssize_t edac_dev_ctl_name_show(struct edac_device_ctl_info *edac_dev, - char *data) + char *data) { - return sprintf(data,"%s\n", edac_dev->ctl_name); + return sprintf(dat |