[PATCH v2 16/45] disk: Rename block functions

Simon Glass sjg at chromium.org
Thu Oct 13 14:28:58 CEST 2022


Use the uclass type as the first part of the function name, to be
consistent with the methods in other block drivers.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Add new patch to rename block functions

 disk/disk-uclass.c        | 24 ++++++++++++------------
 include/part.h            | 12 ++++++------
 lib/efi_loader/efi_disk.c |  6 ++++--
 3 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/disk/disk-uclass.c b/disk/disk-uclass.c
index 551f8b1dca4..3bfb828044c 100644
--- a/disk/disk-uclass.c
+++ b/disk/disk-uclass.c
@@ -65,7 +65,7 @@ int part_create_block_devices(struct udevice *blk_dev)
 	return 0;
 }
 
-static ulong blk_part_read(struct udevice *dev, lbaint_t start,
+static ulong part_blk_read(struct udevice *dev, lbaint_t start,
 			   lbaint_t blkcnt, void *buffer)
 {
 	struct udevice *parent;
@@ -88,7 +88,7 @@ static ulong blk_part_read(struct udevice *dev, lbaint_t start,
 	return ops->read(parent, start, blkcnt, buffer);
 }
 
-static ulong blk_part_write(struct udevice *dev, lbaint_t start,
+static ulong part_blk_write(struct udevice *dev, lbaint_t start,
 			    lbaint_t blkcnt, const void *buffer)
 {
 	struct udevice *parent;
@@ -111,7 +111,7 @@ static ulong blk_part_write(struct udevice *dev, lbaint_t start,
 	return ops->write(parent, start, blkcnt, buffer);
 }
 
-static ulong blk_part_erase(struct udevice *dev, lbaint_t start,
+static ulong part_blk_erase(struct udevice *dev, lbaint_t start,
 			    lbaint_t blkcnt)
 {
 	struct udevice *parent;
@@ -135,9 +135,9 @@ static ulong blk_part_erase(struct udevice *dev, lbaint_t start,
 }
 
 static const struct blk_ops blk_part_ops = {
-	.read	= blk_part_read,
-	.write	= blk_part_write,
-	.erase	= blk_part_erase,
+	.read	= part_blk_read,
+	.write	= part_blk_write,
+	.erase	= part_blk_erase,
 };
 
 U_BOOT_DRIVER(blk_partition) = {
@@ -168,8 +168,8 @@ static struct blk_desc *dev_get_blk(struct udevice *dev)
 	return block_dev;
 }
 
-unsigned long dev_read(struct udevice *dev, lbaint_t start,
-		       lbaint_t blkcnt, void *buffer)
+unsigned long disk_blk_read(struct udevice *dev, lbaint_t start,
+			    lbaint_t blkcnt, void *buffer)
 {
 	struct blk_desc *block_dev;
 	const struct blk_ops *ops;
@@ -202,8 +202,8 @@ unsigned long dev_read(struct udevice *dev, lbaint_t start,
 	return blks_read;
 }
 
-unsigned long dev_write(struct udevice *dev, lbaint_t start,
-			lbaint_t blkcnt, const void *buffer)
+unsigned long disk_blk_write(struct udevice *dev, lbaint_t start,
+			     lbaint_t blkcnt, const void *buffer)
 {
 	struct blk_desc *block_dev;
 	const struct blk_ops *ops;
@@ -221,8 +221,8 @@ unsigned long dev_write(struct udevice *dev, lbaint_t start,
 	return ops->write(dev, start, blkcnt, buffer);
 }
 
-unsigned long dev_erase(struct udevice *dev, lbaint_t start,
-			lbaint_t blkcnt)
+unsigned long disk_blk_erase(struct udevice *dev, lbaint_t start,
+			     lbaint_t blkcnt)
 {
 	struct blk_desc *block_dev;
 	const struct blk_ops *ops;
diff --git a/include/part.h b/include/part.h
index 6f604e7315a..e482618e330 100644
--- a/include/part.h
+++ b/include/part.h
@@ -313,12 +313,12 @@ struct udevice;
  */
 int part_create_block_devices(struct udevice *blk_dev);
 
-unsigned long dev_read(struct udevice *dev, lbaint_t start,
-		       lbaint_t blkcnt, void *buffer);
-unsigned long dev_write(struct udevice *dev, lbaint_t start,
-			lbaint_t blkcnt, const void *buffer);
-unsigned long dev_erase(struct udevice *dev, lbaint_t start,
-			lbaint_t blkcnt);
+unsigned long disk_blk_read(struct udevice *dev, lbaint_t start,
+			    lbaint_t blkcnt, void *buffer);
+unsigned long disk_blk_write(struct udevice *dev, lbaint_t start,
+			     lbaint_t blkcnt, const void *buffer);
+unsigned long disk_blk_erase(struct udevice *dev, lbaint_t start,
+			     lbaint_t blkcnt);
 
 /*
  * We don't support printing partition information in SPL and only support
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index cef4e45124e..f11722db2ce 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -123,9 +123,11 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this,
 	if (CONFIG_IS_ENABLED(PARTITIONS) &&
 	    device_get_uclass_id(diskobj->header.dev) == UCLASS_PARTITION) {
 		if (direction == EFI_DISK_READ)
-			n = dev_read(diskobj->header.dev, lba, blocks, buffer);
+			n = disk_blk_read(diskobj->header.dev, lba, blocks,
+					  buffer);
 		else
-			n = dev_write(diskobj->header.dev, lba, blocks, buffer);
+			n = disk_blk_write(diskobj->header.dev, lba, blocks,
+					   buffer);
 	} else {
 		/* dev is a block device (UCLASS_BLK) */
 		struct blk_desc *desc;
-- 
2.38.0.rc1.362.ged0d419d3c-goog



More information about the U-Boot mailing list