Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 079708b9 authored by Douglas Thompson's avatar Douglas Thompson Committed by Linus Torvalds
Browse files

drivers/edac: core Lindent cleanup



Run the EDAC CORE files through Lindent for cleanup

Signed-off-by: default avatarDouglas Thompson <dougthompson@xmission.com>
Signed-off-by: default avatarDave Jiang <djiang@mvista.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4de78c68
Loading
Loading
Loading
Loading
+84 −89
Original line number Diff line number Diff line
@@ -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
 *
@@ -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
@@ -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,7 +789,8 @@ 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 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);
@@ -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);

@@ -816,8 +811,8 @@ 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_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);
+92 −94
Original line number Diff line number Diff line
@@ -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,7 +45,6 @@ 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)
{
@@ -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;
@@ -127,8 +126,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
	    (((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;
	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;
@@ -153,9 +151,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
		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;
@@ -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;
@@ -271,7 +267,8 @@ static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev)
      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);
@@ -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
@@ -339,8 +336,7 @@ EXPORT_SYMBOL(edac_device_find);
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 edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
#else
static void edac_device_workq_function(void *ptr)
{
@@ -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",
@@ -489,6 +483,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
	unlock_device_list();
	return 1;
}

EXPORT_SYMBOL_GPL(edac_device_add_device);

/**
@@ -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);
+175 −214
Original line number Diff line number Diff line
@@ -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)
@@ -48,14 +47,12 @@ static ssize_t edac_dev_ctl_name_show(struct edac_device_ctl_info *edac_dev,
	return sprintf(data, "%s\n", edac_dev->ctl_name);
}


struct edacdev_attribute {
	struct attribute attr;
	 ssize_t(*show) (struct edac_device_ctl_info *, char *);
	 ssize_t(*store) (struct edac_device_ctl_info *, const char *, size_t);
};


/* EDAC DEVICE show/store functions for top most object */
static ssize_t edacdev_show(struct kobject *kobj, struct attribute *attr,
			    char *buffer)
@@ -102,7 +99,6 @@ EDACDEV_ATTR(seconds_since_reset,S_IRUGO,edac_dev_seconds_show,NULL);
EDACDEV_ATTR(ue_count, S_IRUGO, edac_dev_ue_count_show, NULL);
EDACDEV_ATTR(ce_count, S_IRUGO, edac_dev_ce_count_show, NULL);


static struct edacdev_attribute *edacdev_attr[] = {
	&edacdev_attr_reset_counters,
	&edacdev_attr_mc_name,
@@ -139,15 +135,15 @@ static struct kobj_type ktype_device = {
 */

/* 'log_ue' */
static ssize_t edac_device_ctl_log_ue_show(
		struct edac_device_ctl_info *ctl_info, char *data)
static ssize_t edac_device_ctl_log_ue_show(struct edac_device_ctl_info
					   *ctl_info, char *data)
{
	return sprintf(data, "%u\n", ctl_info->log_ue);
}

static ssize_t edac_device_ctl_log_ue_store(
		struct edac_device_ctl_info *ctl_info,
			const char *data,size_t count)
static ssize_t edac_device_ctl_log_ue_store(struct edac_device_ctl_info
					    *ctl_info, const char *data,
					    size_t count)
{
	/* if parameter is zero, turn off flag, if non-zero turn on flag */
	ctl_info->log_ue = (simple_strtoul(data, NULL, 0) != 0);
@@ -156,15 +152,15 @@ static ssize_t edac_device_ctl_log_ue_store(
}

/* 'log_ce' */
static ssize_t edac_device_ctl_log_ce_show(
		struct edac_device_ctl_info *ctl_info,char *data)
static ssize_t edac_device_ctl_log_ce_show(struct edac_device_ctl_info
					   *ctl_info, char *data)
{
	return sprintf(data, "%u\n", ctl_info->log_ce);
}

static ssize_t edac_device_ctl_log_ce_store(
		struct edac_device_ctl_info *ctl_info,
			const char *data,size_t count)
static ssize_t edac_device_ctl_log_ce_store(struct edac_device_ctl_info
					    *ctl_info, const char *data,
					    size_t count)
{
	/* if parameter is zero, turn off flag, if non-zero turn on flag */
	ctl_info->log_ce = (simple_strtoul(data, NULL, 0) != 0);
@@ -172,17 +168,16 @@ static ssize_t edac_device_ctl_log_ce_store(
	return count;
}


/* 'panic_on_ue' */
static ssize_t edac_device_ctl_panic_on_ue_show(
		struct edac_device_ctl_info *ctl_info, char *data)
static ssize_t edac_device_ctl_panic_on_ue_show(struct edac_device_ctl_info
						*ctl_info, char *data)
{
	return sprintf(data, "%u\n", ctl_info->panic_on_ue);
}

static ssize_t edac_device_ctl_panic_on_ue_store(
		struct edac_device_ctl_info *ctl_info,
			const char *data,size_t count)
static ssize_t edac_device_ctl_panic_on_ue_store(struct edac_device_ctl_info
						 *ctl_info, const char *data,
						 size_t count)
{
	/* if parameter is zero, turn off flag, if non-zero turn on flag */
	ctl_info->panic_on_ue = (simple_strtoul(data, NULL, 0) != 0);
@@ -191,15 +186,15 @@ static ssize_t edac_device_ctl_panic_on_ue_store(
}

/* 'poll_msec' show and store functions*/
static ssize_t edac_device_ctl_poll_msec_show(
		struct edac_device_ctl_info *ctl_info, char *data)
static ssize_t edac_device_ctl_poll_msec_show(struct edac_device_ctl_info
					      *ctl_info, char *data)
{
	return sprintf(data, "%u\n", ctl_info->poll_msec);
}

static ssize_t edac_device_ctl_poll_msec_store(
		struct edac_device_ctl_info *ctl_info,
		const char *data,size_t count)
static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info
					       *ctl_info, const char *data,
					       size_t count)
{
	unsigned long value;

@@ -214,7 +209,6 @@ static ssize_t edac_device_ctl_poll_msec_store(
	return count;
}


/* edac_device_ctl_info specific attribute structure */
struct ctl_info_attribute {
	struct attribute attr;
@@ -227,8 +221,7 @@ struct ctl_info_attribute {

/* Function to 'show' fields from the edac_dev 'ctl_info' structure */
static ssize_t edac_dev_ctl_info_show(struct kobject *kobj,
                        struct attribute *attr,
                        char *buffer)
				      struct attribute *attr, char *buffer)
{
	struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
	struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
@@ -264,21 +257,16 @@ static struct ctl_info_attribute attr_ctl_info_##_name = { \
        .store  = _store,                                       \
};


/* Declare the various ctl_info attributes here and their respective ops */
CTL_INFO_ATTR(log_ue, S_IRUGO | S_IWUSR,
		edac_device_ctl_log_ue_show,
		edac_device_ctl_log_ue_store);
	      edac_device_ctl_log_ue_show, edac_device_ctl_log_ue_store);
CTL_INFO_ATTR(log_ce, S_IRUGO | S_IWUSR,
		edac_device_ctl_log_ce_show,
		edac_device_ctl_log_ce_store);
	      edac_device_ctl_log_ce_show, edac_device_ctl_log_ce_store);
CTL_INFO_ATTR(panic_on_ue, S_IRUGO | S_IWUSR,
	      edac_device_ctl_panic_on_ue_show,
	      edac_device_ctl_panic_on_ue_store);
CTL_INFO_ATTR(poll_msec, S_IRUGO | S_IWUSR,
		edac_device_ctl_poll_msec_show,
		edac_device_ctl_poll_msec_store);

	      edac_device_ctl_poll_msec_show, edac_device_ctl_poll_msec_store);

/* Base Attributes of the EDAC_DEVICE ECC object */
static struct ctl_info_attribute *device_ctrl_attr[] = {
@@ -306,7 +294,6 @@ static struct kobj_type ktype_device_ctrl = {
	.default_attrs = (struct attribute **)device_ctrl_attr,
};


/**************** edac_device main kobj ctor/dtor code *********************/

/*
@@ -317,8 +304,7 @@ static struct kobj_type ktype_device_ctrl = {
 * Return:  0 SUCCESS
 *         !0 FAILURE
 */
static int edac_device_register_main_kobj(
		struct edac_device_ctl_info *edac_dev)
static int edac_device_register_main_kobj(struct edac_device_ctl_info *edac_dev)
{
	int err = 0;
	struct sysdev_class *edac_class;
@@ -343,8 +329,7 @@ static int edac_device_register_main_kobj(
	edac_dev->kobj.parent = &edac_class->kset.kobj;

	/* generate sysfs "..../edac/<name>"   */
	debugf1("%s() set name of kobject to: %s\n",
		__func__, edac_dev->name);
	debugf1("%s() set name of kobject to: %s\n", __func__, edac_dev->name);
	err = kobject_set_name(&edac_dev->kobj, "%s", edac_dev->name);
	if (err)
		return err;
@@ -365,8 +350,8 @@ static int edac_device_register_main_kobj(
 * edac_device_unregister_main_kobj:
 *	the '..../edac/<name>' kobject
 */
static void edac_device_unregister_main_kobj(
			struct edac_device_ctl_info *edac_dev)
static void edac_device_unregister_main_kobj(struct edac_device_ctl_info
					     *edac_dev)
{
	debugf0("%s()\n", __func__);
	debugf1("%s() name of kobject is: %s\n",
@@ -382,26 +367,23 @@ static void edac_device_unregister_main_kobj(
	wait_for_completion(&edac_dev->kobj_complete);
}


/*************** edac_dev -> instance information ***********/

/*
 * Set of low-level instance attribute show functions
 */
static ssize_t instance_ue_count_show(
		struct edac_device_instance *instance, char *data)
static ssize_t instance_ue_count_show(struct edac_device_instance *instance,
				      char *data)
{
	return sprintf(data, "%u\n", instance->counters.ue_count);
}

static ssize_t instance_ce_count_show(
		struct edac_device_instance *instance, char *data)
static ssize_t instance_ce_count_show(struct edac_device_instance *instance,
				      char *data)
{
	return sprintf(data, "%u\n", instance->counters.ce_count);
}



#define to_instance(k) container_of(k, struct edac_device_instance, kobj)
#define to_instance_attr(a) container_of(a,struct instance_attribute,attr)

@@ -416,7 +398,6 @@ static void edac_device_ctrl_instance_release(struct kobject *kobj)
	complete(&instance->kobj_complete);
}


/* instance specific attribute structure */
struct instance_attribute {
	struct attribute attr;
@@ -424,11 +405,9 @@ struct instance_attribute {
	 ssize_t(*store) (struct edac_device_instance *, const char *, size_t);
};


/* Function to 'show' fields from the edac_dev 'instance' structure */
static ssize_t edac_dev_instance_show(struct kobject *kobj,
                        struct attribute *attr,
                        char *buffer)
				      struct attribute *attr, char *buffer)
{
	struct edac_device_instance *instance = to_instance(kobj);
	struct instance_attribute *instance_attr = to_instance_attr(attr);
@@ -438,7 +417,6 @@ static ssize_t edac_dev_instance_show(struct kobject *kobj,
	return -EIO;
}


/* Function to 'store' fields into the edac_dev 'instance' structure */
static ssize_t edac_dev_instance_store(struct kobject *kobj,
				       struct attribute *attr,
@@ -452,8 +430,6 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj,
	return -EIO;
}



/* edac_dev file operations for an 'instance' */
static struct sysfs_ops device_instance_ops = {
	.show = edac_dev_instance_show,
@@ -489,26 +465,21 @@ static struct kobj_type ktype_instance_ctrl = {
	.default_attrs = (struct attribute **)device_instance_attr,
};


/*************** edac_dev -> instance -> block information *********/

/*
 * Set of low-level block attribute show functions
 */
static ssize_t block_ue_count_show(
		struct edac_device_block *block, char *data)
static ssize_t block_ue_count_show(struct edac_device_block *block, char *data)
{
	return sprintf(data, "%u\n", block->counters.ue_count);
}

static ssize_t block_ce_count_show(
		struct edac_device_block *block, char *data)
static ssize_t block_ce_count_show(struct edac_device_block *block, char *data)
{
	return sprintf(data, "%u\n", block->counters.ce_count);
}



#define to_block(k) container_of(k, struct edac_device_block, kobj)
#define to_block_attr(a) container_of(a,struct block_attribute,attr)

@@ -532,8 +503,7 @@ struct block_attribute {

/* Function to 'show' fields from the edac_dev 'block' structure */
static ssize_t edac_dev_block_show(struct kobject *kobj,
                        struct attribute *attr,
                        char *buffer)
				   struct attribute *attr, char *buffer)
{
	struct edac_device_block *block = to_block(kobj);
	struct block_attribute *block_attr = to_block_attr(attr);
@@ -543,7 +513,6 @@ static ssize_t edac_dev_block_show(struct kobject *kobj,
	return -EIO;
}


/* Function to 'store' fields into the edac_dev 'block' structure */
static ssize_t edac_dev_block_store(struct kobject *kobj,
				    struct attribute *attr,
@@ -557,14 +526,12 @@ static ssize_t edac_dev_block_store(struct kobject *kobj,
	return -EIO;
}


/* edac_dev file operations for a 'block' */
static struct sysfs_ops device_block_ops = {
	.show = edac_dev_block_show,
	.store = edac_dev_block_store
};


#define BLOCK_ATTR(_name,_mode,_show,_store)        \
static struct block_attribute attr_block_##_name = {                       \
        .attr = {.name = __stringify(_name), .mode = _mode },   \
@@ -575,7 +542,6 @@ static struct block_attribute attr_block_##_name = { \
BLOCK_ATTR(ce_count, S_IRUGO, block_ce_count_show, NULL);
BLOCK_ATTR(ue_count, S_IRUGO, block_ue_count_show, NULL);


/* list of edac_dev 'block' attributes */
static struct block_attribute *device_block_attr[] = {
	&attr_block_ce_count,
@@ -590,14 +556,12 @@ static struct kobj_type ktype_block_ctrl = {
	.default_attrs = (struct attribute **)device_block_attr,
};


/************** block ctor/dtor  code ************/

/*
 * edac_device_create_block
 */
static int edac_device_create_block(
		struct edac_device_ctl_info *edac_dev,
static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
				    struct edac_device_instance *instance,
				    int idx)
{
@@ -631,8 +595,7 @@ static int edac_device_create_block(
/*
 * edac_device_delete_block(edac_dev,j);
 */
static void edac_device_delete_block(
		struct edac_device_ctl_info *edac_dev,
static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev,
				     struct edac_device_instance *instance,
				     int idx)
{
@@ -652,8 +615,8 @@ static void edac_device_delete_block(
 * edac_device_create_instance
 *	create just one instance of an edac_device 'instance'
 */
static int edac_device_create_instance(
		struct edac_device_ctl_info *edac_dev, int idx)
static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
				       int idx)
{
	int i, j;
	int err;
@@ -703,8 +666,8 @@ static int edac_device_create_instance(
 * edac_device_remove_instance
 *	remove an edac_device instance
 */
static void edac_device_delete_instance(
		struct edac_device_ctl_info *edac_dev, int idx)
static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev,
					int idx)
{
	int i;
	struct edac_device_instance *instance;
@@ -790,8 +753,7 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev)
	 * to the platform 'device' being used for this
	 */
	err = sysfs_create_link(edac_kobj,
				&edac_dev->dev->kobj,
				EDAC_DEVICE_SYMLINK);
				&edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK);
	if (err) {
		debugf0("%s() sysfs_create_link() returned err= %d\n",
			__func__, err);
@@ -834,4 +796,3 @@ void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev)
	/* unregister the instance's main kobj */
	edac_device_unregister_main_kobj(edac_dev);
}
+103 −99

File changed.

Preview size limit exceeded, changes collapsed.

+0 −2
Original line number Diff line number Diff line


/*
 * Older .h file for edac, until all drivers are modified
 *
 */

#include "edac_core.h"
Loading