Skip to contentSkip to conversation

blk: Make use of CONFIG_HAVE_BLOCK_DEVICE more

PATCH Superseded Tom Rini 1 participant 2 messages Dec 2, 2019 – Dec 4, 2019 Block layer

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH v2 1/1 blk: Make use of CONFIG_HAVE_BLOCK_DEVICE more

When we do not have CONFIG_BLK (or SPL/TPL) enabled there are very few cases where we need the blk_legacy code linked in. To catch these, build when we have CONFIG_HAVE_BLOCK_DEVICE set. In addition, we only need cmd/blk_common.o to be linked in when we have CONFIG_HAVE_BLOCK_DEVICE set, so make use of that directly.

---
Changes in v2:
- Reword commit message and make blk_legacy.o also use CONFIG_HAVE_BLOCK_DEVICE rather than CONFIG_PARTITIONS as it is more direct.

---
 cmd/Makefile           | 2 +-
 cmd/blk_common.c       | 2 --
 drivers/block/Makefile | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)
cmd/Makefile +1 -1
index 2d723ea0f07d..f823d16755e6 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_CMD_AES) += aes.o
 obj-$(CONFIG_CMD_AB_SELECT) += ab_select.o
 obj-$(CONFIG_CMD_ADC) += adc.o
 obj-$(CONFIG_CMD_ARMFLASH) += armflash.o
-obj-y += blk_common.o
+obj-$(CONFIG_HAVE_BLOCK_DEVICE) += blk_common.o
 obj-$(CONFIG_CMD_SOURCE) += source.o
 obj-$(CONFIG_CMD_BCB) += bcb.o
 obj-$(CONFIG_CMD_BDI) += bdinfo.o
cmd/blk_common.c +0 -2
index cee25a0d4100..c5514cf8f8e8 100644
@@ -11,7 +11,6 @@
 #include <common.h>
 #include <blk.h>
 
-#ifdef CONFIG_HAVE_BLOCK_DEVICE
 int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
 		   int *cur_devnump)
 {
@@ -96,4 +95,3 @@ int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
 		}
 	}
 }
-#endif
drivers/block/Makefile +1 -1
index 3feb0aa997df..94ab5c6f906e 100644
@@ -6,7 +6,7 @@
 obj-$(CONFIG_$(SPL_)BLK) += blk-uclass.o
 
 ifndef CONFIG_$(SPL_)BLK
-obj-y += blk_legacy.o
+obj-$(CONFIG_HAVE_BLOCK_DEVICE) += blk_legacy.o
 endif
 
 ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 1/1 blk: Make use of CONFIG_HAVE_BLOCK_DEVICE more

Quoted 7 lines · Tom Rini

When we do not have CONFIG_BLK (or SPL/TPL) enabled there are very few cases where we need the blk_legacy code linked in. To catch these, build when we have CONFIG_HAVE_BLOCK_DEVICE set. In addition, we only need cmd/blk_common.o to be linked in when we have CONFIG_HAVE_BLOCK_DEVICE set, so make use of that directly.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/28748c0f/attachment.sig>