]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mtip32xx: remove the device_status debugfs file
authorChristoph Hellwig <hch@lst.de>
Sun, 19 Jun 2022 06:05:47 +0000 (08:05 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 28 Jun 2022 12:30:26 +0000 (06:30 -0600)
This file is a huge mess that iterates over all devices and is in the
way of fixing the device removal in this driver, so remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20220619060552.1850436-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/mtip32xx/mtip32xx.c
drivers/block/mtip32xx/mtip32xx.h

index 27386a572ba490c3417489e1d3fb279543fbaed3..4151c80f5bfcc3129a40edd9687ab713aceb78cf 100644 (file)
 /* Device instance number, incremented each time a device is probed. */
 static int instance;
 
-static LIST_HEAD(online_list);
-static LIST_HEAD(removing_list);
-static DEFINE_SPINLOCK(dev_lock);
-
 /*
  * Global variable used to hold the major block device number
  * allocated in mtip_init().
  */
 static int mtip_major;
 static struct dentry *dfs_parent;
-static struct dentry *dfs_device_status;
 
 static u32 cpu_use[NR_CPUS];
 
@@ -2170,106 +2165,6 @@ static const struct attribute_group *mtip_disk_attr_groups[] = {
        NULL,
 };
 
-/* debugsfs entries */
-
-static ssize_t show_device_status(struct device_driver *drv, char *buf)
-{
-       int size = 0;
-       struct driver_data *dd, *tmp;
-       unsigned long flags;
-       char id_buf[42];
-       u16 status = 0;
-
-       spin_lock_irqsave(&dev_lock, flags);
-       size += sprintf(&buf[size], "Devices Present:\n");
-       list_for_each_entry_safe(dd, tmp, &online_list, online_list) {
-               if (dd->pdev) {
-                       if (dd->port &&
-                           dd->port->identify &&
-                           dd->port->identify_valid) {
-                               strlcpy(id_buf,
-                                       (char *) (dd->port->identify + 10), 21);
-                               status = *(dd->port->identify + 141);
-                       } else {
-                               memset(id_buf, 0, 42);
-                               status = 0;
-                       }
-
-                       if (dd->port &&
-                           test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) {
-                               size += sprintf(&buf[size],
-                                       " device %s %s (ftl rebuild %d %%)\n",
-                                       dev_name(&dd->pdev->dev),
-                                       id_buf,
-                                       status);
-                       } else {
-                               size += sprintf(&buf[size],
-                                       " device %s %s\n",
-                                       dev_name(&dd->pdev->dev),
-                                       id_buf);
-                       }
-               }
-       }
-
-       size += sprintf(&buf[size], "Devices Being Removed:\n");
-       list_for_each_entry_safe(dd, tmp, &removing_list, remove_list) {
-               if (dd->pdev) {
-                       if (dd->port &&
-                           dd->port->identify &&
-                           dd->port->identify_valid) {
-                               strlcpy(id_buf,
-                                       (char *) (dd->port->identify+10), 21);
-                               status = *(dd->port->identify + 141);
-                       } else {
-                               memset(id_buf, 0, 42);
-                               status = 0;
-                       }
-
-                       if (dd->port &&
-                           test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) {
-                               size += sprintf(&buf[size],
-                                       " device %s %s (ftl rebuild %d %%)\n",
-                                       dev_name(&dd->pdev->dev),
-                                       id_buf,
-                                       status);
-                       } else {
-                               size += sprintf(&buf[size],
-                                       " device %s %s\n",
-                                       dev_name(&dd->pdev->dev),
-                                       id_buf);
-                       }
-               }
-       }
-       spin_unlock_irqrestore(&dev_lock, flags);
-
-       return size;
-}
-
-static ssize_t mtip_hw_read_device_status(struct file *f, char __user *ubuf,
-                                               size_t len, loff_t *offset)
-{
-       int size = *offset;
-       char *buf;
-       int rv = 0;
-
-       if (!len || *offset)
-               return 0;
-
-       buf = kzalloc(MTIP_DFS_MAX_BUF_SIZE, GFP_KERNEL);
-       if (!buf)
-               return -ENOMEM;
-
-       size += show_device_status(NULL, buf);
-
-       *offset = size <= len ? size : len;
-       size = copy_to_user(ubuf, buf, *offset);
-       if (size)
-               rv = -EFAULT;
-
-       kfree(buf);
-       return rv ? rv : *offset;
-}
-
 static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
                                  size_t len, loff_t *offset)
 {
@@ -2363,13 +2258,6 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
        return rv ? rv : *offset;
 }
 
-static const struct file_operations mtip_device_status_fops = {
-       .owner  = THIS_MODULE,
-       .open   = simple_open,
-       .read   = mtip_hw_read_device_status,
-       .llseek = no_llseek,
-};
-
 static const struct file_operations mtip_regs_fops = {
        .owner  = THIS_MODULE,
        .open   = simple_open,
@@ -3905,7 +3793,6 @@ static int mtip_pci_probe(struct pci_dev *pdev,
        const struct cpumask *node_mask;
        int cpu, i = 0, j = 0;
        int my_node = NUMA_NO_NODE;
-       unsigned long flags;
 
        /* Allocate memory for this devices private data. */
        my_node = pcibus_to_node(pdev->bus);
@@ -3952,9 +3839,6 @@ static int mtip_pci_probe(struct pci_dev *pdev,
        dd->pdev        = pdev;
        dd->numa_node   = my_node;
 
-       INIT_LIST_HEAD(&dd->online_list);
-       INIT_LIST_HEAD(&dd->remove_list);
-
        memset(dd->workq_name, 0, 32);
        snprintf(dd->workq_name, 31, "mtipq%d", dd->instance);
 
@@ -4047,11 +3931,6 @@ static int mtip_pci_probe(struct pci_dev *pdev,
        else
                rv = 0; /* device in rebuild state, return 0 from probe */
 
-       /* Add to online list even if in ftl rebuild */
-       spin_lock_irqsave(&dev_lock, flags);
-       list_add(&dd->online_list, &online_list);
-       spin_unlock_irqrestore(&dev_lock, flags);
-
        goto done;
 
 block_initialize_err:
@@ -4085,15 +3964,10 @@ done:
 static void mtip_pci_remove(struct pci_dev *pdev)
 {
        struct driver_data *dd = pci_get_drvdata(pdev);
-       unsigned long flags, to;
+       unsigned long to;
 
        set_bit(MTIP_DDF_REMOVAL_BIT, &dd->dd_flag);
 
-       spin_lock_irqsave(&dev_lock, flags);
-       list_del_init(&dd->online_list);
-       list_add(&dd->remove_list, &removing_list);
-       spin_unlock_irqrestore(&dev_lock, flags);
-
        mtip_check_surprise_removal(dd);
        synchronize_irq(dd->pdev->irq);
 
@@ -4124,10 +3998,6 @@ static void mtip_pci_remove(struct pci_dev *pdev)
 
        pci_disable_msi(pdev);
 
-       spin_lock_irqsave(&dev_lock, flags);
-       list_del_init(&dd->remove_list);
-       spin_unlock_irqrestore(&dev_lock, flags);
-
        kfree(dd);
 
        pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
@@ -4250,15 +4120,6 @@ static int __init mtip_init(void)
                pr_warn("Error creating debugfs parent\n");
                dfs_parent = NULL;
        }
-       if (dfs_parent) {
-               dfs_device_status = debugfs_create_file("device_status",
-                                       0444, dfs_parent, NULL,
-                                       &mtip_device_status_fops);
-               if (IS_ERR_OR_NULL(dfs_device_status)) {
-                       pr_err("Error creating device_status node\n");
-                       dfs_device_status = NULL;
-               }
-       }
 
        /* Register our PCI operations. */
        error = pci_register_driver(&mtip_pci_driver);
index 6816beb45352b8939159df74fd4b84f51d997b31..a80419c57bbe4de5c20a38a4392df40f76a93ed0 100644 (file)
@@ -462,10 +462,6 @@ struct driver_data {
 
        int isr_binding;
 
-       struct list_head online_list; /* linkage for online list */
-
-       struct list_head remove_list; /* linkage for removing list */
-
        int unal_qdepth; /* qdepth of unaligned IO queue */
 };