public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>, Simon Glass <sjg@chromium.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Marek Vasut <marex@denx.de>, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v2 4/9] bootstd: Rename bootdev_setup_sibling_blk()
Date: Mon, 31 Jul 2023 19:22:59 +0200	[thread overview]
Message-ID: <87h6pk2dxo.fsf@baylibre.com> (raw)
In-Reply-To: <20230730171531.914677-4-sjg@chromium.org>

On dim., juil. 30, 2023 at 11:15, Simon Glass <sjg@chromium.org> wrote:

> 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: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>
> Changes in v2:
> - Fix the function name in the header as well
>
>  boot/bootdev-uclass.c          |  8 +++++---
>  common/usb_storage.c           |  2 +-
>  doc/develop/bootstd.rst        |  4 ++--
>  drivers/mmc/mmc-uclass.c       |  2 +-
>  drivers/nvme/nvme.c            |  2 +-
>  drivers/scsi/scsi.c            |  2 +-
>  drivers/virtio/virtio-uclass.c |  2 +-
>  include/bootdev.h              | 10 +++++-----
>  8 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
> index 9660ff75676d..114853ffb72a 100644
> --- a/boot/bootdev-uclass.c
> +++ b/boot/bootdev-uclass.c
> @@ -262,7 +262,7 @@ static int bootdev_get_suffix_start(struct udevice *dev, const char *suffix)
>  	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;
>  	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)
>  		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");
>  	ret = device_find_child_by_namelen(parent, dev->name, len, &blk);
>  	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)
>  		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");
>  	snprintf(dev_name, sizeof(dev_name), "%.*s.%s", len, blk->name,
>  		 "bootdev");
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index ac6427577379..85774220ef2a 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -246,7 +246,7 @@ static int usb_stor_probe_device(struct usb_device *udev)
>  		if (ret)
>  			return ret;
>  
> -		ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
> +		ret = bootdev_setup_for_sibling_blk(dev, "usb_bootdev");
>  		if (ret) {
>  			int ret2;
>  
> diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst
> index 7a2a69fdfcec..ec3136535783 100644
> --- a/doc/develop/bootstd.rst
> +++ b/doc/develop/bootstd.rst
> @@ -306,7 +306,7 @@ media device::
>  
>  The bootdev device is typically created automatically in the media uclass'
>  `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 */
>      ret = bootdev_setup_for_dev(dev, "eth_bootdev");
> @@ -316,7 +316,7 @@ The bootdev device is typically created automatically in the media uclass'
>  or::
>  
>      /* 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)
>          return log_msg_ret("bootdev", ret);
>  
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 01d9b0201f2c..0e157672eae0 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -421,7 +421,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
>  	mmc->cfg = cfg;
>  	mmc->priv = dev;
>  
> -	ret = bootdev_setup_sibling_blk(bdev, "mmc_bootdev");
> +	ret = bootdev_setup_for_sibling_blk(bdev, "mmc_bootdev");
>  	if (ret)
>  		return log_msg_ret("bootdev", ret);
>  
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> index a7add66ab4d1..20dc910d8a33 100644
> --- a/drivers/nvme/nvme.c
> +++ b/drivers/nvme/nvme.c
> @@ -910,7 +910,7 @@ int nvme_init(struct udevice *udev)
>  		if (ret)
>  			goto free_id;
>  
> -		ret = bootdev_setup_sibling_blk(ns_udev, "nvme_bootdev");
> +		ret = bootdev_setup_for_sibling_blk(ns_udev, "nvme_bootdev");
>  		if (ret)
>  			return log_msg_ret("bootdev", ret);
>  
> diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
> index 6caeb3fcdd0d..0a3420b7fbc2 100644
> --- a/drivers/scsi/scsi.c
> +++ b/drivers/scsi/scsi.c
> @@ -607,7 +607,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
>  		/* TODO: undo create */
>  		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)
>  		return log_msg_ret("bd", ret);
>  
> diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
> index 31bb21c534e5..87323ab6d193 100644
> --- a/drivers/virtio/virtio-uclass.c
> +++ b/drivers/virtio/virtio-uclass.c
> @@ -248,7 +248,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
>  	device_set_name_alloced(vdev);
>  
>  	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)
>  			return log_msg_ret("bootdev", ret);
>  	}
> diff --git a/include/bootdev.h b/include/bootdev.h
> index 1533adfe5065..848233187f87 100644
> --- a/include/bootdev.h
> +++ b/include/bootdev.h
> @@ -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)
>   *
> - * 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.
>   *
>   * 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);
>  
>  /**
> - * 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
>   * 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
>   * 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
> @@ -428,8 +428,8 @@ static inline int bootdev_setup_for_dev(struct udevice *parent,
>  	return 0;
>  }
>  
> -static inline int bootdev_setup_sibling_blk(struct udevice *blk,
> -					    const char *drv_name)
> +static inline int bootdev_setup_for_sibling_blk(struct udevice *blk,
> +						const char *drv_name)
>  {
>  	return 0;
>  }
> -- 
> 2.41.0.487.g6d72f3e995-goog

  parent reply	other threads:[~2023-07-31 17:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-30 17:15 [PATCH v2 0/9] x86: Improve bootstd support Simon Glass
2023-07-30 17:15 ` [PATCH v2 1/9] fs: fat: Support reading from a larger block size Simon Glass
2023-08-03  9:47   ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 2/9] usb: Return -ENOENT when no devices are found Simon Glass
2023-07-31  2:05   ` Bin Meng
2023-07-31  2:50     ` Simon Glass
2023-08-03  9:55     ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 3/9] lib: Suppress E when writing error-string output Simon Glass
2023-07-31  2:05   ` Bin Meng
2023-08-03  9:56     ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 4/9] bootstd: Rename bootdev_setup_sibling_blk() Simon Glass
2023-07-31  2:05   ` Bin Meng
2023-07-31 17:22   ` Mattijs Korpershoek [this message]
2023-08-03  9:57     ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 5/9] bootstd: Correct creating of bootdev sibling Simon Glass
2023-07-31  1:58   ` Bin Meng
2023-07-31  2:50     ` Simon Glass
2023-07-31  3:37       ` Bin Meng
2023-07-31 13:59         ` Simon Glass
2023-08-03  9:58   ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 6/9] bootstd: Add some more debugging in the bootdev uclass Simon Glass
2023-07-31  2:05   ` Bin Meng
2023-08-03  9:59     ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 7/9] x86: coreboot: Add IDE and SATA Simon Glass
2023-07-31  2:03   ` Bin Meng
2023-07-31  2:50     ` Simon Glass
2023-08-03 10:27       ` Bin Meng
2023-07-30 17:15 ` [PATCH v2 8/9] x86: coreboot: Enable standard boot Simon Glass
2023-07-30 17:15 ` [PATCH v2 9/9] x86: coreboot: Enable support for CBFS Simon Glass
2023-07-31  2:04   ` Bin Meng
2023-08-03 10:01     ` Bin Meng
2023-08-03 10:07       ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6pk2dxo.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=bmeng.cn@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=marex@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox