mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 10:24:49 +00:00
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>
This commit is contained in:
parent
3a3543db51
commit
d7d78576bb
8 changed files with 17 additions and 15 deletions
|
@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name)
|
int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name)
|
||||||
{
|
{
|
||||||
struct udevice *parent, *dev;
|
struct udevice *parent, *dev;
|
||||||
char dev_name[50];
|
char dev_name[50];
|
||||||
|
@ -305,7 +305,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp)
|
||||||
if (device_get_uclass_id(dev) != UCLASS_BOOTDEV)
|
if (device_get_uclass_id(dev) != UCLASS_BOOTDEV)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* This should always work if bootdev_setup_sibling_blk() was used */
|
/*
|
||||||
|
* This should always work if bootdev_setup_for_sibling_blk() was used
|
||||||
|
*/
|
||||||
len = bootdev_get_suffix_start(dev, ".bootdev");
|
len = bootdev_get_suffix_start(dev, ".bootdev");
|
||||||
ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
|
ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -335,7 +337,7 @@ static int bootdev_get_from_blk(struct udevice *blk, struct udevice **bootdevp)
|
||||||
if (device_get_uclass_id(blk) != UCLASS_BLK)
|
if (device_get_uclass_id(blk) != UCLASS_BLK)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* This should always work if bootdev_setup_sibling_blk() was used */
|
/* This should always work if bootdev_setup_for_sibling_blk() was used */
|
||||||
len = bootdev_get_suffix_start(blk, ".blk");
|
len = bootdev_get_suffix_start(blk, ".blk");
|
||||||
snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
|
snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
|
||||||
"bootdev");
|
"bootdev");
|
||||||
|
|
|
@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
|
ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev");
|
||||||
if (ret) {
|
if (ret) {
|
||||||
int ret2;
|
int ret2;
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ media device::
|
||||||
|
|
||||||
The bootdev device is typically created automatically in the media uclass'
|
The bootdev device is typically created automatically in the media uclass'
|
||||||
`post_bind()` method by calling `bootdev_setup_for_dev()` or
|
`post_bind()` method by calling `bootdev_setup_for_dev()` or
|
||||||
`bootdev_setup_sibling_blk()`. The code typically something like this::
|
`bootdev_setup_for_sibling_blk()`. The code typically something like this::
|
||||||
|
|
||||||
/* dev is the Ethernet device */
|
/* dev is the Ethernet device */
|
||||||
ret = bootdev_setup_for_dev(dev, "eth_bootdev");
|
ret = bootdev_setup_for_dev(dev, "eth_bootdev");
|
||||||
|
@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass'
|
||||||
or::
|
or::
|
||||||
|
|
||||||
/* blk is the block device (child of MMC device)
|
/* blk is the block device (child of MMC device)
|
||||||
ret = bootdev_setup_sibling_blk(blk, "mmc_bootdev");
|
ret = bootdev_setup_for_sibling_blk(blk, "mmc_bootdev");
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("bootdev", ret);
|
return log_msg_ret("bootdev", ret);
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
|
||||||
mmc->cfg = cfg;
|
mmc->cfg = cfg;
|
||||||
mmc->priv = dev;
|
mmc->priv = dev;
|
||||||
|
|
||||||
ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev");
|
ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev");
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("bootdev", ret);
|
return log_msg_ret("bootdev", ret);
|
||||||
|
|
||||||
|
|
|
@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto free_id;
|
goto free_id;
|
||||||
|
|
||||||
ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev");
|
ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev");
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("bootdev", ret);
|
return log_msg_ret("bootdev", ret);
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
|
||||||
/* TODO: undo create */
|
/* TODO: undo create */
|
||||||
return log_msg_ret("pro", ret);
|
return log_msg_ret("pro", ret);
|
||||||
|
|
||||||
ret = bootdev_setup_sibling_blk(bdev, "scsi_bootdev");
|
ret = bootdev_setup_for_sibling_blk(bdev, "scsi_bootdev");
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("bd", ret);
|
return log_msg_ret("bd", ret);
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
|
||||||
device_set_name_alloced(vdev);
|
device_set_name_alloced(vdev);
|
||||||
|
|
||||||
if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) {
|
if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) {
|
||||||
ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev");
|
ret = bootdev_setup_for_sibling_blk(vdev, "virtio_bootdev");
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("bootdev", ret);
|
return log_msg_ret("bootdev", ret);
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,7 +371,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp);
|
||||||
/**
|
/**
|
||||||
* bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)
|
* bootdev_setup_for_dev() - Bind a new bootdev device (deprecated)
|
||||||
*
|
*
|
||||||
* Please use bootdev_setup_sibling_blk() instead since it supports multiple
|
* Please use bootdev_setup_for_sibling_blk() instead since it supports multiple
|
||||||
* (child) block devices for each media device.
|
* (child) block devices for each media device.
|
||||||
*
|
*
|
||||||
* Creates a bootdev device as a child of @parent. This should be called from
|
* 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);
|
||||||
int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
|
int bootdev_setup_for_dev(struct udevice *parent, const char *drv_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bootdev_setup_for_blk() - Bind a new bootdev device for a blk device
|
* bootdev_setup_for_sibling_blk() - Bind a new bootdev device for a blk device
|
||||||
*
|
*
|
||||||
* Creates a bootdev device as a sibling of @blk. This should be called from
|
* Creates a bootdev device as a sibling of @blk. This should be called from
|
||||||
* the driver's bind() method or its uclass' post_bind() method, at the same
|
* 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);
|
||||||
* @drv_name: Name of bootdev driver to bind
|
* @drv_name: Name of bootdev driver to bind
|
||||||
* Return: 0 if OK, -ve on error
|
* Return: 0 if OK, -ve on error
|
||||||
*/
|
*/
|
||||||
int bootdev_setup_sibling_blk(struct udevice *blk, const char *drv_name);
|
int bootdev_setup_for_sibling_blk(struct udevice *blk, const char *drv_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bootdev_get_sibling_blk() - Locate the block device for a bootdev
|
* 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,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int bootdev_setup_sibling_blk(struct udevice *blk,
|
static inline int bootdev_setup_for_sibling_blk(struct udevice *blk,
|
||||||
const char *drv_name)
|
const char *drv_name)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue