EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Tue, 13 Feb 2024 11:20:48 +0000 (12:20 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 27 Mar 2024 17:26:58 +0000 (18:26 +0100)
Dynamic attributes are not passed from any caller of
edac_device_alloc_ctl_info(). Drop this unused/untested functionality
completely.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240213112051.27715-5-jirislaby@kernel.org
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
15 files changed:
drivers/edac/altera_edac.c
drivers/edac/amd8111_edac.c
drivers/edac/armada_xp_edac.c
drivers/edac/cpc925_edac.c
drivers/edac/edac_device.c
drivers/edac/edac_device.h
drivers/edac/highbank_l2_edac.c
drivers/edac/mpc85xx_edac.c
drivers/edac/octeon_edac-l2c.c
drivers/edac/octeon_edac-pc.c
drivers/edac/qcom_edac.c
drivers/edac/sifive_edac.c
drivers/edac/thunderx_edac.c
drivers/edac/xgene_edac.c
drivers/edac/zynqmp_edac.c

index ae17ce4d972267959d4e297756b3b8be3991d216..fe89f5c4837f49cc8a8bfca90aa19e9f81dcf658 100644 (file)
@@ -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,
index ca718f63fcbcdd4e96b46da6b498533e8e4ebecb..a6d3013d5823474559407f54d33ab3c49f067548 100644 (file)
@@ -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;
index 25517c99b3eaca603a3d80a27262168c6bb54923..589bc81f124902f0c9baca3281913c248e65f4f7 100644 (file)
@@ -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;
 
index 5075dc7526e3f8e35600c2dee6f0bf6ba120d04a..eb702bc3aa29a5ed205a322b9e23e88fddb1939c 100644 (file)
@@ -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;
index 8c2aa5bcf1b73e5d9ad0f3c8edacee8ea5be363e..621dc2a5d03474dada099b809b48561106d3c8b8 100644 (file)
@@ -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
-                                       );
-                       }
                }
        }
 
index a39752432c90f6eed418155c7bc524b530f8019d..55be019c12caae9ca451a7d0c0cbec42b4d86771 100644 (file)
@@ -208,7 +208,6 @@ struct edac_device_ctl_info {
        u32 nr_instances;
        struct edac_device_instance *instances;
        struct edac_device_block *blocks;
-       struct edac_dev_sysfs_block_attribute *attribs;
 
        /* Event counters for the this whole EDAC Device */
        struct edac_device_counter counters;
@@ -236,8 +235,6 @@ extern struct edac_device_ctl_info *edac_device_alloc_ctl_info(
                char *edac_device_name, unsigned nr_instances,
                char *edac_block_name, unsigned nr_blocks,
                unsigned offset_value,
-               struct edac_dev_sysfs_block_attribute *block_attributes,
-               unsigned nr_attribs,
                int device_index);
 
 /* The offset value can be:
@@ -347,7 +344,6 @@ static inline void __edac_device_free_ctl_info(struct edac_device_ctl_info *ci)
 {
        if (ci) {
                kfree(ci->pvt_info);
-               kfree(ci->attribs);
                kfree(ci->blocks);
                kfree(ci->instances);
                kfree(ci);
index 5646c049a93491eb10929b5508edaa26966e0417..282ca6535f8f63544427b8f6a0559a6488aa9402 100644 (file)
@@ -54,7 +54,7 @@ static int highbank_l2_err_probe(struct platform_device *pdev)
        int res = 0;
 
        dci = edac_device_alloc_ctl_info(sizeof(*drvdata), "cpu",
-               1, "L", 1, 2, NULL, 0, 0);
+                                        1, "L", 1, 2, 0);
        if (!dci)
                return -ENOMEM;
 
index c1bc53f4e184c80bf2ab8ab0aa66d228e6ad9766..e8945d4adbade90ea250fd98c64d14f8e2d8b9e7 100644 (file)
@@ -496,7 +496,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
                return -ENOMEM;
 
        edac_dev = edac_device_alloc_ctl_info(sizeof(*pdata),
-                                             "cpu", 1, "L", 1, 2, NULL, 0,
+                                             "cpu", 1, "L", 1, 2,
                                              edac_dev_idx);
        if (!edac_dev) {
                devres_release_group(&op->dev, mpc85xx_l2_err_probe);
index 4015eb9af6feb67014f9ce0b88bec723fe516799..919095d105285b848d471db7d60e848fe29e017c 100644 (file)
@@ -138,7 +138,7 @@ static int octeon_l2c_probe(struct platform_device *pdev)
 
        /* 'Tags' are block 0, 'Data' is block 1*/
        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)
                return -ENOMEM;
 
index ea8a8e337b1e89ceeb3662ae0f4cc5862474bbd7..b8404cc7b65f4ca1e681c1a8b03f8091babd158a 100644 (file)
@@ -92,7 +92,7 @@ static int co_cache_error_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, p);
 
        p->ed = edac_device_alloc_ctl_info(0, "cpu", num_possible_cpus(),
-                                          "cache", 2, 0, NULL, 0,
+                                          "cache", 2, 0,
                                           edac_device_alloc_index());
        if (!p->ed)
                goto err;
index 5539917c01ddbebfeca3e41dbf3c398181772f55..d3cd4cc54ace9d31e8af583e8e75bd6d3cf5d81b 100644 (file)
@@ -349,7 +349,6 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev)
        /* Allocate edac control info */
        edev_ctl = edac_device_alloc_ctl_info(0, "qcom-llcc", 1, "bank",
                                              llcc_driv_data->num_banks, 1,
-                                             NULL, 0,
                                              edac_device_alloc_index());
 
        if (!edev_ctl)
index b844e2626fd50686687af90c3af194ecde5a71f5..a2b193dc66043120df04972df32350f52e0df305 100644 (file)
@@ -52,8 +52,7 @@ static int ecc_register(struct platform_device *pdev)
        platform_set_drvdata(pdev, p);
 
        p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc",
-                                           1, 1, NULL, 0,
-                                           edac_device_alloc_index());
+                                           1, 1, edac_device_alloc_index());
        if (!p->dci)
                return -ENOMEM;
 
index 90d46e5c4ff069752e918de794194d4095986799..fab9891e569acaea14fad1dd9912f2fa59fd4633 100644 (file)
@@ -1365,8 +1365,7 @@ static int thunderx_ocx_probe(struct pci_dev *pdev,
        idx = edac_device_alloc_index();
        snprintf(name, sizeof(name), "OCX%d", idx);
        edac_dev = edac_device_alloc_ctl_info(sizeof(struct thunderx_ocx),
-                                             name, 1, "CCPI", 1,
-                                             0, NULL, 0, idx);
+                                             name, 1, "CCPI", 1, 0, idx);
        if (!edac_dev) {
                dev_err(&pdev->dev, "Cannot allocate EDAC device\n");
                return -ENOMEM;
@@ -2004,8 +2003,7 @@ static int thunderx_l2c_probe(struct pci_dev *pdev,
        snprintf(name, sizeof(name), fmt, idx);
 
        edac_dev = edac_device_alloc_ctl_info(sizeof(struct thunderx_l2c),
-                                             name, 1, "L2C", 1, 0,
-                                             NULL, 0, idx);
+                                             name, 1, "L2C", 1, 0, idx);
        if (!edac_dev) {
                dev_err(&pdev->dev, "Cannot allocate EDAC device\n");
                return -ENOMEM;
index 1b50f816001393a72af2087b9a59e8e25ab245dc..fd87f1b2c1453ea76c873e187d443c34d1e96038 100644 (file)
@@ -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);
        edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
-                                             edac_name, 1, "l2c", 1, 2, NULL,
-                                             0, edac_device_alloc_index());
+                                             edac_name, 1, "l2c", 1, 2,
+                                             edac_device_alloc_index());
        if (!edac_dev) {
                rc = -ENOMEM;
                goto err_group;
@@ -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_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
-                                             "l3c", 1, "l3c", 1, 0, NULL, 0,
-                                             edac_idx);
+                                             "l3c", 1, "l3c", 1, 0, edac_idx);
        if (!edac_dev) {
                rc = -ENOMEM;
                goto err_release_group;
@@ -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_dev = edac_device_alloc_ctl_info(sizeof(*ctx),
-                                             "SOC", 1, "SOC", 1, 2, NULL, 0,
-                                             edac_idx);
+                                             "SOC", 1, "SOC", 1, 2, edac_idx);
        if (!edac_dev) {
                rc = -ENOMEM;
                goto err_release_group;
index 2d9a5cfd89317a6feb80137b2f5917fba9c2d2e0..c9dc78d8c824f5314a85b5ae332f225f4712f613 100644 (file)
@@ -381,7 +381,7 @@ static int edac_probe(struct platform_device *pdev)
        }
 
        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());
        if (!dci)
                return -ENOMEM;