From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: "Heinrich Schuchardt" <xypron.glpk@gmx.de>,
"Caleb Connolly" <caleb.connolly@linaro.org>,
"Dragan Simic" <dsimic@manjaro.org>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Nam Cao" <namcao@linutronix.de>,
"Peter Robinson" <pbrobinson@gmail.com>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Tony Dinh" <mibodhi@gmail.com>,
"U-Boot Mailing List" <u-boot@lists.denx.de>
Subject: Re: [PATCH v3 01/19] bootstd: Move bootflow-adding to bootstd
Date: Tue, 5 Nov 2024 09:39:39 -0600 [thread overview]
Message-ID: <20241105153939.GG3600562@bill-the-cat> (raw)
In-Reply-To: <CAFLszTg6=FOJa0-=ywoNEkhSSSSoCE2mtHCQyTiWYqvZmQFRCg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7415 bytes --]
On Tue, Nov 05, 2024 at 08:13:04AM -0700, Simon Glass wrote:
> Hi Heinrich,
>
> On Mon, 4 Nov 2024 at 15:15, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > On 11/4/24 18:50, Simon Glass wrote:
> > > This relates to more than just the bootdev, since there is a global list
> > > of bootflows. Move the function to the bootstd file and rename it.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > > (no changes since v1)
> > >
> > > boot/bootdev-uclass.c | 25 -------------------------
> > > boot/bootstd-uclass.c | 25 +++++++++++++++++++++++++
> > > cmd/bootflow.c | 2 +-
> > > include/bootdev.h | 15 ---------------
> > > include/bootstd.h | 17 +++++++++++++++++
> > > 5 files changed, 43 insertions(+), 41 deletions(-)
> > >
> > > diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
> > > index 64ec4fde493..eddbf60600c 100644
> > > --- a/boot/bootdev-uclass.c
> > > +++ b/boot/bootdev-uclass.c
> > > @@ -32,31 +32,6 @@ enum {
> > > BOOT_TARGETS_MAX_LEN = 100,
> > > };
> > >
> > > -int bootdev_add_bootflow(struct bootflow *bflow)
> > > -{
> > > - struct bootstd_priv *std;
> > > - struct bootflow *new;
> > > - int ret;
> > > -
> > > - ret = bootstd_get_priv(&std);
> > > - if (ret)
> > > - return ret;
> > > -
> > > - new = malloc(sizeof(*bflow));
> > > - if (!new)
> > > - return log_msg_ret("bflow", -ENOMEM);
> > > - memcpy(new, bflow, sizeof(*bflow));
> > > -
> > > - list_add_tail(&new->glob_node, &std->glob_head);
> > > - if (bflow->dev) {
> > > - struct bootdev_uc_plat *ucp = dev_get_uclass_plat(bflow->dev);
> > > -
> > > - list_add_tail(&new->bm_node, &ucp->bootflow_head);
> > > - }
> > > -
> > > - return 0;
> > > -}
> > > -
> > > int bootdev_first_bootflow(struct udevice *dev, struct bootflow **bflowp)
> > > {
> > > struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev);
> > > diff --git a/boot/bootstd-uclass.c b/boot/bootstd-uclass.c
> > > index fdb8d69e320..bf6e49ad97a 100644
> > > --- a/boot/bootstd-uclass.c
> > > +++ b/boot/bootstd-uclass.c
> > > @@ -61,6 +61,31 @@ void bootstd_clear_glob(void)
> > > bootstd_clear_glob_(std);
> > > }
> > >
> > > +int bootstd_add_bootflow(struct bootflow *bflow)
> > > +{
> > > + struct bootstd_priv *std;
> > > + struct bootflow *new;
> > > + int ret;
> > > +
> > > + ret = bootstd_get_priv(&std);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + new = malloc(sizeof(*bflow));
> > > + if (!new)
> > > + return log_msg_ret("bflow", -ENOMEM);
> > > + memcpy(new, bflow, sizeof(*bflow));
> > > +
> > > + list_add_tail(&new->glob_node, &std->glob_head);
> > > + if (bflow->dev) {
> > > + struct bootdev_uc_plat *ucp = dev_get_uclass_plat(bflow->dev);
> > > +
> > > + list_add_tail(&new->bm_node, &ucp->bootflow_head);
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > static int bootstd_remove(struct udevice *dev)
> > > {
> > > struct bootstd_priv *priv = dev_get_priv(dev);
> > > diff --git a/cmd/bootflow.c b/cmd/bootflow.c
> > > index f67948d7368..8962464bbf8 100644
> > > --- a/cmd/bootflow.c
> > > +++ b/cmd/bootflow.c
> > > @@ -207,7 +207,7 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
> > > bflow.err = ret;
> > > if (!ret)
> > > num_valid++;
> > > - ret = bootdev_add_bootflow(&bflow);
> > > + ret = bootstd_add_bootflow(&bflow);
> > > if (ret) {
> > > printf("Out of memory\n");
> > > return CMD_RET_FAILURE;
> > > diff --git a/include/bootdev.h b/include/bootdev.h
> > > index ad4af0d1310..8db198dd56b 100644
> > > --- a/include/bootdev.h
> > > +++ b/include/bootdev.h
> > > @@ -195,21 +195,6 @@ void bootdev_list(bool probe);
> > > */
> > > void bootdev_clear_bootflows(struct udevice *dev);
> > >
> > > -/**
> > > - * bootdev_add_bootflow() - Add a bootflow to the bootdev's list
> > > - *
> > > - * All fields in @bflow must be set up. Note that @bflow->dev is used to add the
> > > - * bootflow to that device.
> > > - *
> > > - * @dev: Bootdev device to add to
> > > - * @bflow: Bootflow to add. Note that fields within bflow must be allocated
> > > - * since this function takes over ownership of these. This functions makes
> > > - * a copy of @bflow itself (without allocating its fields again), so the
> > > - * caller must dispose of the memory used by the @bflow pointer itself
> > > - * Return: 0 if OK, -ENOMEM if out of memory
> > > - */
> > > -int bootdev_add_bootflow(struct bootflow *bflow);
> > > -
> > > /**
> > > * bootdev_first_bootflow() - Get the first bootflow from a bootdev
> > > *
> > > diff --git a/include/bootstd.h b/include/bootstd.h
> > > index ac756e98d84..3fc93a4ec2e 100644
> > > --- a/include/bootstd.h
> > > +++ b/include/bootstd.h
> > > @@ -105,4 +105,21 @@ void bootstd_clear_glob(void);
> > > */
> > > int bootstd_prog_boot(void);
> > >
> > > +/**
> > > + * bootstd_add_bootflow() - Add a bootflow to the bootdev's and global list
> > > + *
> > > + * All fields in @bflow must be set up. Note that @bflow->dev is used to add the
> > > + * bootflow to that device.
> > > + *
> > > + * The bootflow is also added to the global list of all bootflows
> > > + *
> > > + * @dev: Bootdev device to add to
> >
> > This parameter does not exist.
> >
> > > + * @bflow: Bootflow to add. Note that fields within bflow must be allocated
> > > + * since this function takes over ownership of these. This functions makes
> > > + * a copy of @bflow itself (without allocating its fields again), so the
> > > + * caller must dispose of the memory used by the @bflow pointer itself
> >
> > Please, add the headers to the API documentation and fix the numerous
> > documentation issues like:
> >
> > ./include/bootdev.h:57: warning: Enum value 'BOOTDEVP_0_NONE' not
> > described in enum 'bootdev_prio_t'
> > ./include/bootdev.h:57: warning: Enum value 'BOOTDEVP_1_PRE_SCAN' not
> > described in enum 'bootdev_prio_t'
> > ./include/bootdev.h:57: warning: Enum value 'BOOTDEVP_COUNT' not
> > described in enum 'bootdev_prio_t'
> > ./include/bootdev.h:57: warning: Excess enum value 'BOOTDEVP_6_PRE_SCAN'
> > description in 'bootdev_prio_t'
> > ./include/bootdev.h:118: warning: Function parameter or member
> > 'bootflow_head' not described in 'bootdev_uc_plat'
> > ./include/bootdev.h:118: warning: Function parameter or member 'prio'
> > not described in 'bootdev_uc_plat'
> > ./include/bootdev.h:412: warning: Function parameter or member 'blk' not
> > described in 'bootdev_setup_for_sibling_blk'
> > ./include/bootdev.h:412: warning: Excess function parameter 'parent'
> > description in 'bootdev_setup_for_sibling_blk'
>
> I don't mind doing that in a follow-up once this series is in, but it
> is out-of-scope here.
I think that's flipping the priorities. Documenting what all of this is
supposed to be doing will help explain to the rest of us what you're
intending to do and why it's a good idea and so forth.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2024-11-05 15:39 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 17:50 [PATCH v3 00/19] bootstd: Support recording images Simon Glass
2024-11-04 17:50 ` [PATCH v3 01/19] bootstd: Move bootflow-adding to bootstd Simon Glass
2024-11-04 22:02 ` Heinrich Schuchardt
2024-11-05 15:13 ` Simon Glass
2024-11-05 15:39 ` Tom Rini [this message]
2024-11-05 16:07 ` Simon Glass
2024-11-04 17:50 ` [PATCH v3 02/19] bootstd: Move bootflow-clearing " Simon Glass
2024-11-04 22:04 ` Heinrich Schuchardt
2024-11-04 17:50 ` [PATCH v3 03/19] bootstd: Add a function to get bootstd only if available Simon Glass
2024-11-04 17:50 ` [PATCH v3 04/19] bootstd: Drop the bootdev-specific list of bootflows Simon Glass
2024-11-04 17:50 ` [PATCH v3 05/19] bootstd: Move the bootflow list into an alist Simon Glass
2024-11-04 17:50 ` [PATCH v3 06/19] bootstd: Maintain a list of images Simon Glass
2024-11-04 17:50 ` [PATCH v3 07/19] bootstd: Update bootmeth_alloc_file() to record images Simon Glass
2024-11-04 17:50 ` [PATCH v3 08/19] boot: pxe: Drop the duplicate comment on get_pxe_file() Simon Glass
2024-11-04 17:51 ` [PATCH v3 09/19] bootmeth_efi: Simplify reading files by using the common function Simon Glass
2024-11-04 17:51 ` [PATCH v3 10/19] bootmeth: Update the read_file() method to include a type Simon Glass
2024-11-04 17:51 ` [PATCH v3 11/19] bootmeth_efi: Check the filename-allocation in the network path Simon Glass
2024-11-04 21:42 ` Heinrich Schuchardt
2024-11-15 23:19 ` Simon Glass
2024-11-04 17:51 ` [PATCH v3 12/19] boot: Update extlinux pxe_getfile_func() to include type Simon Glass
2024-11-04 17:51 ` [PATCH v3 13/19] boot: Update pxe bootmeth to record images Simon Glass
2024-11-04 17:51 ` [PATCH v3 14/19] Update bootmeth_alloc_other() " Simon Glass
2024-11-04 17:51 ` [PATCH v3 15/19] bootstd: Update cros bootmeth " Simon Glass
2024-11-04 17:51 ` [PATCH v3 16/19] bootstd: Add a simple command to list images Simon Glass
2024-11-04 17:51 ` [PATCH v3 17/19] bootstd: Export bootdev_get_from_blk() Simon Glass
2024-11-04 17:51 ` [PATCH v3 18/19] bootstd: Add the concept of an ad-hoc bootflow Simon Glass
2024-11-04 17:51 ` [PATCH v3 19/19] fs: Record loaded files in " Simon Glass
2025-01-15 13:55 ` [PATCH v3 00/19] bootstd: Support recording images Simon Glass
2025-01-15 21:24 ` Tom Rini
2025-01-15 23:14 ` Simon Glass
2025-01-15 23:31 ` Tom Rini
2025-01-16 15:52 ` Simon Glass
2025-01-16 17:21 ` Tom Rini
2025-01-18 4:32 ` Simon Glass
2025-01-18 5:49 ` Tony Dinh
2025-01-18 14:41 ` Tom Rini
2025-01-18 19:26 ` Tony Dinh
2025-01-23 14:38 ` Simon Glass
2025-01-23 17:17 ` Tom Rini
2025-01-25 17:13 ` Simon Glass
2025-01-25 18:27 ` Tom Rini
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=20241105153939.GG3600562@bill-the-cat \
--to=trini@konsulko.com \
--cc=caleb.connolly@linaro.org \
--cc=dsimic@manjaro.org \
--cc=ilias.apalodimas@linaro.org \
--cc=mibodhi@gmail.com \
--cc=namcao@linutronix.de \
--cc=pbrobinson@gmail.com \
--cc=sjg@chromium.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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