part: eliminate part_get_info_by_name_type()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 16 Jul 2023 11:34:44 +0000 (13:34 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 25 Jul 2023 16:44:46 +0000 (12:44 -0400)
Since commit 56670d6fb83f ("disk: part: use common api to lookup part
driver") part_get_info_by_name_type() ignores the part_type parameter
used to restrict the partition table type.

omap_mmc_get_part_size() and part_get_info_by_name() are the only
consumers.

omap_mmc_get_part_size() calls with part_type = PART_TYPE_EFI because at
the time of implementation a speed up could be gained by passing the
partition table type. After 5 years experience without this restriction
it looks safe to keep it that way.

part_get_info_by_name() uses PART_TYPE_ALL.

Move the logic of part_get_info_by_name_type() to part_get_info_by_name()
and replace the function in omap_mmc_get_part_size().

Fixes: 56670d6fb83f ("disk: part: use common api to lookup part driver")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/mach-omap2/utils.c
disk/part.c
include/part.h

index 6e6791f..7d93872 100644 (file)
@@ -100,8 +100,7 @@ static u32 omap_mmc_get_part_size(const char *part)
                return 0;
        }
 
-       /* Check only for EFI (GPT) partition table */
-       res = part_get_info_by_name_type(dev_desc, part, &info, PART_TYPE_EFI);
+       res = part_get_info_by_name(dev_desc, part, &info);
        if (res < 0)
                return 0;
 
index 0a03b82..186ee96 100644 (file)
@@ -670,8 +670,8 @@ cleanup:
        return ret;
 }
 
-int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
-                              struct disk_partition *info, int part_type)
+int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
+                         struct disk_partition *info)
 {
        struct part_driver *part_drv;
        int ret;
@@ -702,12 +702,6 @@ int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
        return -ENOENT;
 }
 
-int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
-                         struct disk_partition *info)
-{
-       return part_get_info_by_name_type(dev_desc, name, info, PART_TYPE_ALL);
-}
-
 /**
  * Get partition info from device number and partition name.
  *
index b19b33a..edc46f8 100644 (file)
@@ -202,21 +202,6 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
                            struct disk_partition *info, int allow_whole_dev);
 
 /**
- * part_get_info_by_name_type() - Search for a partition by name
- *                                for only specified partition type
- *
- * @param dev_desc - block device descriptor
- * @param gpt_name - the specified table entry name
- * @param info - returns the disk partition info
- * @param part_type - only search in partitions of this type
- *
- * Return: - the partition number on match (starting on 1), -1 on no match,
- * otherwise error
- */
-int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
-                              struct disk_partition *info, int part_type);
-
-/**
  * part_get_info_by_name() - Search for a partition by name
  *                           among all available registered partitions
  *
@@ -293,14 +278,6 @@ static inline int blk_get_device_part_str(const char *ifname,
                                          int allow_whole_dev)
 { *dev_desc = NULL; return -1; }
 
-static inline int part_get_info_by_name_type(struct blk_desc *dev_desc,
-                                            const char *name,
-                                            struct disk_partition *info,
-                                            int part_type)
-{
-       return -ENOENT;
-}
-
 static inline int part_get_info_by_name(struct blk_desc *dev_desc,
                                        const char *name,
                                        struct disk_partition *info)