blk: Rationalise the block interface
Subsystems (9)
v4 cover blk: Rationalise the block interface
The block interface has two separate implementations, one using driver model and one not. The latter is really only needed for SPL, where size constraints allegedly don't allow use of driver model. Of course we still need space for filesystems and other code, so it isn't clear that driver model is anything more than the straw that breaks the camel's back.
The driver model version uses a uclass ID for the interface time, but converts back and forth between that and if_type, which is the legacy type.
The HAVE_BLOCK_DEVICE define is mostly a hangover from the old days. At present its main purpose is to enable the legacy block implementation in SPL.
Finally the use of 'select' to enable BLK does not work very well. It causes kconfig errors when another option depends on BLK and it is not recommended by the kconfig style guide.
This series aims to clean things up:
- Enable BLK based on whether different media types are used, but still allow boards to disable it
- Rename HAVE_BLOCK_DEVICE to indicates its real purpose
- Drop if_type and use the uclass instead
- Drop some obsolete if_type values
An issue not resolved by this series is that the sandbox host interface does not actually have a device. At present it uses the root device, which was convenience for the driver model conversion but not really correct. It should be possible to clean this up, in a future series.
Another minor issue is the use of UCLASS_USB for a mass-storage device. This has been the case for a while and is not addresed by this series, other than to add a comment.
Note that this test relies on Tom Rini's series to drop various boards including warp and cm_t335
Finally, a patch is included to make binman put fake files in a subdirectory, since repeated runs of certain boards can cause unrelated failues (e.g. chromebook_coral) when fake files are left around.
Changes in v4:
- Fix comments from Takahiro Akashi missed on the previous revision
Changes in v3:
- Drop previously applied patches
- Rebase on -next after EFI changes
Changes in v2:
- Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()
Simon Glass (1):
blk: Rename if_type to uclass_id
board/st/common/stm32mp_dfu.c | 2 +- cmd/bcb.c | 4 +- cmd/blk_common.c | 18 ++--- cmd/lsblk.c | 2 +- cmd/mmc.c | 4 +- common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 6 +- disk/disk-uclass.c | 8 +- disk/part.c | 14 ++-- doc/usage/partitions.rst | 2 +- drivers/ata/sata.c | 2 +- drivers/block/blk-uclass.c | 145 +++++++++++++++++----------------- drivers/block/blk_legacy.c | 58 +++++++------- drivers/block/ide.c | 8 +- drivers/block/sandbox.c | 8 +- drivers/mmc/mmc-uclass.c | 2 +- drivers/mmc/mmc_legacy.c | 8 +- drivers/net/fsl_enetc.c | 12 +-- drivers/net/fsl_enetc.h | 2 +- drivers/scsi/scsi.c | 6 +- drivers/virtio/virtio_blk.c | 2 +- drivers/xen/pvblock.c | 2 +- fs/fat/fat.c | 2 +- include/blk.h | 122 ++++++++++++++-------------- include/efi_loader.h | 4 +- lib/efi_loader/efi_disk.c | 12 +-- lib/efi_loader/efi_var_file.c | 4 +- 28 files changed, 231 insertions(+), 232 deletions(-)
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
PATCH v4 1/1 blk: Rename if_type to uclass_id
Use the word 'uclass' instead of 'if_type' to complete the conversion.
---
Changes in v4:
- Fix comments from Takahiro Akashi missed on the previous revision
Changes in v3:
- Drop previously applied patches
- Rebase on -next after EFI changes
Changes in v2:
- Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()
board/st/common/stm32mp_dfu.c | 2 +- cmd/bcb.c | 4 +- cmd/blk_common.c | 18 ++--- cmd/lsblk.c | 2 +- cmd/mmc.c | 4 +- common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 6 +- disk/disk-uclass.c | 8 +- disk/part.c | 14 ++-- doc/usage/partitions.rst | 2 +- drivers/ata/sata.c | 2 +- drivers/block/blk-uclass.c | 145 +++++++++++++++++----------------- drivers/block/blk_legacy.c | 58 +++++++------- drivers/block/ide.c | 8 +- drivers/block/sandbox.c | 8 +- drivers/mmc/mmc-uclass.c | 2 +- drivers/mmc/mmc_legacy.c | 8 +- drivers/net/fsl_enetc.c | 12 +-- drivers/net/fsl_enetc.h | 2 +- drivers/scsi/scsi.c | 6 +- drivers/virtio/virtio_blk.c | 2 +- drivers/xen/pvblock.c | 2 +- fs/fat/fat.c | 2 +- include/blk.h | 122 ++++++++++++++-------------- include/efi_loader.h | 4 +- lib/efi_loader/efi_disk.c | 12 +-- lib/efi_loader/efi_var_file.c | 4 +- 28 files changed, 231 insertions(+), 232 deletions(-)
board/st/common/stm32mp_dfu.c +1 -1
@@ -37,7 +37,7 @@ static void board_get_alt_info_mmc(struct udevice *dev, char *buf)if (!desc)return ; - name =blk_get_if_type_name (desc->if_type); + name =blk_get_uclass_name (desc->uclass_id); devnum = desc->devnum; len =strlen (buf);
cmd/bcb.c +2 -2
@@ -122,7 +122,7 @@ static int __bcb_load(int devnum, const char *partp)char *endp;int part, ret; - desc =blk_get_devnum_by_type (UCLASS_MMC , devnum); + desc =blk_get_devnum_by_uclass_id (UCLASS_MMC , devnum);if (!desc) { ret = -ENODEV ; goto err_read_fail;
@@ -287,7 +287,7 @@ static int __bcb_store(void)u64 cnt;int ret; - desc =blk_get_devnum_by_type (UCLASS_MMC , bcb_dev); + desc =blk_get_devnum_by_uclass_id (UCLASS_MMC , bcb_dev);if (!desc) { ret = -ENODEV ; goto err;
cmd/blk_common.c +9 -9
@@ -12,10 +12,10 @@#include <blk.h> #include <command.h> -int blk_common_cmd (int argc,char *const argv[],enum uclass_id if_type, +int blk_common_cmd (int argc,char *const argv[],enum uclass_id uclass_id,int *cur_devnump) { -const char *if_name =blk_get_if_type_name (if_type); +const char *if_name =blk_get_uclass_name (uclass_id);switch (argc) {case 0 :
@@ -23,16 +23,16 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,return CMD_RET_USAGE ;case 2 :if (strncmp (argv[1 ],"inf" ,3 ) ==0 ) { -blk_list_devices (if_type); +blk_list_devices (uclass_id);return 0 ; }else if (strncmp (argv[1 ],"dev" ,3 ) ==0 ) { -if (blk_print_device_num (if_type, *cur_devnump)) { +if (blk_print_device_num (uclass_id, *cur_devnump)) {printf ("\nno %s devices available\n" , if_name);return CMD_RET_FAILURE ; }return 0 ; }else if (strncmp (argv[1 ],"part" ,4 ) ==0 ) { -if (blk_list_part (if_type)) +if (blk_list_part (uclass_id))printf ("\nno %s partition table available\n" , if_name);return 0 ;
@@ -42,7 +42,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,if (strncmp (argv[1 ],"dev" ,3 ) ==0 ) {int dev = (int )dectoul (argv[2 ],NULL ); -if (!blk_show_device (if_type, dev)) { +if (!blk_show_device (uclass_id, dev)) { *cur_devnump = dev;printf ("... is now current device\n" ); }else {
@@ -52,7 +52,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, }else if (strncmp (argv[1 ],"part" ,4 ) ==0 ) {int dev = (int )dectoul (argv[2 ],NULL ); -if (blk_print_part_devnum (if_type, dev)) { +if (blk_print_part_devnum (uclass_id, dev)) {printf ("\n%s device %d not available\n" , if_name, dev);return CMD_RET_FAILURE ;
@@ -71,7 +71,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,printf ("\n%s read: device %d block # " LBAFU ", count %lu ... " , if_name, *cur_devnump, blk, cnt); - n =blk_read_devnum (if_type, *cur_devnump, blk, cnt, + n =blk_read_devnum (uclass_id, *cur_devnump, blk, cnt, (ulong *)addr); printf("%ld blocks read: %s\n", n,
@@ -86,7 +86,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,printf ("\n%s write: device %d block # " LBAFU ", count %lu ... " , if_name, *cur_devnump, blk, cnt); - n =blk_write_devnum (if_type, *cur_devnump, blk, cnt, + n =blk_write_devnum (uclass_id, *cur_devnump, blk, cnt, (ulong *)addr); printf("%ld blocks written: %s\n", n,
cmd/lsblk.c +1 -1
@@ -36,7 +36,7 @@ static int do_lsblk(struct cmd_tbl *cmdtp, int flag, int argc, char * const argvcontinue ; desc =dev_get_uclass_plat (udev);printf ("%c %s %u" , i ?',' :':' , -blk_get_if_type_name (desc->if_type), +blk_get_uclass_name (desc->uclass_id), desc->devnum); i++; }
cmd/mmc.c +2 -2
@@ -154,7 +154,7 @@ static struct mmc *__init_mmc_device(int dev, bool force_init,#ifdef CONFIG_BLOCK_CACHE struct blk_desc *bd =mmc_get_blk_desc (mmc); -blkcache_invalidate (bd->if_type, bd->devnum); +blkcache_invalidate (bd->uclass_id, bd->devnum);#endif return mmc;
@@ -530,7 +530,7 @@ static int do_mmc_part(struct cmd_tbl *cmdtp, int flag,if (!mmc)return CMD_RET_FAILURE ; - mmc_dev =blk_get_devnum_by_type (UCLASS_MMC , curr_device); + mmc_dev =blk_get_devnum_by_uclass_id (UCLASS_MMC , curr_device);if (mmc_dev !=NULL && mmc_dev->type !=DEV_TYPE_UNKNOWN ) {part_print (mmc_dev);return CMD_RET_SUCCESS ;
common/spl/spl_sata.c +1 -1
@@ -71,7 +71,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,/* try to recognize storage devices immediately */ scsi_scan (false); - stor_dev =blk_get_devnum_by_type (UCLASS_SCSI ,0 ); + stor_dev =blk_get_devnum_by_uclass_id (UCLASS_SCSI ,0 );if (!stor_dev)return -ENODEV ;
common/spl/spl_usb.c +1 -1
@@ -41,7 +41,7 @@ int spl_usb_load(struct spl_image_info *spl_image,/* try to recognize storage devices immediately */ usb_stor_curr_dev =usb_stor_scan (1 ); - stor_dev =blk_get_devnum_by_type (UCLASS_USB , usb_stor_curr_dev); + stor_dev =blk_get_devnum_by_uclass_id (UCLASS_USB , usb_stor_curr_dev);if (!stor_dev)return -ENODEV ;
common/usb_storage.c +3 -3
@@ -279,7 +279,7 @@ static int usb_stor_probe_device(struct usb_device *udev) blkdev = &usb_dev_desc[usb_max_devs];memset (blkdev,'\0' ,sizeof (struct blk_desc )); - blkdev->if_type =UCLASS_USB ; + blkdev->uclass_id =UCLASS_USB ; blkdev->devnum = usb_max_devs; blkdev->part_type =PART_TYPE_UNKNOWN ; blkdev->target =0xff ;
@@ -1577,8 +1577,8 @@ U_BOOT_DRIVER(usb_storage_blk) = { };#else U_BOOT_LEGACY_BLK (usb) = { - .if_typename ="usb" , - .if_type =UCLASS_USB , + .uclass_idname ="usb" , + .uclass_id =UCLASS_USB , .max_devs =USB_MAX_STOR_DEV , .desc = usb_dev_desc, };
disk/disk-uclass.c +4 -4
@@ -191,12 +191,12 @@ unsigned long dev_read(struct udevice *dev, lbaint_t start, start_in_disk += part->gpt_part_info.start; } -if (blkcache_read (block_dev->if_type, block_dev->devnum, +if (blkcache_read (block_dev->uclass_id, block_dev->devnum, start_in_disk, blkcnt, block_dev->blksz, buffer))return blkcnt; blks_read = ops->read (dev, start, blkcnt, buffer);if (blks_read == blkcnt) -blkcache_fill (block_dev->if_type, block_dev->devnum, +blkcache_fill (block_dev->uclass_id, block_dev->devnum, start_in_disk, blkcnt, block_dev->blksz, buffer);return blks_read;
@@ -216,7 +216,7 @@ unsigned long dev_write(struct udevice *dev, lbaint_t start,if (!ops->write)return -ENOSYS ; -blkcache_invalidate (block_dev->if_type, block_dev->devnum); +blkcache_invalidate (block_dev->uclass_id, block_dev->devnum);return ops->write (dev, start, blkcnt, buffer); }
@@ -235,7 +235,7 @@ unsigned long dev_erase(struct udevice *dev, lbaint_t start,if (!ops->erase)return -ENOSYS ; -blkcache_invalidate (block_dev->if_type, block_dev->devnum); +blkcache_invalidate (block_dev->uclass_id, block_dev->devnum);return ops->erase (dev, start, blkcnt); }
disk/part.c +7 -7
@@ -61,7 +61,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)if (!blk_enabled ())return NULL ; - dev_desc =blk_get_devnum_by_typename (ifname, dev); + dev_desc =blk_get_devnum_by_uclass_idname (ifname, dev);if (!dev_desc) {debug ("%s: No device for iface '%s', dev %d\n" , __func__, ifname, dev);
@@ -120,7 +120,7 @@ void dev_print(struct blk_desc *dev_desc)return ; } -switch (dev_desc->if_type) { +switch (dev_desc->uclass_id) {case UCLASS_SCSI : printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n", dev_desc->target,dev_desc->lun,
@@ -155,7 +155,7 @@ void dev_print(struct blk_desc *dev_desc)puts ("device type unknown\n" );return ;default : -printf ("Unhandled device type: %i\n" , dev_desc->if_type); +printf ("Unhandled device type: %i\n" , dev_desc->uclass_id);return ; }puts (" Type: " );
@@ -225,7 +225,7 @@ void part_init(struct blk_desc *dev_desc) const int n_ents = ll_entry_count(struct part_driver, part_driver);struct part_driver *entry; -blkcache_invalidate (dev_desc->if_type, dev_desc->devnum); +blkcache_invalidate (dev_desc->uclass_id, dev_desc->devnum); dev_desc->part_type =PART_TYPE_UNKNOWN ;for (entry = drv; entry != drv + n_ents; entry++) {
@@ -248,7 +248,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)CONFIG_IS_ENABLED (AMIGA_PARTITION ) || \CONFIG_IS_ENABLED (EFI_PARTITION ) puts ("\nPartition Map for "); -switch (dev_desc->if_type) { +switch (dev_desc->uclass_id) {case UCLASS_IDE :puts ("IDE" );break ;
@@ -408,7 +408,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,* Always should be done, otherwise hw partition 0 will return * stale data after displaying a non-zero hw partition. */ -if ((*dev_desc)->if_type ==UCLASS_MMC ) +if ((*dev_desc)->uclass_id ==UCLASS_MMC )part_init (*dev_desc); }
@@ -762,7 +762,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc, {char *devtype; -switch (dev_desc->if_type) { +switch (dev_desc->uclass_id) {case UCLASS_IDE :case UCLASS_AHCI : devtype ="hd" ;
doc/usage/partitions.rst +1 -1
@@ -20,7 +20,7 @@ generic syntax. interface The interface used to access the partition's device, like ``mmc`` or ``scsi``. For a full list of supported interfaces, consult the - ``if_typename_str`` array in ``drivers/block/blk-uclass.c`` + ``uclass_idname_str`` array in ``drivers/block/blk-uclass.c`` devnum The device number. This defaults to 0.
drivers/ata/sata.c +1 -1
@@ -79,7 +79,7 @@ int __sata_initialize(void)for (i =0 ; i <CONFIG_SYS_SATA_MAX_DEVICE ; i++) {memset (&sata_dev_desc[i],0 ,sizeof (struct blk_desc )); - sata_dev_desc[i].if_type =UCLASS_AHCI ; + sata_dev_desc[i].uclass_id =UCLASS_AHCI ; sata_dev_desc[i].devnum = i; sata_dev_desc[i].part_type =PART_TYPE_UNKNOWN ; sata_dev_desc[i].type =DEV_TYPE_HARDDISK ;
drivers/block/blk-uclass.c +72 -73
460 lines not on this page · raw message
drivers/block/blk_legacy.c +29 -29
178 lines not on this page · raw message
drivers/block/ide.c +4 -4
@@ -537,7 +537,7 @@ static void ide_ident(struct blk_desc *dev_desc)/* Select device */ ide_outb (device,ATA_DEV_HD ,ATA_LBA |ATA_DEVICE (device)); - dev_desc->if_type =UCLASS_IDE ; + dev_desc->uclass_id =UCLASS_IDE ;#ifdef CONFIG_ATAPI retries =0 ;
@@ -752,7 +752,7 @@ void ide_init(void)for (i =0 ; i <CONFIG_SYS_IDE_MAXDEVICE ; ++i) { ide_dev_desc[i].type =DEV_TYPE_UNKNOWN ; - ide_dev_desc[i].if_type =UCLASS_IDE ; + ide_dev_desc[i].uclass_id =UCLASS_IDE ; ide_dev_desc[i].devnum = i; ide_dev_desc[i].part_type =PART_TYPE_UNKNOWN ; ide_dev_desc[i].blksz =0 ;
@@ -1143,8 +1143,8 @@ UCLASS_DRIVER(ide) = { };#else U_BOOT_LEGACY_BLK (ide) = { - .if_typename ="ide" , - .if_type =UCLASS_IDE , + .uclass_idname ="ide" , + .uclass_id =UCLASS_IDE , .max_devs =CONFIG_SYS_IDE_MAXDEVICE , .desc = ide_dev_desc, };
drivers/block/sandbox.c +4 -4
@@ -150,7 +150,7 @@ int host_dev_bind(int devnum, char *filename, bool removable) goto err_file; } - desc =blk_get_devnum_by_type (UCLASS_ROOT , devnum); + desc =blk_get_devnum_by_uclass_id (UCLASS_ROOT , devnum); desc->removable = removable;snprintf (desc->vendor,BLK_VEN_SIZE ,"U-Boot" );snprintf (desc->product,BLK_PRD_SIZE ,"hostfile" );
@@ -192,7 +192,7 @@ int host_dev_bind(int dev, char *filename, bool removable) }struct blk_desc *blk_dev = &host_dev->blk_dev; - blk_dev->if_type =UCLASS_ROOT ; + blk_dev->uclass_id =UCLASS_ROOT ; blk_dev->priv = host_dev; blk_dev->blksz =512 ; blk_dev->lba =os_lseek (host_dev->fd,0 ,OS_SEEK_END ) / blk_dev->blksz;
@@ -262,8 +262,8 @@ U_BOOT_DRIVER(sandbox_host_blk) = { };#else U_BOOT_LEGACY_BLK (sandbox_host) = { - .if_typename ="host" , - .if_type =UCLASS_ROOT , + .uclass_idname ="host" , + .uclass_id =UCLASS_ROOT , .max_devs =SANDBOX_HOST_MAX_DEVICES , .get_dev = host_get_dev_err, };
drivers/mmc/mmc-uclass.c +1 -1
@@ -472,7 +472,7 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart) ret =mmc_switch_part (mmc, hwpart);if (!ret) -blkcache_invalidate (desc->if_type, desc->devnum); +blkcache_invalidate (desc->uclass_id, desc->devnum);return ret; }
drivers/mmc/mmc_legacy.c +4 -4
@@ -132,7 +132,7 @@ static struct mmc mmc_static = { .dsr_imp = 0, .dsr = 0xffffffff, .block_dev = { - .if_type = UCLASS_MMC, + .uclass_id = UCLASS_MMC, .removable = 1, .devnum = 0, .block_read = mmc_bread,
@@ -194,7 +194,7 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv) mmc->dsr =0xffffffff ;/* Setup the universal parts of the block interface just once */ bdesc =mmc_get_blk_desc (mmc); - bdesc->if_type =UCLASS_MMC ; + bdesc->uclass_id =UCLASS_MMC ; bdesc->removable =1 ; bdesc->devnum =mmc_get_next_devnum (); bdesc->block_read = mmc_bread;
@@ -253,8 +253,8 @@ static int mmc_get_dev(int dev, struct blk_desc **descp) }U_BOOT_LEGACY_BLK (mmc) = { - .if_typename ="mmc" , - .if_type =UCLASS_MMC , + .uclass_idname ="mmc" , + .uclass_id =UCLASS_MMC , .max_devs =-1 , .get_dev = mmc_get_dev, .select_hwpart = mmc_select_hwpartp,
drivers/net/fsl_enetc.c +6 -6
@@ -144,7 +144,7 @@ static int enetc_init_sgmii(struct udevice *dev)if (!enetc_has_imdio (dev))return 0 ; -if (priv->if_type ==PHY_INTERFACE_MODE_2500BASEX ) +if (priv->uclass_id ==PHY_INTERFACE_MODE_2500BASEX ) is2500 = true;/*
@@ -219,7 +219,7 @@ static void enetc_setup_mac_iface(struct udevice *dev,struct enetc_priv *priv =dev_get_priv (dev);u32 if_mode; -switch (priv->if_type) { +switch (priv->uclass_id) {case PHY_INTERFACE_MODE_RGMII :case PHY_INTERFACE_MODE_RGMII_ID :case PHY_INTERFACE_MODE_RGMII_RXID :
@@ -276,14 +276,14 @@ static void enetc_start_pcs(struct udevice *dev)return ; } - priv->if_type =dev_read_phy_mode (dev); -if (priv->if_type ==PHY_INTERFACE_MODE_NA ) { + priv->uclass_id =dev_read_phy_mode (dev); +if (priv->uclass_id ==PHY_INTERFACE_MODE_NA ) {enetc_dbg (dev,"phy-mode property not found, defaulting to SGMII\n" ); - priv->if_type =PHY_INTERFACE_MODE_SGMII ; + priv->uclass_id =PHY_INTERFACE_MODE_SGMII ; } -switch (priv->if_type) { +switch (priv->uclass_id) {case PHY_INTERFACE_MODE_SGMII :case PHY_INTERFACE_MODE_2500BASEX :enetc_init_sgmii (dev);
drivers/net/fsl_enetc.h +1 -1
@@ -158,7 +158,7 @@ struct enetc_priv {struct bd_ring tx_bdr;struct bd_ring rx_bdr; -int if_type; +int uclass_id;struct mii_dev imdio;struct phy_device *phy; };
drivers/scsi/scsi.c +3 -3
@@ -456,7 +456,7 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum) { dev_desc->lba =0 ; dev_desc->blksz =0 ; - dev_desc->if_type =UCLASS_SCSI ; + dev_desc->uclass_id =UCLASS_SCSI ; dev_desc->devnum = devnum; dev_desc->part_type =PART_TYPE_UNKNOWN ;
@@ -706,8 +706,8 @@ U_BOOT_DRIVER(scsi_blk) = { };#else U_BOOT_LEGACY_BLK (scsi) = { - .if_typename ="scsi" , - .if_type =UCLASS_SCSI , + .uclass_idname ="scsi" , + .uclass_id =UCLASS_SCSI , .max_devs =SCSI_MAX_DEVICE , .desc = scsi_dev_desc, };
drivers/virtio/virtio_blk.c +1 -1
@@ -75,7 +75,7 @@ static int virtio_blk_bind(struct udevice *dev)struct blk_desc *desc =dev_get_uclass_plat (dev);int devnum; - desc->if_type =UCLASS_VIRTIO ; + desc->uclass_id =UCLASS_VIRTIO ;/* * Initialize the devnum to -ENODEV. This is to make sure that * blk_next_free_devnum() works as expected, since the default
drivers/xen/pvblock.c +1 -1
@@ -665,7 +665,7 @@ static int pvblock_blk_bind(struct udevice *udev)struct blk_desc *desc =dev_get_uclass_plat (udev);int devnum; - desc->if_type =UCLASS_PVBLOCK ; + desc->uclass_id =UCLASS_PVBLOCK ;/* * Initialize the devnum to -ENODEV. This is to make sure that * blk_next_free_devnum() works as expected, since the default
fs/fat/fat.c +1 -1
@@ -1145,7 +1145,7 @@ int file_fat_detectfs(void) }if (blk_enabled ()) { -printf ("Interface: %s\n" ,blk_get_if_type_name (cur_dev->if_type)); +printf ("Interface: %s\n" ,blk_get_uclass_name (cur_dev->uclass_id));printf (" Device %d: " , cur_dev->devnum);dev_print (cur_dev); }
include/blk.h +61 -61
365 lines not on this page · raw message
include/efi_loader.h +2 -2
@@ -161,7 +161,7 @@ extern bool efi_st_keep_devices;/* EFI system partition */ extern struct efi_system_partition { -enum uclass_id if_type; +enum uclass_id uclass_id;int devnum;u8 part; } efi_system_partition;
@@ -560,7 +560,7 @@ efi_status_t tcg2_measure_pe_image(void *efi, u64 efi_size, struct efi_loaded_image *loaded_image_info);/* Create handles and protocols for the partitions of a block device */ int efi_disk_create_partitions (efi_handle_t parent,struct blk_desc *desc, -const char *if_typename,int diskid, +const char *uclass_idname,int diskid,const char *pdevname);/* Called by bootefi to make GOP (graphical) interface available */ efi_status_t efi_gop_register (void );
lib/efi_loader/efi_disk.c +6 -6
@@ -498,13 +498,13 @@ static efi_status_t efi_disk_add_dev( diskobj->media.last_block);/* Store first EFI system partition */ -if (part && !efi_system_partition.if_type) { +if (part && !efi_system_partition.uclass_id) {if (part_info->bootable &PART_EFI_SYSTEM_PARTITION ) { - efi_system_partition.if_type = desc->if_type; + efi_system_partition.uclass_id = desc->uclass_id; efi_system_partition.devnum = desc->devnum; efi_system_partition.part = part;EFI_PRINT ("EFI system partition: %s %x:%x\n" , -blk_get_if_type_name (desc->if_type), +blk_get_uclass_name (desc->uclass_id), desc->devnum, part); } }
@@ -640,7 +640,7 @@ static int efi_disk_probe(void *ctx, struct event *event)* has already created an efi_disk at this moment. */ desc =dev_get_uclass_plat (dev); -if (desc->if_type !=UCLASS_EFI_LOADER ) { +if (desc->uclass_id !=UCLASS_EFI_LOADER ) { ret =efi_disk_create_raw (dev);if (ret)return -1 ;
@@ -675,7 +675,7 @@ static int efi_disk_delete_raw(struct udevice *dev)return -1 ; desc =dev_get_uclass_plat (dev); -if (desc->if_type !=UCLASS_EFI_LOADER ) { +if (desc->uclass_id !=UCLASS_EFI_LOADER ) { diskobj = container_of(handle, struct efi_disk_obj, header);efi_free_pool (diskobj->dp); }
@@ -794,7 +794,7 @@ efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int }else {return EFI_INVALID_PARAMETER ; } - if_typename =blk_get_if_type_name (desc->if_type); + if_typename =blk_get_uclass_name (desc->uclass_id); diskid = desc->devnum;if (is_partition) {
lib/efi_loader/efi_var_file.c +2 -2
@@ -38,13 +38,13 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void)char part_str[PART_STR_LEN ];int r; -if (efi_system_partition.if_type ==UCLASS_INVALID ) { +if (efi_system_partition.uclass_id ==UCLASS_INVALID ) {log_err ("No EFI system partition\n" );return EFI_DEVICE_ERROR ; }snprintf (part_str,PART_STR_LEN ,"%x:%x" , efi_system_partition.devnum, efi_system_partition.part); - r =fs_set_blk_dev (blk_get_if_type_name (efi_system_partition.if_type), + r =fs_set_blk_dev (blk_get_uclass_name (efi_system_partition.uclass_id), part_str,FS_TYPE_ANY );if (r) {log_err ("Cannot read EFI system partition\n" );
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
Re: [PATCH v4 1/1] blk: Rename if_type to uclass_id
Use the word 'uclass' instead of 'if_type' to complete the conversion.
---
Changes in v4:
- Fix comments from Takahiro Akashi missed on the previous revision
Changes in v3:
- Drop previously applied patches
- Rebase on -next after EFI changes
Changes in v2:
- Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()
board/st/common/stm32mp_dfu.c | 2 +- cmd/bcb.c | 4 +- cmd/blk_common.c | 18 ++--- cmd/lsblk.c | 2 +- cmd/mmc.c | 4 +- common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 6 +- disk/disk-uclass.c | 8 +- disk/part.c | 14 ++-- doc/usage/partitions.rst | 2 +- drivers/ata/sata.c | 2 +- drivers/block/blk-uclass.c | 145 +++++++++++++++++----------------- drivers/block/blk_legacy.c | 58 +++++++------- drivers/block/ide.c | 8 +- drivers/block/sandbox.c | 8 +- drivers/mmc/mmc-uclass.c | 2 +- drivers/mmc/mmc_legacy.c | 8 +- drivers/net/fsl_enetc.c | 12 +-- drivers/net/fsl_enetc.h | 2 +- drivers/scsi/scsi.c | 6 +- drivers/virtio/virtio_blk.c | 2 +- drivers/xen/pvblock.c | 2 +- fs/fat/fat.c | 2 +- include/blk.h | 122 ++++++++++++++-------------- include/efi_loader.h | 4 +- lib/efi_loader/efi_disk.c | 12 +-- lib/efi_loader/efi_var_file.c | 4 +- 28 files changed, 231 insertions(+), 232 deletions(-)
Applied to u-boot-dm, thanks!