Skip to content

Commit d7d7857

Browse files
sjg20lbmeng
authored andcommitted
bootstd: Rename bootdev_setup_sibling_blk()
This name is a little confusing since it suggests that it sets up the sibling block device. In fact it sets up a bootdev for it. Rename the function to make this clearer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
1 parent 3a3543d commit d7d7857

8 files changed

Lines changed: 17 additions & 15 deletions

File tree

boot/bootdev-uclass.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix)
262262
return len;
263263
}
264264

265-
int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name)
265+
int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name)
266266
{
267267
struct udevice *parent, *dev;
268268
char dev_name[50];
@@ -305,7 +305,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp)
305305
if (device_get_uclass_id(dev) != UCLASS_BOOTDEV)
306306
return -EINVAL;
307307

308-
/* This should always work if bootdev_setup_sibling_blk() was used */
308+
/*
309+
* This should always work if bootdev_setup_for_sibling_blk() was used
310+
*/
309311
len = bootdev_get_suffix_start(dev, ".bootdev");
310312
ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
311313
if (ret) {
@@ -335,7 +337,7 @@ static int bootdev_get_from_blk(struct udevice *blk, struct udevice **bootdevp)
335337
if (device_get_uclass_id(blk) != UCLASS_BLK)
336338
return -EINVAL;
337339

338-
/* This should always work if bootdev_setup_sibling_blk() was used */
340+
/* This should always work if bootdev_setup_for_sibling_blk() was used */
339341
len = bootdev_get_suffix_start(blk, ".blk");
340342
snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
341343
"bootdev");

common/usb_storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
246246
if (ret)
247247
return ret;
248248

249-
ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
249+
ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev");
250250
if (ret) {
251251
int ret2;
252252

doc/develop/bootstd.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ media device::
306306

307307
The bootdev device is typically created automatically in the media uclass'
308308
`post_bind()` method by calling `bootdev_setup_for_dev()` or
309-
`bootdev_setup_sibling_blk()`. The code typically something like this::
309+
`bootdev_setup_for_sibling_blk()`. The code typically something like this::
310310

311311
/* dev is the Ethernet device */
312312
ret = bootdev_setup_for_dev(dev, "eth_bootdev");
@@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass'
316316
or::
317317

318318
/* blk is the block device (child of MMC device)
319-
ret = bootdev_setup_sibling_blk(blk, "mmc_bootdev");
319+
ret = bootdev_setup_for_sibling_blk(blk, "mmc_bootdev");
320320
if (ret)
321321
return log_msg_ret("bootdev", ret);
322322

drivers/mmc/mmc-uclass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
421421
mmc->cfg = cfg;
422422
mmc->priv = dev;
423423

424-
ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev");
424+
ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev");
425425
if (ret)
426426
return log_msg_ret("bootdev", ret);
427427

drivers/nvme/nvme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev)
910910
if (ret)
911911
goto free_id;
912912

913-
ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev");
913+
ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev");
914914
if (ret)
915915
return log_msg_ret("bootdev", ret);
916916

drivers/scsi/scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
607607
/* TODO: undo create */
608608
return log_msg_ret("pro", ret);
609609

610-
ret = bootdev_setup_sibling_blk(bdev, "scsi_bootdev");
610+
ret = bootdev_setup_for_sibling_blk(bdev, "scsi_bootdev");
611611
if (ret)
612612
return log_msg_ret("bd", ret);
613613

drivers/virtio/virtio-uclass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
248248
device_set_name_alloced(vdev);
249249

250250
if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) {
251-
ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev");
251+
ret = bootdev_setup_for_sibling_blk(vdev, "virtio_bootdev");
252252
if (ret)
253253
return log_msg_ret("bootdev", ret);
254254
}

include/bootdev.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp);
371371
/**
372372
* bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)
373373
*
374-
* Please use bootdev_setup_sibling_blk() instead since it supports multiple
374+
* Please use bootdev_setup_for_sibling_blk() instead since it supports multiple
375375
* (child) block devices for each media device.
376376
*
377377
* Creates a bootdev device as a child of @parent. This should be called from
@@ -386,7 +386,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp);
386386
int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
387387

388388
/**
389-
* bootdev_setup_for_blk() - Bind a new bootdev device for a blk device
389+
* bootdev_setup_for_sibling_blk() - Bind a new bootdev device for a blk device
390390
*
391391
* Creates a bootdev device as a sibling of @blk. This should be called from
392392
* the driver's bind() method or its uclass' post_bind() method, at the same
@@ -398,7 +398,7 @@ int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
398398
* @drv_name: Name of bootdev driver to bind
399399
* Return: 0 if OK, -ve on error
400400
*/
401-
int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name);
401+
int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name);
402402

403403
/**
404404
* bootdev_get_sibling_blk() - Locate the block device for a bootdev
@@ -428,8 +428,8 @@ static inline int bootdev_setup_for_dev(struct udevice *parent,
428428
return 0;
429429
}
430430

431-
static inline int bootdev_setup_sibling_blk(struct udevice *blk,
432-
const char *drv_name)
431+
static inline int bootdev_setup_for_sibling_blk(struct udevice *blk,
432+
const char *drv_name)
433433
{
434434
return 0;
435435
}

0 commit comments

Comments
 (0)