Skip to content

Commit

Permalink
blk: Rework guard around part_init call
Browse files Browse the repository at this point in the history
The function part_init() will only be built when we have both
CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE set.  Protect the call to
this function with both of these tests now.

Cc: Simon Glass <[email protected]>
Cc: Philipp Tomsich <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: York Sun <[email protected]>
Cc: Prabhakar Kushwaha <[email protected]>
Cc: Mingkai Hu <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Marek Behún <[email protected]>
Cc: Vanessa Maegima <[email protected]>
Cc: Eugen Hristev <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Tom Warren <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Vitaly Andrianov <[email protected]>
Signed-off-by: Tom Rini <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
trini committed Dec 12, 2018
1 parent b0b1768 commit 91ff686
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions common/spl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ config SPL_LIBCOMMON_SUPPORT

config SPL_LIBDISK_SUPPORT
bool "Support disk partitions"
select PARTITIONS
help
Enable support for disk partitions within SPL. 'Disk' is something
of a misnomer as it includes non-spinning media such as flash (as
Expand Down Expand Up @@ -480,6 +481,7 @@ config SPL_DM_MAILBOX
config SPL_MMC_SUPPORT
bool "Support MMC"
depends on MMC
select HAVE_BLOCK_DEVICE
help
Enable support for MMC (Multimedia Card) within SPL. This enables
the MMC protocol implementation and allows any enabled drivers to
Expand Down Expand Up @@ -754,6 +756,7 @@ config SPL_THERMAL

config SPL_USB_HOST_SUPPORT
bool "Support USB host drivers"
select HAVE_BLOCK_DEVICE
help
Enable access to USB (Universal Serial Bus) host devices so that
SPL can load U-Boot from a connected USB peripheral, such as a USB
Expand Down
1 change: 1 addition & 0 deletions configs/evb-rk3036_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CONFIG_SPL_PARTITION_UUIDS=y
CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
CONFIG_REGMAP=y
CONFIG_SYSCON=y
# CONFIG_SPL_BLK is not set
CONFIG_CLK=y
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=0
Expand Down
1 change: 1 addition & 0 deletions configs/kylin-rk3036_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
CONFIG_ENV_IS_IN_MMC=y
CONFIG_REGMAP=y
CONFIG_SYSCON=y
# CONFIG_SPL_BLK is not set
CONFIG_CLK=y
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=0
Expand Down
4 changes: 3 additions & 1 deletion doc/driver-model/MIGRATION.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ Deadline: 2019.07
In concert with maintainers migrating their block device usage to the
appropriate DM driver, CONFIG_BLK needs to be set as well. The final deadline
here coincides with the final deadline for migration of the various block
subsystems.
subsystems. At this point we will be able to audit and correct the logic in
Kconfig around using CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE and make
use of CONFIG_BLK / CONFIG_SPL_BLK as needed.

CONFIG_DM_SPI
CONFIG_DM_SPI_FLASH
Expand Down
3 changes: 1 addition & 2 deletions drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
obj-$(CONFIG_SPL_SATA_SUPPORT) += ata/ scsi/
obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/
obj-$(CONFIG_SPL_MMC_SUPPORT) += block/
obj-$(CONFIG_HAVE_BLOCK_DEVICE) += block/
obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/
obj-$(CONFIG_SPL_THERMAL) += thermal/

Expand Down
2 changes: 2 additions & 0 deletions drivers/block/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ifndef CONFIG_$(SPL_)BLK
obj-y += blk_legacy.o
endif

ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_IDE) += ide.o
endif
obj-$(CONFIG_SANDBOX) += sandbox.o
obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
2 changes: 1 addition & 1 deletion drivers/block/blk-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ int blk_unbind_all(int if_type)

static int blk_post_probe(struct udevice *dev)
{
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
struct blk_desc *desc = dev_get_uclass_platdata(dev);

part_init(desc);
Expand Down
4 changes: 3 additions & 1 deletion scripts/Makefile.spl
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/
else
libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
ifdef CONFIG_SPL_FRAMEWORK
libs-$(CONFIG_PARTITIONS) += disk/
endif
endif

libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
libs-y += drivers/
libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
libs-y += dts/
Expand Down

0 comments on commit 91ff686

Please sign in to comment.