Currently, block core has been supplied "disk_name_format()", so
we should remove duplicate function "rssd_disk_name_format()"
and use the new function to format rssd disk names.

Signed-off-by: Ren Mingxin <[email protected]>
---
 mtip32xx.c |   33 +--------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 8eb81c9..8950bb5 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2836,37 +2836,6 @@ static int mtip_hw_resume(struct driver_data *dd)
 }

 /*
- * Helper function for reusing disk name
- * upon hot insertion.
- */
-static int rssd_disk_name_format(char *prefix,
-                                int index,
-                                char *buf,
-                                int buflen)
-{
-       const int base = 'z' - 'a' + 1;
-       char *begin = buf + strlen(prefix);
-       char *end = buf + buflen;
-       char *p;
-       int unit;
-
-       p = end - 1;
-       *p = '\0';
-       unit = base;
-       do {
-               if (p == begin)
-                       return -EINVAL;
-               *--p = 'a' + (index % unit);
-               index = (index / unit) - 1;
-       } while (index >= 0);
-
-       memmove(begin, p, end - p);
-       memcpy(buf, prefix, strlen(prefix));
-
-       return 0;
-}
-
-/*
  * Block layer IOCTL handler.
  *
  * @dev Pointer to the block_device structure.
@@ -3140,7 +3109,7 @@ static int mtip_block_initialize(struct driver_data *dd)
        if (rv)
                goto ida_get_error;

-       rv = rssd_disk_name_format("rssd",
+       rv = disk_name_format("rssd",
                                index,
                                dd->disk->disk_name,
                                DISK_NAME_LEN);

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
  • [PATCH 0... Ren Mingxin
    • Re:... Michael S. Tsirkin
    • [PA... Ren Mingxin
    • [PA... Ren Mingxin
    • [PA... Ren Mingxin
      • ... Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2]
        • ... Ren Mingxin
    • [PA... Ren Mingxin
      • ... Asias He
        • ... Ren Mingxin
      • ... Tejun Heo
        • ... Tejun Heo
          • ... Ren Mingxin
            • ... Michael S. Tsirkin

Reply via email to