[PATCH 1/4] fwu: gpt: use cached meta-data partition numbers

Jassi Brar jassisinghbrar at gmail.com
Mon Nov 7 19:41:38 CET 2022


On Mon, Nov 7, 2022 at 11:24 AM Etienne Carriere
<etienne.carriere at linaro.org> wrote:
>
> Hello Jassi,
>
> Acked-by: Etienne Carriere <etienne.carriere at linaro.org>
> with the 2 below comments addressed.
>
> On Fri, 4 Nov 2022 at 03:42, <jassisinghbrar at gmail.com> wrote:
> >
> > From: Jassi Brar <jaswinder.singh at linaro.org>
> >
> > Use cached values and avoid parsing and scanning through partitions
> > everytime for meta-data partitions because they can't change after bootup.
> >
> > Signed-off-by: Jassi Brar <jaswinder.singh at linaro.org>
> > ---
> >  drivers/fwu-mdata/gpt_blk.c | 43 +++++++++++++++++++++----------------
> >  1 file changed, 24 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/fwu-mdata/gpt_blk.c b/drivers/fwu-mdata/gpt_blk.c
> > index d35ce49c5c..d706e3d4e4 100644
> > --- a/drivers/fwu-mdata/gpt_blk.c
> > +++ b/drivers/fwu-mdata/gpt_blk.c
> > @@ -24,8 +24,9 @@ enum {
> >         MDATA_WRITE,
> >  };
> >
> > -static int gpt_get_mdata_partitions(struct blk_desc *desc,
> > -                                   uint mdata_parts[2])
> > +static uint g_mdata_part[2] = {0, 0};
>
> Not needed to initialize to 0.
>   "static uint g_mdata_part[2];"   is enough.
>
I am aware. The 0 is like an explicit poison value that we test
against for un-initialized partition numbers.

> > +
> > +static int gpt_get_mdata_partitions(struct blk_desc *desc)
> >  {
> >         int i, ret;
> >         u32 nparts;
> > @@ -33,18 +34,19 @@ static int gpt_get_mdata_partitions(struct blk_desc *desc,
> >         struct disk_partition info;
> >         const efi_guid_t fwu_mdata_guid = FWU_MDATA_GUID;
> >
> > +       /* if primary and secondary partitons already found */
>
> s/partitons/partitions/
>
ok

Thank you!


More information about the U-Boot mailing list