* [PATCH 1/1] part: eliminate part_get_info_by_name_type()
@ 2023-07-16 11:34 Heinrich Schuchardt
2023-07-19 1:08 ` Simon Glass
2023-07-25 21:13 ` Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-07-16 11:34 UTC (permalink / raw)
To: Tom Rini
Cc: Simon Glass, Stefan Herbrechtsmeier, Heiko Schocher,
Tobias Waldekranz, Kever Yang, u-boot, Andrew F . Davis,
Heinrich Schuchardt
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>
---
arch/arm/mach-omap2/utils.c | 3 +--
disk/part.c | 10 ++--------
include/part.h | 23 -----------------------
3 files changed, 3 insertions(+), 33 deletions(-)
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 6e6791fc65..7d938724f8 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -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;
diff --git a/disk/part.c b/disk/part.c
index 35300df590..aeb4bf3b68 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -630,8 +630,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;
@@ -662,12 +662,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.
*
diff --git a/include/part.h b/include/part.h
index be75c73549..29bdeeeccc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -184,21 +184,6 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
struct blk_desc **dev_desc,
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
@@ -276,14 +261,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)
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] part: eliminate part_get_info_by_name_type()
2023-07-16 11:34 [PATCH 1/1] part: eliminate part_get_info_by_name_type() Heinrich Schuchardt
@ 2023-07-19 1:08 ` Simon Glass
2023-07-19 2:17 ` Heinrich Schuchardt
2023-07-25 21:13 ` Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2023-07-19 1:08 UTC (permalink / raw)
To: Heinrich Schuchardt
Cc: Tom Rini, Stefan Herbrechtsmeier, Heiko Schocher,
Tobias Waldekranz, Kever Yang, u-boot, Andrew F . Davis
Hi Heinrich,
On Sun, 16 Jul 2023 at 05:34, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> 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>
> ---
> arch/arm/mach-omap2/utils.c | 3 +--
> disk/part.c | 10 ++--------
> include/part.h | 23 -----------------------
> 3 files changed, 3 insertions(+), 33 deletions(-)
That explains the strange behaviour I saw when fiddling with this a
month or so back, thanks.
Reviewed-by: Simon Glass <sjg@chromium.org>
Is there a test to update for this?
Regards,
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] part: eliminate part_get_info_by_name_type()
2023-07-19 1:08 ` Simon Glass
@ 2023-07-19 2:17 ` Heinrich Schuchardt
0 siblings, 0 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-07-19 2:17 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Stefan Herbrechtsmeier, Heiko Schocher,
Tobias Waldekranz, Kever Yang, u-boot, Andrew F . Davis
On 7/19/23 03:08, Simon Glass wrote:
> Hi Heinrich,
>
> On Sun, 16 Jul 2023 at 05:34, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> 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>
>> ---
>> arch/arm/mach-omap2/utils.c | 3 +--
>> disk/part.c | 10 ++--------
>> include/part.h | 23 -----------------------
>> 3 files changed, 3 insertions(+), 33 deletions(-)
>
> That explains the strange behaviour I saw when fiddling with this a
> month or so back, thanks.
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Is there a test to update for this?
Thanks for reviewing.
As we don't change any existing behavior there is no test to update.
Best regards
Heinrich
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] part: eliminate part_get_info_by_name_type()
2023-07-16 11:34 [PATCH 1/1] part: eliminate part_get_info_by_name_type() Heinrich Schuchardt
2023-07-19 1:08 ` Simon Glass
@ 2023-07-25 21:13 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2023-07-25 21:13 UTC (permalink / raw)
To: Heinrich Schuchardt
Cc: Simon Glass, Stefan Herbrechtsmeier, Heiko Schocher,
Tobias Waldekranz, Kever Yang, u-boot, Andrew F . Davis
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
On Sun, Jul 16, 2023 at 01:34:44PM +0200, Heinrich Schuchardt wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-25 21:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-16 11:34 [PATCH 1/1] part: eliminate part_get_info_by_name_type() Heinrich Schuchardt
2023-07-19 1:08 ` Simon Glass
2023-07-19 2:17 ` Heinrich Schuchardt
2023-07-25 21:13 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox