1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

dm: part: Convert partition API use to linker lists

We can use linker lists instead of explicitly declaring each function.
This makes the code shorter by avoiding switch() statements and lots of
header file declarations.

While this does clean up the code it introduces a few code issues with SPL.
SPL never needs to print partition information since this all happens from
commands. SPL mostly doesn't need to obtain information about a partition
either, except in a few cases. Add these cases so that the code will be
dropped from each partition driver when not needed. This avoids code bloat.

I think this is still a win, since it is not a bad thing to be explicit
about which features are used in SPL. But others may like to weigh in.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
Simon Glass
2016-02-29 15:25:47 -07:00
parent 14142811f4
commit 96e5b03c8a
7 changed files with 162 additions and 173 deletions

View File

@@ -207,7 +207,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
* Test if the given partition has an Amiga partition table/Rigid
* Disk block
*/
int test_part_amiga(struct blk_desc *dev_desc)
static int test_part_amiga(struct blk_desc *dev_desc)
{
struct rigid_disk_block *rdb;
struct bootcode_block *bootcode;
@@ -291,8 +291,8 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc,
/*
* Get info about a partition
*/
int get_partition_info_amiga(struct blk_desc *dev_desc, int part,
disk_partition_t *info)
static int get_partition_info_amiga(struct blk_desc *dev_desc, int part,
disk_partition_t *info)
{
struct partition_block *p = find_partition(dev_desc, part-1);
struct amiga_part_geometry *g;
@@ -319,7 +319,7 @@ int get_partition_info_amiga(struct blk_desc *dev_desc, int part,
return 0;
}
void print_part_amiga(struct blk_desc *dev_desc)
static void print_part_amiga(struct blk_desc *dev_desc)
{
struct rigid_disk_block *rdb;
struct bootcode_block *boot;
@@ -379,4 +379,12 @@ void print_part_amiga(struct blk_desc *dev_desc)
}
}
U_BOOT_PART_TYPE(amiga) = {
.name = "AMIGA",
.part_type = PART_TYPE_AMIGA,
.get_info = get_partition_info_amiga,
.print = print_part_amiga,
.test = test_part_amiga,
};
#endif