Skip to content

Commit

Permalink
EDAC: Delete edac_stub.c
Browse files Browse the repository at this point in the history
Move the remaining functionality to edac_mc.c. Convert "edac_report=" to
a module parameter.

Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
Borislav Petkov committed Apr 10, 2017
1 parent a06b85f commit fee27d7
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 61 deletions.
2 changes: 1 addition & 1 deletion drivers/edac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# GNU General Public License.
#

obj-$(CONFIG_EDAC) := edac_stub.o edac_core.o
obj-$(CONFIG_EDAC) := edac_core.o

edac_core-y := edac_mc.o edac_device.o edac_mc_sysfs.o
edac_core-y += edac_module.o edac_device_sysfs.o wq.o
Expand Down
61 changes: 61 additions & 0 deletions drivers/edac/edac_mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
int edac_op_state = EDAC_OPSTATE_INVAL;
EXPORT_SYMBOL_GPL(edac_op_state);

static int edac_report = EDAC_REPORTING_ENABLED;

/* lock to memory controller's control array */
static DEFINE_MUTEX(mem_ctls_mutex);
static LIST_HEAD(mc_devices);
Expand All @@ -55,6 +57,65 @@ static void const *edac_mc_owner;

static struct bus_type mc_bus[EDAC_MAX_MCS];

int get_edac_report_status(void)
{
return edac_report;
}
EXPORT_SYMBOL_GPL(get_edac_report_status);

void set_edac_report_status(int new)
{
if (new == EDAC_REPORTING_ENABLED ||
new == EDAC_REPORTING_DISABLED ||
new == EDAC_REPORTING_FORCE)
edac_report = new;
}
EXPORT_SYMBOL_GPL(set_edac_report_status);

static int edac_report_set(const char *str, const struct kernel_param *kp)
{
if (!str)
return -EINVAL;

if (!strncmp(str, "on", 2))
edac_report = EDAC_REPORTING_ENABLED;
else if (!strncmp(str, "off", 3))
edac_report = EDAC_REPORTING_DISABLED;
else if (!strncmp(str, "force", 5))
edac_report = EDAC_REPORTING_FORCE;

return 0;
}

static int edac_report_get(char *buffer, const struct kernel_param *kp)
{
int ret = 0;

switch (edac_report) {
case EDAC_REPORTING_ENABLED:
ret = sprintf(buffer, "on");
break;
case EDAC_REPORTING_DISABLED:
ret = sprintf(buffer, "off");
break;
case EDAC_REPORTING_FORCE:
ret = sprintf(buffer, "force");
break;
default:
ret = -EINVAL;
break;
}

return ret;
}

static const struct kernel_param_ops edac_report_ops = {
.set = edac_report_set,
.get = edac_report_get,
};

module_param_cb(edac_report, &edac_report_ops, &edac_report, 0644);

unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
unsigned len)
{
Expand Down
37 changes: 0 additions & 37 deletions drivers/edac/edac_stub.c

This file was deleted.

26 changes: 3 additions & 23 deletions include/linux/edac.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,16 @@ struct device;

extern int edac_op_state;

extern struct bus_type *edac_get_sysfs_subsys(void);
struct bus_type *edac_get_sysfs_subsys(void);
int get_edac_report_status(void);
void set_edac_report_status(int new);

enum {
EDAC_REPORTING_ENABLED,
EDAC_REPORTING_DISABLED,
EDAC_REPORTING_FORCE
};

extern int edac_report_status;
#ifdef CONFIG_EDAC
static inline int get_edac_report_status(void)
{
return edac_report_status;
}

static inline void set_edac_report_status(int new)
{
edac_report_status = new;
}
#else
static inline int get_edac_report_status(void)
{
return EDAC_REPORTING_DISABLED;
}

static inline void set_edac_report_status(int new)
{
}
#endif

static inline void opstate_init(void)
{
switch (edac_op_state) {
Expand Down

0 comments on commit fee27d7

Please sign in to comment.