Skip to content

Commit 8149b15

Browse files
committed
blk: Rename if_type to uclass_id
Use the word 'uclass' instead of 'if_type' to complete the conversion. Signed-off-by: Simon Glass <[email protected]>
1 parent a2a9317 commit 8149b15

28 files changed

+231
-232
lines changed

board/st/common/stm32mp_dfu.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void board_get_alt_info_mmc(struct udevice *dev, char *buf)
3737
if (!desc)
3838
return;
3939

40-
name = blk_get_if_type_name(desc->if_type);
40+
name = blk_get_uclass_name(desc->uclass_id);
4141
devnum = desc->devnum;
4242
len = strlen(buf);
4343

cmd/bcb.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int __bcb_load(int devnum, const char *partp)
122122
char *endp;
123123
int part, ret;
124124

125-
desc = blk_get_devnum_by_type(UCLASS_MMC, devnum);
125+
desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, devnum);
126126
if (!desc) {
127127
ret = -ENODEV;
128128
goto err_read_fail;
@@ -287,7 +287,7 @@ static int __bcb_store(void)
287287
u64 cnt;
288288
int ret;
289289

290-
desc = blk_get_devnum_by_type(UCLASS_MMC, bcb_dev);
290+
desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, bcb_dev);
291291
if (!desc) {
292292
ret = -ENODEV;
293293
goto err;

cmd/blk_common.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@
1212
#include <blk.h>
1313
#include <command.h>
1414

15-
int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
15+
int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
1616
int *cur_devnump)
1717
{
18-
const char *if_name = blk_get_if_type_name(if_type);
18+
const char *if_name = blk_get_uclass_name(uclass_id);
1919

2020
switch (argc) {
2121
case 0:
2222
case 1:
2323
return CMD_RET_USAGE;
2424
case 2:
2525
if (strncmp(argv[1], "inf", 3) == 0) {
26-
blk_list_devices(if_type);
26+
blk_list_devices(uclass_id);
2727
return 0;
2828
} else if (strncmp(argv[1], "dev", 3) == 0) {
29-
if (blk_print_device_num(if_type, *cur_devnump)) {
29+
if (blk_print_device_num(uclass_id, *cur_devnump)) {
3030
printf("\nno %s devices available\n", if_name);
3131
return CMD_RET_FAILURE;
3232
}
3333
return 0;
3434
} else if (strncmp(argv[1], "part", 4) == 0) {
35-
if (blk_list_part(if_type))
35+
if (blk_list_part(uclass_id))
3636
printf("\nno %s partition table available\n",
3737
if_name);
3838
return 0;
@@ -42,7 +42,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
4242
if (strncmp(argv[1], "dev", 3) == 0) {
4343
int dev = (int)dectoul(argv[2], NULL);
4444

45-
if (!blk_show_device(if_type, dev)) {
45+
if (!blk_show_device(uclass_id, dev)) {
4646
*cur_devnump = dev;
4747
printf("... is now current device\n");
4848
} else {
@@ -52,7 +52,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
5252
} else if (strncmp(argv[1], "part", 4) == 0) {
5353
int dev = (int)dectoul(argv[2], NULL);
5454

55-
if (blk_print_part_devnum(if_type, dev)) {
55+
if (blk_print_part_devnum(uclass_id, dev)) {
5656
printf("\n%s device %d not available\n",
5757
if_name, dev);
5858
return CMD_RET_FAILURE;
@@ -71,7 +71,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
7171
printf("\n%s read: device %d block # "LBAFU", count %lu ... ",
7272
if_name, *cur_devnump, blk, cnt);
7373

74-
n = blk_read_devnum(if_type, *cur_devnump, blk, cnt,
74+
n = blk_read_devnum(uclass_id, *cur_devnump, blk, cnt,
7575
(ulong *)addr);
7676

7777
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,
8686
printf("\n%s write: device %d block # "LBAFU", count %lu ... ",
8787
if_name, *cur_devnump, blk, cnt);
8888

89-
n = blk_write_devnum(if_type, *cur_devnump, blk, cnt,
89+
n = blk_write_devnum(uclass_id, *cur_devnump, blk, cnt,
9090
(ulong *)addr);
9191

9292
printf("%ld blocks written: %s\n", n,

cmd/lsblk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int do_lsblk(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv
3636
continue;
3737
desc = dev_get_uclass_plat(udev);
3838
printf("%c %s %u", i ? ',' : ':',
39-
blk_get_if_type_name(desc->if_type),
39+
blk_get_uclass_name(desc->uclass_id),
4040
desc->devnum);
4141
i++;
4242
}

cmd/mmc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static struct mmc *__init_mmc_device(int dev, bool force_init,
154154

155155
#ifdef CONFIG_BLOCK_CACHE
156156
struct blk_desc *bd = mmc_get_blk_desc(mmc);
157-
blkcache_invalidate(bd->if_type, bd->devnum);
157+
blkcache_invalidate(bd->uclass_id, bd->devnum);
158158
#endif
159159

160160
return mmc;
@@ -530,7 +530,7 @@ static int do_mmc_part(struct cmd_tbl *cmdtp, int flag,
530530
if (!mmc)
531531
return CMD_RET_FAILURE;
532532

533-
mmc_dev = blk_get_devnum_by_type(UCLASS_MMC, curr_device);
533+
mmc_dev = blk_get_devnum_by_uclass_id(UCLASS_MMC, curr_device);
534534
if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
535535
part_print(mmc_dev);
536536
return CMD_RET_SUCCESS;

common/spl/spl_sata.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
7171

7272
/* try to recognize storage devices immediately */
7373
scsi_scan(false);
74-
stor_dev = blk_get_devnum_by_type(UCLASS_SCSI, 0);
74+
stor_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0);
7575
if (!stor_dev)
7676
return -ENODEV;
7777

common/spl/spl_usb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int spl_usb_load(struct spl_image_info *spl_image,
4141

4242
/* try to recognize storage devices immediately */
4343
usb_stor_curr_dev = usb_stor_scan(1);
44-
stor_dev = blk_get_devnum_by_type(UCLASS_USB, usb_stor_curr_dev);
44+
stor_dev = blk_get_devnum_by_uclass_id(UCLASS_USB, usb_stor_curr_dev);
4545
if (!stor_dev)
4646
return -ENODEV;
4747

common/usb_storage.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
279279

280280
blkdev = &usb_dev_desc[usb_max_devs];
281281
memset(blkdev, '\0', sizeof(struct blk_desc));
282-
blkdev->if_type = UCLASS_USB;
282+
blkdev->uclass_id = UCLASS_USB;
283283
blkdev->devnum = usb_max_devs;
284284
blkdev->part_type = PART_TYPE_UNKNOWN;
285285
blkdev->target = 0xff;
@@ -1577,8 +1577,8 @@ U_BOOT_DRIVER(usb_storage_blk) = {
15771577
};
15781578
#else
15791579
U_BOOT_LEGACY_BLK(usb) = {
1580-
.if_typename = "usb",
1581-
.if_type = UCLASS_USB,
1580+
.uclass_idname = "usb",
1581+
.uclass_id = UCLASS_USB,
15821582
.max_devs = USB_MAX_STOR_DEV,
15831583
.desc = usb_dev_desc,
15841584
};

disk/disk-uclass.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ unsigned long dev_read(struct udevice *dev, lbaint_t start,
191191
start_in_disk += part->gpt_part_info.start;
192192
}
193193

194-
if (blkcache_read(block_dev->if_type, block_dev->devnum,
194+
if (blkcache_read(block_dev->uclass_id, block_dev->devnum,
195195
start_in_disk, blkcnt, block_dev->blksz, buffer))
196196
return blkcnt;
197197
blks_read = ops->read(dev, start, blkcnt, buffer);
198198
if (blks_read == blkcnt)
199-
blkcache_fill(block_dev->if_type, block_dev->devnum,
199+
blkcache_fill(block_dev->uclass_id, block_dev->devnum,
200200
start_in_disk, blkcnt, block_dev->blksz, buffer);
201201

202202
return blks_read;
@@ -216,7 +216,7 @@ unsigned long dev_write(struct udevice *dev, lbaint_t start,
216216
if (!ops->write)
217217
return -ENOSYS;
218218

219-
blkcache_invalidate(block_dev->if_type, block_dev->devnum);
219+
blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
220220

221221
return ops->write(dev, start, blkcnt, buffer);
222222
}
@@ -235,7 +235,7 @@ unsigned long dev_erase(struct udevice *dev, lbaint_t start,
235235
if (!ops->erase)
236236
return -ENOSYS;
237237

238-
blkcache_invalidate(block_dev->if_type, block_dev->devnum);
238+
blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
239239

240240
return ops->erase(dev, start, blkcnt);
241241
}

disk/part.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
6161

6262
if (!blk_enabled())
6363
return NULL;
64-
dev_desc = blk_get_devnum_by_typename(ifname, dev);
64+
dev_desc = blk_get_devnum_by_uclass_idname(ifname, dev);
6565
if (!dev_desc) {
6666
debug("%s: No device for iface '%s', dev %d\n", __func__,
6767
ifname, dev);
@@ -120,7 +120,7 @@ void dev_print(struct blk_desc *dev_desc)
120120
return;
121121
}
122122

123-
switch (dev_desc->if_type) {
123+
switch (dev_desc->uclass_id) {
124124
case UCLASS_SCSI:
125125
printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",
126126
dev_desc->target,dev_desc->lun,
@@ -155,7 +155,7 @@ void dev_print(struct blk_desc *dev_desc)
155155
puts("device type unknown\n");
156156
return;
157157
default:
158-
printf("Unhandled device type: %i\n", dev_desc->if_type);
158+
printf("Unhandled device type: %i\n", dev_desc->uclass_id);
159159
return;
160160
}
161161
puts (" Type: ");
@@ -225,7 +225,7 @@ void part_init(struct blk_desc *dev_desc)
225225
const int n_ents = ll_entry_count(struct part_driver, part_driver);
226226
struct part_driver *entry;
227227

228-
blkcache_invalidate(dev_desc->if_type, dev_desc->devnum);
228+
blkcache_invalidate(dev_desc->uclass_id, dev_desc->devnum);
229229

230230
dev_desc->part_type = PART_TYPE_UNKNOWN;
231231
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)
248248
CONFIG_IS_ENABLED(AMIGA_PARTITION) || \
249249
CONFIG_IS_ENABLED(EFI_PARTITION)
250250
puts ("\nPartition Map for ");
251-
switch (dev_desc->if_type) {
251+
switch (dev_desc->uclass_id) {
252252
case UCLASS_IDE:
253253
puts ("IDE");
254254
break;
@@ -408,7 +408,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
408408
* Always should be done, otherwise hw partition 0 will return
409409
* stale data after displaying a non-zero hw partition.
410410
*/
411-
if ((*dev_desc)->if_type == UCLASS_MMC)
411+
if ((*dev_desc)->uclass_id == UCLASS_MMC)
412412
part_init(*dev_desc);
413413
}
414414

@@ -762,7 +762,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc,
762762
{
763763
char *devtype;
764764

765-
switch (dev_desc->if_type) {
765+
switch (dev_desc->uclass_id) {
766766
case UCLASS_IDE:
767767
case UCLASS_AHCI:
768768
devtype = "hd";

doc/usage/partitions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ generic syntax.
2020
interface
2121
The interface used to access the partition's device, like ``mmc`` or
2222
``scsi``. For a full list of supported interfaces, consult the
23-
``if_typename_str`` array in ``drivers/block/blk-uclass.c``
23+
``uclass_idname_str`` array in ``drivers/block/blk-uclass.c``
2424

2525
devnum
2626
The device number. This defaults to 0.

drivers/ata/sata.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int __sata_initialize(void)
7979

8080
for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
8181
memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
82-
sata_dev_desc[i].if_type = UCLASS_AHCI;
82+
sata_dev_desc[i].uclass_id = UCLASS_AHCI;
8383
sata_dev_desc[i].devnum = i;
8484
sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
8585
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;

0 commit comments

Comments
 (0)