aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Meng2018-10-15 04:21:07 -0500
committerSimon Glass2018-11-14 11:16:27 -0600
commitd0851c8937067ad396f2bdafc46d0326bf3317db (patch)
treeac5d2b7aa32a96f248b61b5559aa3e7fc961e951 /drivers
parentf26ce03b444ac97448eca0cc58071f5fa8ffc3bd (diff)
downloadu-boot-d0851c8937067ad396f2bdafc46d0326bf3317db.tar.gz
u-boot-d0851c8937067ad396f2bdafc46d0326bf3317db.tar.xz
u-boot-d0851c8937067ad396f2bdafc46d0326bf3317db.zip
blk: Call part_init() in the post_probe() method
part_init() is currently called in every DM BLK driver, either in its bind() or probe() method. However we can use the BLK uclass driver's post_probe() method to do it automatically. Update all DM BLK drivers to adopt this change. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/blk-uclass.c12
-rw-r--r--drivers/block/ide.c2
-rw-r--r--drivers/block/sandbox.c2
-rw-r--r--drivers/mmc/mmc.c3
-rw-r--r--drivers/nvme/nvme.c1
-rw-r--r--drivers/scsi/scsi.c1
6 files changed, 13 insertions, 8 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index facf52711c..95e7b540a5 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -644,8 +644,20 @@ int blk_unbind_all(int if_type)
644 return 0; 644 return 0;
645} 645}
646 646
647static int blk_post_probe(struct udevice *dev)
648{
649#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
650 struct blk_desc *desc = dev_get_uclass_platdata(dev);
651
652 part_init(desc);
653#endif
654
655 return 0;
656}
657
647UCLASS_DRIVER(blk) = { 658UCLASS_DRIVER(blk) = {
648 .id = UCLASS_BLK, 659 .id = UCLASS_BLK,
649 .name = "blk", 660 .name = "blk",
661 .post_probe = blk_post_probe,
650 .per_device_platdata_auto_alloc_size = sizeof(struct blk_desc), 662 .per_device_platdata_auto_alloc_size = sizeof(struct blk_desc),
651}; 663};
diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index 38adb6a241..4b8a4eac17 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -1169,8 +1169,6 @@ static int ide_blk_probe(struct udevice *udev)
1169 BLK_REV_SIZE); 1169 BLK_REV_SIZE);
1170 desc->revision[BLK_REV_SIZE] = '\0'; 1170 desc->revision[BLK_REV_SIZE] = '\0';
1171 1171
1172 part_init(desc);
1173
1174 return 0; 1172 return 0;
1175} 1173}
1176 1174
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c
index 576d049df7..d3b1aaaba3 100644
--- a/drivers/block/sandbox.c
+++ b/drivers/block/sandbox.c
@@ -142,7 +142,7 @@ int host_dev_bind(int devnum, char *filename)
142 goto err_file; 142 goto err_file;
143 } 143 }
144 144
145 return blk_prepare_device(dev); 145 return 0;
146err_file: 146err_file:
147 os_close(fd); 147 os_close(fd);
148err: 148err:
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 585951cd78..d6b9cdc992 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -2444,9 +2444,6 @@ static int mmc_startup(struct mmc *mmc)
2444 bdesc->product[0] = 0; 2444 bdesc->product[0] = 0;
2445 bdesc->revision[0] = 0; 2445 bdesc->revision[0] = 0;
2446#endif 2446#endif
2447#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
2448 part_init(bdesc);
2449#endif
2450 2447
2451 return 0; 2448 return 0;
2452} 2449}
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index eb6fdeda50..1ee0a0aefb 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -664,7 +664,6 @@ static int nvme_blk_probe(struct udevice *udev)
664 sprintf(desc->vendor, "0x%.4x", pplat->vendor); 664 sprintf(desc->vendor, "0x%.4x", pplat->vendor);
665 memcpy(desc->product, ndev->serial, sizeof(ndev->serial)); 665 memcpy(desc->product, ndev->serial, sizeof(ndev->serial));
666 memcpy(desc->revision, ndev->firmware_rev, sizeof(ndev->firmware_rev)); 666 memcpy(desc->revision, ndev->firmware_rev, sizeof(ndev->firmware_rev));
667 part_init(desc);
668 667
669 return 0; 668 return 0;
670} 669}
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index bc6ac8cd32..df47e2fc78 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -592,7 +592,6 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
592 memcpy(&bdesc->vendor, &bd.vendor, sizeof(bd.vendor)); 592 memcpy(&bdesc->vendor, &bd.vendor, sizeof(bd.vendor));
593 memcpy(&bdesc->product, &bd.product, sizeof(bd.product)); 593 memcpy(&bdesc->product, &bd.product, sizeof(bd.product));
594 memcpy(&bdesc->revision, &bd.revision, sizeof(bd.revision)); 594 memcpy(&bdesc->revision, &bd.revision, sizeof(bd.revision));
595 part_init(bdesc);
596 595
597 if (verbose) { 596 if (verbose) {
598 printf(" Device %d: ", 0); 597 printf(" Device %d: ", 0);