Commit eba77c04 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'edac_updates_for_v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras

Pull EDAC updates from Borislav Petkov:

 - Have skx_edac decode error addresses belonging to SGX properly

 - Remove a bunch of unused struct members

 - Other cleanups

* tag 'edac_updates_for_v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  EDAC/skx_common: Allow decoding of SGX addresses
  EDAC/mc_sysfs: Convert sprintf()/snprintf() to sysfs_emit()
  EDAC: Remove unused struct members
  EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info()
  EDAC/device: Remove edac_dev_sysfs_block_attribute::store()
  EDAC/device: Remove edac_dev_sysfs_block_attribute::{block,value}
  EDAC/amd64: Remove unused struct member amd64_pvt::ext_nbcfg
parents 796aec4a e0d33507
...@@ -737,8 +737,7 @@ static int altr_edac_device_probe(struct platform_device *pdev) ...@@ -737,8 +737,7 @@ static int altr_edac_device_probe(struct platform_device *pdev)
} }
dci = edac_device_alloc_ctl_info(sizeof(*drvdata), ecc_name, dci = edac_device_alloc_ctl_info(sizeof(*drvdata), ecc_name,
1, ecc_name, 1, 0, NULL, 0, 1, ecc_name, 1, 0, dev_instance++);
dev_instance++);
if (!dci) { if (!dci) {
edac_printk(KERN_ERR, EDAC_DEVICE, edac_printk(KERN_ERR, EDAC_DEVICE,
...@@ -1514,7 +1513,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) ...@@ -1514,7 +1513,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
/* Create the PortB EDAC device */ /* Create the PortB EDAC device */
edac_idx = edac_device_alloc_index(); edac_idx = edac_device_alloc_index();
dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name, 1, dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name, 1,
ecc_name, 1, 0, NULL, 0, edac_idx); ecc_name, 1, 0, edac_idx);
if (!dci) { if (!dci) {
edac_printk(KERN_ERR, EDAC_DEVICE, edac_printk(KERN_ERR, EDAC_DEVICE,
"%s: Unable to allocate PortB EDAC device\n", "%s: Unable to allocate PortB EDAC device\n",
...@@ -1921,8 +1920,7 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, ...@@ -1921,8 +1920,7 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac,
edac_idx = edac_device_alloc_index(); edac_idx = edac_device_alloc_index();
dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name, dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name,
1, ecc_name, 1, 0, NULL, 0, 1, ecc_name, 1, 0, edac_idx);
edac_idx);
if (!dci) { if (!dci) {
edac_printk(KERN_ERR, EDAC_DEVICE, edac_printk(KERN_ERR, EDAC_DEVICE,
......
...@@ -345,7 +345,6 @@ struct amd64_pvt { ...@@ -345,7 +345,6 @@ struct amd64_pvt {
u32 dchr1; /* DRAM Configuration High DCT1 reg */ u32 dchr1; /* DRAM Configuration High DCT1 reg */
u32 nbcap; /* North Bridge Capabilities */ u32 nbcap; /* North Bridge Capabilities */
u32 nbcfg; /* F10 North Bridge Configuration */ u32 nbcfg; /* F10 North Bridge Configuration */
u32 ext_nbcfg; /* Extended F10 North Bridge Configuration */
u32 dhar; /* DRAM Hoist reg */ u32 dhar; /* DRAM Hoist reg */
u32 dbam0; /* DRAM Base Address Mapping reg for DCT0 */ u32 dbam0; /* DRAM Base Address Mapping reg for DCT0 */
u32 dbam1; /* DRAM Base Address Mapping reg for DCT1 */ u32 dbam1; /* DRAM Base Address Mapping reg for DCT1 */
......
...@@ -366,8 +366,7 @@ static int amd8111_dev_probe(struct pci_dev *dev, ...@@ -366,8 +366,7 @@ static int amd8111_dev_probe(struct pci_dev *dev,
dev_info->edac_idx = edac_device_alloc_index(); dev_info->edac_idx = edac_device_alloc_index();
dev_info->edac_dev = dev_info->edac_dev =
edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1, edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1,
NULL, 0, 0, NULL, 0, 0, dev_info->edac_idx);
NULL, 0, dev_info->edac_idx);
if (!dev_info->edac_dev) { if (!dev_info->edac_dev) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_dev_put; goto err_dev_put;
......
...@@ -523,7 +523,7 @@ static int aurora_l2_probe(struct platform_device *pdev) ...@@ -523,7 +523,7 @@ static int aurora_l2_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "data ECC is not enabled\n"); dev_warn(&pdev->dev, "data ECC is not enabled\n");
dci = edac_device_alloc_ctl_info(sizeof(*drvdata), dci = edac_device_alloc_ctl_info(sizeof(*drvdata),
"cpu", 1, "L", 1, 2, NULL, 0, 0); "cpu", 1, "L", 1, 2, 0);
if (!dci) if (!dci)
return -ENOMEM; return -ENOMEM;
......
...@@ -797,7 +797,7 @@ static void cpc925_add_edac_devices(void __iomem *vbase) ...@@ -797,7 +797,7 @@ static void cpc925_add_edac_devices(void __iomem *vbase)
dev_info->edac_idx = edac_device_alloc_index(); dev_info->edac_idx = edac_device_alloc_index();
dev_info->edac_dev = dev_info->edac_dev =
edac_device_alloc_ctl_info(0, dev_info->ctl_name, edac_device_alloc_ctl_info(0, dev_info->ctl_name,
1, NULL, 0, 0, NULL, 0, dev_info->edac_idx); 1, NULL, 0, 0, dev_info->edac_idx);
if (!dev_info->edac_dev) { if (!dev_info->edac_dev) {
cpc925_printk(KERN_ERR, "No memory for edac device\n"); cpc925_printk(KERN_ERR, "No memory for edac device\n");
goto err1; goto err1;
......
...@@ -56,14 +56,12 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) ...@@ -56,14 +56,12 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
struct edac_device_ctl_info * struct edac_device_ctl_info *
edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instances, edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instances,
char *blk_name, unsigned nr_blocks, unsigned off_val, char *blk_name, unsigned nr_blocks, unsigned off_val,
struct edac_dev_sysfs_block_attribute *attrib_spec, int device_index)
unsigned nr_attrib, int device_index)
{ {
struct edac_dev_sysfs_block_attribute *dev_attrib, *attrib_p, *attrib;
struct edac_device_block *dev_blk, *blk_p, *blk; struct edac_device_block *dev_blk, *blk_p, *blk;
struct edac_device_instance *dev_inst, *inst; struct edac_device_instance *dev_inst, *inst;
struct edac_device_ctl_info *dev_ctl; struct edac_device_ctl_info *dev_ctl;
unsigned instance, block, attr; unsigned instance, block;
void *pvt; void *pvt;
int err; int err;
...@@ -85,15 +83,6 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance ...@@ -85,15 +83,6 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance
dev_ctl->blocks = dev_blk; dev_ctl->blocks = dev_blk;
if (nr_attrib) {
dev_attrib = kcalloc(nr_attrib, sizeof(struct edac_dev_sysfs_block_attribute),
GFP_KERNEL);
if (!dev_attrib)
goto free;
dev_ctl->attribs = dev_attrib;
}
if (pvt_sz) { if (pvt_sz) {
pvt = kzalloc(pvt_sz, GFP_KERNEL); pvt = kzalloc(pvt_sz, GFP_KERNEL);
if (!pvt) if (!pvt)
...@@ -132,44 +121,6 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance ...@@ -132,44 +121,6 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance
edac_dbg(4, "instance=%d inst_p=%p block=#%d block_p=%p name='%s'\n", edac_dbg(4, "instance=%d inst_p=%p block=#%d block_p=%p name='%s'\n",
instance, inst, block, blk, blk->name); instance, inst, block, blk, blk->name);
/* if there are NO attributes OR no attribute pointer
* then continue on to next block iteration
*/
if ((nr_attrib == 0) || (attrib_spec == NULL))
continue;
/* setup the attribute array for this block */
blk->nr_attribs = nr_attrib;
attrib_p = &dev_attrib[block*nr_instances*nr_attrib];
blk->block_attributes = attrib_p;
edac_dbg(4, "THIS BLOCK_ATTRIB=%p\n",
blk->block_attributes);
/* Initialize every user specified attribute in this
* block with the data the caller passed in
* Each block gets its own copy of pointers,
* and its unique 'value'
*/
for (attr = 0; attr < nr_attrib; attr++) {
attrib = &attrib_p[attr];
/* populate the unique per attrib
* with the code pointers and info
*/
attrib->attr = attrib_spec[attr].attr;
attrib->show = attrib_spec[attr].show;
attrib->store = attrib_spec[attr].store;
attrib->block = blk; /* up link */
edac_dbg(4, "alloc-attrib=%p attrib_name='%s' attrib-spec=%p spec-name=%s\n",
attrib, attrib->attr.name,
&attrib_spec[attr],
attrib_spec[attr].attr.name
);
}
} }
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#ifndef _EDAC_DEVICE_H_ #ifndef _EDAC_DEVICE_H_
#define _EDAC_DEVICE_H_ #define _EDAC_DEVICE_H_
#include <linux/completion.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/edac.h> #include <linux/edac.h>
#include <linux/kobject.h> #include <linux/kobject.h>
...@@ -95,22 +94,13 @@ struct edac_dev_sysfs_attribute { ...@@ -95,22 +94,13 @@ struct edac_dev_sysfs_attribute {
* *
* used in leaf 'block' nodes for adding controls/attributes * used in leaf 'block' nodes for adding controls/attributes
* *
* each block in each instance of the containing control structure * each block in each instance of the containing control structure can
* can have an array of the following. The show and store functions * have an array of the following. The show function will be filled in
* will be filled in with the show/store function in the * with the show function in the low level driver.
* low level driver.
*
* The 'value' field will be the actual value field used for
* counting
*/ */
struct edac_dev_sysfs_block_attribute { struct edac_dev_sysfs_block_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*show)(struct kobject *, struct attribute *, char *);
ssize_t (*store)(struct kobject *, struct attribute *,
const char *, size_t);
struct edac_device_block *block;
unsigned int value;
}; };
/* device block control structure */ /* device block control structure */
...@@ -200,8 +190,6 @@ struct edac_device_ctl_info { ...@@ -200,8 +190,6 @@ struct edac_device_ctl_info {
unsigned long start_time; /* edac_device load start time (jiffies) */ unsigned long start_time; /* edac_device load start time (jiffies) */
struct completion removal_complete;
/* sysfs top name under 'edac' directory /* sysfs top name under 'edac' directory
* and instance name: * and instance name:
* cpu/cpu0/... * cpu/cpu0/...
...@@ -217,7 +205,6 @@ struct edac_device_ctl_info { ...@@ -217,7 +205,6 @@ struct edac_device_ctl_info {
u32 nr_instances; u32 nr_instances;
struct edac_device_instance *instances; struct edac_device_instance *instances;
struct edac_device_block *blocks; struct edac_device_block *blocks;
struct edac_dev_sysfs_block_attribute *attribs;
/* Event counters for the this whole EDAC Device */ /* Event counters for the this whole EDAC Device */
struct edac_device_counter counters; struct edac_device_counter counters;
...@@ -245,8 +232,6 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info( ...@@ -245,8 +232,6 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info(
char *edac_device_name, unsigned nr_instances, char *edac_device_name, unsigned nr_instances,
char *edac_block_name, unsigned nr_blocks, char *edac_block_name, unsigned nr_blocks,
unsigned offset_value, unsigned offset_value,
struct edac_dev_sysfs_block_attribute *block_attributes,
unsigned nr_attribs,
int device_index); int device_index);
/* The offset value can be: /* The offset value can be:
...@@ -356,7 +341,6 @@ static inline void __edac_device_free_ctl_info(struct edac_device_ctl_info *ci) ...@@ -356,7 +341,6 @@ static inline void __edac_device_free_ctl_info(struct edac_device_ctl_info *ci)
{ {
if (ci) { if (ci) {
kfree(ci->pvt_info); kfree(ci->pvt_info);
kfree(ci->attribs);
kfree(ci->blocks); kfree(ci->blocks);
kfree(ci->instances); kfree(ci->instances);
kfree(ci); kfree(ci);
......
...@@ -457,35 +457,19 @@ static ssize_t edac_dev_block_show(struct kobject *kobj, ...@@ -457,35 +457,19 @@ static ssize_t edac_dev_block_show(struct kobject *kobj,
return -EIO; 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,
const char *buffer, size_t count)
{
struct edac_dev_sysfs_block_attribute *block_attr;
block_attr = to_block_attr(attr);
if (block_attr->store)
return block_attr->store(kobj, attr, buffer, count);
return -EIO;
}
/* edac_dev file operations for a 'block' */ /* edac_dev file operations for a 'block' */
static const struct sysfs_ops device_block_ops = { static const struct sysfs_ops device_block_ops = {
.show = edac_dev_block_show, .show = edac_dev_block_show,
.store = edac_dev_block_store
}; };
#define BLOCK_ATTR(_name,_mode,_show,_store) \ #define BLOCK_ATTR(_name,_mode,_show) \
static struct edac_dev_sysfs_block_attribute attr_block_##_name = { \ static struct edac_dev_sysfs_block_attribute attr_block_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode }, \ .attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \ .show = _show, \
.store = _store, \
}; };
BLOCK_ATTR(ce_count, S_IRUGO, block_ce_count_show, NULL); BLOCK_ATTR(ce_count, S_IRUGO, block_ce_count_show);
BLOCK_ATTR(ue_count, S_IRUGO, block_ue_count_show, NULL); BLOCK_ATTR(ue_count, S_IRUGO, block_ue_count_show);
/* list of edac_dev 'block' attributes */ /* list of edac_dev 'block' attributes */
static struct attribute *device_block_attrs[] = { static struct attribute *device_block_attrs[] = {
......
...@@ -146,7 +146,7 @@ static ssize_t csrow_ue_count_show(struct device *dev, ...@@ -146,7 +146,7 @@ static ssize_t csrow_ue_count_show(struct device *dev,
{ {
struct csrow_info *csrow = to_csrow(dev); struct csrow_info *csrow = to_csrow(dev);
return sprintf(data, "%u\n", csrow->ue_count); return sysfs_emit(data, "%u\n", csrow->ue_count);
} }
static ssize_t csrow_ce_count_show(struct device *dev, static ssize_t csrow_ce_count_show(struct device *dev,
...@@ -154,7 +154,7 @@ static ssize_t csrow_ce_count_show(struct device *dev, ...@@ -154,7 +154,7 @@ static ssize_t csrow_ce_count_show(struct device *dev,
{ {
struct csrow_info *csrow = to_csrow(dev); struct csrow_info *csrow = to_csrow(dev);
return sprintf(data, "%u\n", csrow->ce_count); return sysfs_emit(data, "%u\n", csrow->ce_count);
} }
static ssize_t csrow_size_show(struct device *dev, static ssize_t csrow_size_show(struct device *dev,
...@@ -166,7 +166,7 @@ static ssize_t csrow_size_show(struct device *dev, ...@@ -166,7 +166,7 @@ static ssize_t csrow_size_show(struct device *dev,
for (i = 0; i < csrow->nr_channels; i++) for (i = 0; i < csrow->nr_channels; i++)
nr_pages += csrow->channels[i]->dimm->nr_pages; nr_pages += csrow->channels[i]->dimm->nr_pages;
return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); return sysfs_emit(data, "%u\n", PAGES_TO_MiB(nr_pages));
} }
static ssize_t csrow_mem_type_show(struct device *dev, static ssize_t csrow_mem_type_show(struct device *dev,
...@@ -174,7 +174,7 @@ static ssize_t csrow_mem_type_show(struct device *dev, ...@@ -174,7 +174,7 @@ static ssize_t csrow_mem_type_show(struct device *dev,
{ {
struct csrow_info *csrow = to_csrow(dev); struct csrow_info *csrow = to_csrow(dev);
return sprintf(data, "%s\n", edac_mem_types[csrow->channels[0]->dimm->mtype]); return sysfs_emit(data, "%s\n", edac_mem_types[csrow->channels[0]->dimm->mtype]);
} }
static ssize_t csrow_dev_type_show(struct device *dev, static ssize_t csrow_dev_type_show(struct device *dev,
...@@ -182,7 +182,7 @@ static ssize_t csrow_dev_type_show(struct device *dev, ...@@ -182,7 +182,7 @@ static ssize_t csrow_dev_type_show(struct device *dev,
{ {
struct csrow_info *csrow = to_csrow(dev); struct csrow_info *csrow = to_csrow(dev);
return sprintf(data, "%s\n", dev_types[csrow->channels[0]->dimm->dtype]); return sysfs_emit(data, "%s\n", dev_types[csrow->channels[0]->dimm->dtype]);
} }
static ssize_t csrow_edac_mode_show(struct device *dev, static ssize_t csrow_edac_mode_show(struct device *dev,
...@@ -191,7 +191,7 @@ static ssize_t csrow_edac_mode_show(struct device *dev, ...@@ -191,7 +191,7 @@ static ssize_t csrow_edac_mode_show(struct device *dev,
{ {
struct csrow_info *csrow = to_csrow(dev); struct csrow_info *csrow = to_csrow(dev);
return sprintf(data, "%s\n", edac_caps[csrow->channels[0]->dimm->edac_mode]); return sysfs_emit(data, "%s\n", edac_caps[csrow->channels[0]->dimm->edac_mode]);
} }
/* show/store functions for DIMM Label attributes */ /* show/store functions for DIMM Label attributes */
...@@ -207,8 +207,7 @@ static ssize_t channel_dimm_label_show(struct device *dev, ...@@ -207,8 +207,7 @@ static ssize_t channel_dimm_label_show(struct device *dev,
if (!rank->dimm->label[0]) if (!rank->dimm->label[0])
return 0; return 0;
return snprintf(data, sizeof(rank->dimm->label) + 1, "%s\n", return sysfs_emit(data, "%s\n", rank->dimm->label);
rank->dimm->label);
} }
static ssize_t channel_dimm_label_store(struct device *dev, static ssize_t channel_dimm_label_store(struct device *dev,
...@@ -243,7 +242,7 @@ static ssize_t channel_ce_count_show(struct device *dev, ...@@ -243,7 +242,7 @@ static ssize_t channel_ce_count_show(struct device *dev,
unsigned int chan = to_channel(mattr); unsigned int chan = to_channel(mattr);
struct rank_info *rank = csrow->channels[chan]; struct rank_info *rank = csrow->channels[chan];
return sprintf(data, "%u\n", rank->ce_count); return sysfs_emit(data, "%u\n", rank->ce_count);
} }
/* cwrow<id>/attribute files */ /* cwrow<id>/attribute files */
...@@ -515,7 +514,7 @@ static ssize_t dimmdev_label_show(struct device *dev, ...@@ -515,7 +514,7 @@ static ssize_t dimmdev_label_show(struct device *dev,
if (!dimm->label[0]) if (!dimm->label[0])
return 0; return 0;
return snprintf(data, sizeof(dimm->label) + 1, "%s\n", dimm->label); return sysfs_emit(data, "%s\n", dimm->label);
} }
static ssize_t dimmdev_label_store(struct device *dev, static ssize_t dimmdev_label_store(struct device *dev,
...@@ -546,7 +545,7 @@ static ssize_t dimmdev_size_show(struct device *dev, ...@@ -546,7 +545,7 @@ static ssize_t dimmdev_size_show(struct device *dev,
{ {
struct dimm_info *dimm = to_dimm(dev); struct dimm_info *dimm = to_dimm(dev);
return sprintf(data, "%u\n", PAGES_TO_MiB(dimm->nr_pages)); return sysfs_emit(data, "%u\n", PAGES_TO_MiB(dimm->nr_pages));
} }
static ssize_t dimmdev_mem_type_show(struct device *dev, static ssize_t dimmdev_mem_type_show(struct device *dev,
...@@ -554,7 +553,7 @@ static ssize_t dimmdev_mem_type_show(struct device *dev, ...@@ -554,7 +553,7 @@ static ssize_t dimmdev_mem_type_show(struct device *dev,
{ {
struct dimm_info *dimm = to_dimm(dev); struct dimm_info *dimm = to_dimm(dev);
return sprintf(data, "%s\n", edac_mem_types[dimm->mtype]); return sysfs_emit(data, "%s\n", edac_mem_types[dimm->mtype]);
} }
static ssize_t dimmdev_dev_type_show(struct device *dev, static ssize_t dimmdev_dev_type_show(struct device *dev,
...@@ -562,7 +561,7 @@ static ssize_t dimmdev_dev_type_show(struct device *dev, ...@@ -562,7 +561,7 @@ static ssize_t dimmdev_dev_type_show(struct device *dev,
{ {
struct dimm_info *dimm = to_dimm(dev); struct dimm_info *dimm = to_dimm(dev);
return sprintf(data, "%s\n", dev_types[dimm->dtype]); return sysfs_emit(data, "%s\n", dev_types[dimm->dtype]);
} }
static ssize_t dimmdev_edac_mode_show(struct device *dev, static ssize_t dimmdev_edac_mode_show(struct device *dev,
...@@ -571,7 +570,7 @@ static ssize_t dimmdev_edac_mode_show(struct device *dev, ...@@ -571,7 +570,7 @@ static ssize_t dimmdev_edac_mode_show(struct device *dev,
{ {
struct dimm_info *dimm = to_dimm(dev); struct dimm_info *dimm = to_dimm(dev);
return sprintf(data, "%s\n", edac_caps[dimm->edac_mode]); return sysfs_emit(data, "%s\n", edac_caps[dimm->edac_mode]);
} }
static ssize_t dimmdev_ce_count_show(struct device *dev, static ssize_t dimmdev_ce_count_show(struct device *dev,
...@@ -580,7 +579,7 @@ static ssize_t dimmdev_ce_count_show(struct device *dev, ...@@ -580,7 +579,7 @@ static ssize_t dimmdev_ce_count_show(struct device *dev,
{ {
struct dimm_info *dimm = to_dimm(dev); struct dimm_info *dimm = to_dimm(dev);
return sprintf(data, "%u\n", dimm->ce_count); return sysfs_emit(data, "%u\n", dimm->ce_count);
} }
static ssize_t dimmdev_ue_count_show(struct device *dev, static ssize_t dimmdev_ue_count_show(struct device *dev,
...@@ -589,7 +588,7 @@ static ssize_t dimmdev_ue_count_show(struct device *dev, ...@@ -589,7 +588,7 @@ static ssize_t dimmdev_ue_count_show(struct device *dev,
{ {
struct dimm_info *dimm = to_dimm(dev); struct dimm_info *dimm = to_dimm(dev);
return sprintf(data, "%u\n", dimm->ue_count); return sysfs_emit(data, "%u\n", dimm->ue_count);
} }
/* dimm/rank attribute files */ /* dimm/rank attribute files */
...@@ -758,7 +757,7 @@ static ssize_t mci_sdram_scrub_rate_show(struct device *dev, ...@@ -758,7 +757,7 @@ static ssize_t mci_sdram_scrub_rate_show(struct device *dev,
return bandwidth; return bandwidth;
} }
return sprintf(data, "%d\n", bandwidth); return sysfs_emit(data, "%d\n", bandwidth);
} }
/* default attribute files for the MCI object */ /* default attribute files for the MCI object */
...@@ -768,7 +767,7 @@ static ssize_t mci_ue_count_show(struct device *dev, ...@@ -768,7 +767,7 @@ static ssize_t mci_ue_count_show(struct device *dev,
{ {
struct mem_ctl_info *mci = to_mci(dev); struct mem_ctl_info *mci = to_mci(dev);
return sprintf(data, "%u\n", mci->ue_mc); return sysfs_emit(data, "%u\n", mci->ue_mc);
} }
static ssize_t mci_ce_count_show(struct device *dev, static ssize_t mci_ce_count_show(struct device *dev,
...@@ -777,7 +776,7 @@ static ssize_t mci_ce_count_show(struct device *dev, ...@@ -777,7 +776,7 @@ static ssize_t mci_ce_count_show(struct device *dev,
{ {
struct mem_ctl_info *mci = to_mci(dev); struct mem_ctl_info *mci = to_mci(dev);
return sprintf(data, "%u\n", mci->ce_mc); return sysfs_emit(data, "%u\n", mci->ce_mc);
} }
static ssize_t mci_ce_noinfo_show(struct device *dev, static ssize_t mci_ce_noinfo_show(struct device *dev,
...@@ -786,7 +785,7 @@ static ssize_t mci_ce_noinfo_show(struct device *dev, ...@@ -786,7 +785,7 @@ static ssize_t mci_ce_noinfo_show(struct device *dev,
{ {
struct mem_ctl_info *mci = to_mci(dev); struct mem_ctl_info *mci = to_mci(dev);
return sprintf(data, "%u\n", mci->ce_noinfo_count); return sysfs_emit(data, "%u\n", mci->ce_noinfo_count);
} }
static ssize_t mci_ue_noinfo_show(struct device *dev, static ssize_t mci_ue_noinfo_show(struct device *dev,
...@@ -795,7 +794,7 @@ static ssize_t mci_ue_noinfo_show(struct device *dev, ...@@ -795,7 +794,7 @@ static ssize_t mci_ue_noinfo_show(struct device *dev,
{ {
struct mem_ctl_info *mci = to_mci(dev); struct mem_ctl_info *mci = to_mci(dev);
return sprintf(data, "%u\n", mci->ue_noinfo_count); return sysfs_emit(data, "%u\n", mci->ue_noinfo_count);
} }
static ssize_t mci_seconds_show(struct device *dev, static ssize_t mci_seconds_show(struct device *dev,
...@@ -804,7 +803,7 @@ static ssize_t mci_seconds_show(struct device *dev, ...@@ -804,7 +803,7 @@ static ssize_t mci_seconds_show(struct device *dev,
{ {
struct mem_ctl_info *mci = to_mci(dev); struct mem_ctl_info *mci = to_mci(dev);
return sprintf(data, "%ld\n", (jiffies - mci->start_time) / HZ); return sysfs_emit(data, "%ld\n", (jiffies - mci->start_time) / HZ);
} }
static ssize_t mci_ctl_name_show(struct device *dev, static ssize_t mci_ctl_name_show(struct device *dev,
...@@ -813,7 +812,7 @@ static ssize_t mci_ctl_name_show(struct device *dev, ...@@ -813,7 +812,7 @@ static ssize_t mci_ctl_name_show(struct device *dev,
{ {
struct mem_ctl_info *mci = to_mci(dev); struct mem_ctl_info *mci = to_mci(dev);
return sprintf(data, "%s\n", mci->ctl_name); return sysfs_emit(data, "%s\n", mci->ctl_name);
} }
static ssize_t mci_size_mb_show(struct device *dev, static ssize_t mci_size_mb_show(struct device *dev,
...@@ -833,7 +832,7 @@ static ssize_t mci_size_mb_show(struct device *dev, ...@@ -833,7 +832,7 @@ static ssize_t mci_size_mb_show(struct device *dev,
} }
} }
return sprintf(data, "%u\n", PAGES_TO_MiB(total_pages)); return sysfs_emit(data, "%u\n", PAGES_TO_MiB(total_pages));
} }
static ssize_t mci_max_location_show(struct device *dev, static ssize_t mci_max_location_show(struct device *dev,
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#ifndef _EDAC_PCI_H_ #ifndef _EDAC_PCI_H_
#define _EDAC_PCI_H_ #define _EDAC_PCI_H_
#include <linux/completion.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/edac.h> #include <linux/edac.h>
#include <linux/kobject.h> #include <linux/kobject.h>
...@@ -48,8 +47,6 @@ struct edac_pci_ctl_info { ...@@ -48,8 +47,6 @@ struct edac_pci_ctl_info {
int pci_idx; int pci_idx;
struct bus_type *edac_subsys; /* pointer to subsystem */
/* the internal state of this controller instance */ /* the internal state of this controller instance */
int op_state; int op_state;
/* work struct for this instance */ /* work struct for this instance */
...@@ -72,8 +69,6 @@ struct edac_pci_ctl_info { ...@@ -72,8 +69,6 @@ struct edac_pci_ctl_info {
unsigned long start_time; /* edac_pci load start time (jiffies) */ unsigned long start_time; /* edac_pci load start time (jiffies) */
struct completion complete;
/* sysfs top name under 'edac' directory /* sysfs top name under 'edac' directory
* and instance name: * and instance name:
* cpu/cpu0/... * cpu/cpu0/...
......
...@@ -54,7 +54,7 @@ static int highbank_l2_err_probe(struct platform_device *pdev) ...@@ -54,7 +54,7 @@ static int highbank_l2_err_probe(struct platform_device *pdev)
int res = 0; int res = 0;
dci = edac_device_alloc_ctl_info(sizeof(*drvdata), "cpu", dci = edac_device_alloc_ctl_info(sizeof(*drvdata), "cpu",
1, "L", 1, 2, NULL, 0, 0); 1, "L", 1, 2, 0);
if (!dci) if (!dci)
return -ENOMEM; return -ENOMEM;
......
...@@ -496,7 +496,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op) ...@@ -496,7 +496,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
return -ENOMEM; return -ENOMEM;
edac_dev = edac_device_alloc_ctl_info(sizeof(*pdata), edac_dev = edac_device_alloc_ctl_info(sizeof(*pdata),
"cpu", 1, "L", 1, 2, NULL, 0, "cpu", 1, "L", 1, 2,
edac_dev_idx); edac_dev_idx);
if (!edac_dev) { if (!edac_dev) {
devres_release_group(&op->dev, mpc85xx_l2_err_probe); devres_release_group(&op->dev, mpc85xx_l2_err_probe);
......
...@@ -138,7 +138,7 @@ static int octeon_l2c_probe(struct platform_device *pdev) ...@@ -138,7 +138,7 @@ static int octeon_l2c_probe(struct platform_device *pdev)
/* 'Tags' are block 0, 'Data' is block 1*/ /* 'Tags' are block 0, 'Data' is block 1*/
l2c = edac_device_alloc_ctl_info(0, "l2c", num_tads, "l2c", 2, 0, l2c = edac_device_alloc_ctl_info(0, "l2c", num_tads, "l2c", 2, 0,
NULL, 0, edac_device_alloc_index()); edac_device_alloc_index());
if (!l2c) if (!l2c)
return -ENOMEM; return -ENOMEM;
......
...@@ -92,7 +92,7 @@ static int co_cache_error_probe(struct platform_device *pdev) ...@@ -92,7 +92,7 @@ static int co_cache_error_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, p); platform_set_drvdata(pdev, p);
p->ed = edac_device_alloc_ctl_info(0, "cpu", num_possible_cpus(), p->ed = edac_device_alloc_ctl_info(0, "cpu", num_possible_cpus(),
"cache", 2, 0, NULL, 0, "cache", 2, 0,
edac_device_alloc_index()); edac_device_alloc_index());
if (!p->ed) if (!p->ed)
goto err; goto err;
......
...@@ -349,7 +349,6 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev) ...@@ -349,7 +349,6 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev)
/* Allocate edac control info */ /* Allocate edac control info */
edev_ctl = edac_device_alloc_ctl_info(0, "qcom-llcc", 1, "bank", edev_ctl = edac_device_alloc_ctl_info(0, "qcom-llcc", 1, "bank",
llcc_driv_data->num_banks, 1, llcc_driv_data->num_banks, 1,
NULL, 0,
edac_device_alloc_index()); edac_device_alloc_index());
if (!edev_ctl) if (!edev_ctl)
......
...@@ -52,8 +52,7 @@ static int ecc_register(struct platform_device *pdev) ...@@ -52,8 +52,7 @@ static int ecc_register(struct platform_device *pdev)
platform_set_drvdata(pdev, p); platform_set_drvdata(pdev, p);
p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc", p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc",
1, 1, NULL, 0, 1, 1, edac_device_alloc_index());
edac_device_alloc_index());
if (!p->dci) if (!p->dci)
return -ENOMEM; return -ENOMEM;
......
...@@ -648,7 +648,7 @@ int skx_mce_check_error(struct notifier_block *nb, unsigned long val, ...@@ -648,7 +648,7 @@ int skx_mce_check_error(struct notifier_block *nb, unsigned long val,
memset(&res, 0, sizeof(res)); memset(&res, 0, sizeof(res));
res.mce = mce; res.mce = mce;
res.addr = mce->addr & MCI_ADDR_PHYSADDR; res.addr = mce->addr & MCI_ADDR_PHYSADDR;
if (!pfn_to_online_page(res.addr >> PAGE_SHIFT)) { if (!pfn_to_online_page(res.addr >> PAGE_SHIFT) && !arch_is_platform_page(res.addr)) {
pr_err("Invalid address 0x%llx in IA32_MC%d_ADDR\n", mce->addr, mce->bank); pr_err("Invalid address 0x%llx in IA32_MC%d_ADDR\n", mce->addr, mce->bank);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
...@@ -1365,8 +1365,7 @@ static int thunderx_ocx_probe(struct pci_dev *pdev, ...@@ -1365,8 +1365,7 @@ static int thunderx_ocx_probe(struct pci_dev *pdev,
idx = edac_device_alloc_index(); idx = edac_device_alloc_index();
snprintf(name, sizeof(name), "OCX%d", idx); snprintf(name, sizeof(name), "OCX%d", idx);
edac_dev = edac_device_alloc_ctl_info(sizeof(struct thunderx_ocx), edac_dev = edac_device_alloc_ctl_info(sizeof(struct thunderx_ocx),
name, 1, "CCPI", 1, name, 1, "CCPI", 1, 0, idx);
0, NULL, 0, idx);
if (!edac_dev) { if (!edac_dev) {
dev_err(&pdev->dev, "Cannot allocate EDAC device\n"); dev_err(&pdev->dev, "Cannot allocate EDAC device\n");
return -ENOMEM; return -ENOMEM;
...@@ -2004,8 +2003,7 @@ static int thunderx_l2c_probe(struct pci_dev *pdev, ...@@ -2004,8 +2003,7 @@ static int thunderx_l2c_probe(struct pci_dev *pdev,
snprintf(name, sizeof(name), fmt, idx); snprintf(name, sizeof(name), fmt, idx);
edac_dev = edac_device_alloc_ctl_info(sizeof(struct thunderx_l2c), edac_dev = edac_device_alloc_ctl_info(sizeof(struct thunderx_l2c),
name, 1, "L2C", 1, 0, name, 1, "L2C", 1, 0, idx);
NULL, 0, idx);
if (!edac_dev) { if (!edac_dev) {
dev_err(&pdev->dev, "Cannot allocate EDAC device\n"); dev_err(&pdev->dev, "Cannot allocate EDAC device\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -913,8 +913,8 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np, ...@@ -913,8 +913,8 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np,
snprintf(edac_name, sizeof(edac_name), "l2c%d", pmd); snprintf(edac_name, sizeof(edac_name), "l2c%d", pmd);
edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx), edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
edac_name, 1, "l2c", 1, 2, NULL, edac_name, 1, "l2c", 1, 2,
0, edac_device_alloc_index()); edac_device_alloc_index());
if (!edac_dev) { if (!edac_dev) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_group; goto err_group;
...@@ -1208,8 +1208,7 @@ static int xgene_edac_l3_add(struct xgene_edac *edac, struct device_node *np, ...@@ -1208,8 +1208,7 @@ static int xgene_edac_l3_add(struct xgene_edac *edac, struct device_node *np,
edac_idx = edac_device_alloc_index(); edac_idx = edac_device_alloc_index();
edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx), edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
"l3c", 1, "l3c", 1, 0, NULL, 0, "l3c", 1, "l3c", 1, 0, edac_idx);
edac_idx);
if (!edac_dev) { if (!edac_dev) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_release_group; goto err_release_group;
...@@ -1748,8 +1747,7 @@ static int xgene_edac_soc_add(struct xgene_edac *edac, struct device_node *np, ...@@ -1748,8 +1747,7 @@ static int xgene_edac_soc_add(struct xgene_edac *edac, struct device_node *np,
edac_idx = edac_device_alloc_index(); edac_idx = edac_device_alloc_index();
edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx), edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
"SOC", 1, "SOC", 1, 2, NULL, 0, "SOC", 1, "SOC", 1, 2, edac_idx);
edac_idx);
if (!edac_dev) { if (!edac_dev) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_release_group; goto err_release_group;
......
...@@ -381,7 +381,7 @@ static int edac_probe(struct platform_device *pdev) ...@@ -381,7 +381,7 @@ static int edac_probe(struct platform_device *pdev)
} }
dci = edac_device_alloc_ctl_info(sizeof(*priv), ZYNQMP_OCM_EDAC_STRING, dci = edac_device_alloc_ctl_info(sizeof(*priv), ZYNQMP_OCM_EDAC_STRING,
1, ZYNQMP_OCM_EDAC_STRING, 1, 0, NULL, 0, 1, ZYNQMP_OCM_EDAC_STRING, 1, 0,
edac_device_alloc_index()); edac_device_alloc_index());
if (!dci) if (!dci)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment