Commit 48bc8869 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Borislav Petkov (AMD)
Browse files

EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info()



Dynamic attributes are not passed from any caller of
edac_device_alloc_ctl_info(). Drop this unused/untested functionality
completely.

Signed-off-by: default avatarJiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240213112051.27715-5-jirislaby@kernel.org


Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
parent 9186695e
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -737,8 +737,7 @@ static int altr_edac_device_probe(struct platform_device *pdev)
	}

	dci = edac_device_alloc_ctl_info(sizeof(*drvdata), ecc_name,
					 1, ecc_name, 1, 0, NULL, 0,
					 dev_instance++);
					 1, ecc_name, 1, 0, dev_instance++);

	if (!dci) {
		edac_printk(KERN_ERR, EDAC_DEVICE,
@@ -1514,7 +1513,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
	/* Create the PortB EDAC device */
	edac_idx = edac_device_alloc_index();
	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) {
		edac_printk(KERN_ERR, EDAC_DEVICE,
			    "%s: Unable to allocate PortB EDAC device\n",
@@ -1921,8 +1920,7 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac,

	edac_idx = edac_device_alloc_index();
	dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name,
					 1, ecc_name, 1, 0, NULL, 0,
					 edac_idx);
					 1, ecc_name, 1, 0, edac_idx);

	if (!dci) {
		edac_printk(KERN_ERR, EDAC_DEVICE,
+1 −2
Original line number Diff line number Diff line
@@ -366,8 +366,7 @@ static int amd8111_dev_probe(struct pci_dev *dev,
	dev_info->edac_idx = edac_device_alloc_index();
	dev_info->edac_dev =
		edac_device_alloc_ctl_info(0, dev_info->ctl_name, 1,
					   NULL, 0, 0,
					   NULL, 0, dev_info->edac_idx);
					   NULL, 0, 0, dev_info->edac_idx);
	if (!dev_info->edac_dev) {
		ret = -ENOMEM;
		goto err_dev_put;
+1 −1
Original line number Diff line number Diff line
@@ -523,7 +523,7 @@ static int aurora_l2_probe(struct platform_device *pdev)
		dev_warn(&pdev->dev, "data ECC is not enabled\n");

	dci = edac_device_alloc_ctl_info(sizeof(*drvdata),
					 "cpu", 1, "L", 1, 2, NULL, 0, 0);
					 "cpu", 1, "L", 1, 2, 0);
	if (!dci)
		return -ENOMEM;

+1 −1
Original line number Diff line number Diff line
@@ -797,7 +797,7 @@ static void cpc925_add_edac_devices(void __iomem *vbase)
		dev_info->edac_idx = edac_device_alloc_index();
		dev_info->edac_dev =
			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) {
			cpc925_printk(KERN_ERR, "No memory for edac device\n");
			goto err1;
+2 −48
Original line number Diff line number Diff line
@@ -56,14 +56,12 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
struct edac_device_ctl_info *
edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instances,
			   char *blk_name, unsigned nr_blocks, unsigned off_val,
			   struct edac_dev_sysfs_block_attribute *attrib_spec,
			   unsigned nr_attrib, int device_index)
			   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_instance *dev_inst, *inst;
	struct edac_device_ctl_info *dev_ctl;
	unsigned instance, block, attr;
	unsigned instance, block;
	void *pvt;
	int err;

@@ -85,15 +83,6 @@ edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instance

	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) {
		pvt = kzalloc(pvt_sz, GFP_KERNEL);
		if (!pvt)
@@ -132,41 +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",
				 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;

				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
					);
			}
		}
	}

Loading