[Skiboot] [PATCH 2/3] external/opal-prd: Drop final use of ffs_open_image()

Joel Stanley joel at jms.id.au
Thu Dec 17 17:20:25 AEDT 2015


Hey Cyril,

On Thu, Dec 17, 2015 at 1:29 PM, Cyril Bur <cyril.bur at au1.ibm.com> wrote:
> ffs_open_image() is only called from one place and its function has been
> superseded by the blocklevel_device interface to access files/mtd/flash.
>
> Ultimately it looks like opal-prd should be converted to use the full set
> of features provided by blocklevel but for now this patch allows code to be
> ripped out of libffs.

Perhaps we should do that work now?

>
> Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
> ---
>  external/opal-prd/pnor.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/external/opal-prd/pnor.c b/external/opal-prd/pnor.c
> index 43814ab..ec53ac2 100644
> --- a/external/opal-prd/pnor.c
> +++ b/external/opal-prd/pnor.c
> @@ -33,6 +33,7 @@
>  int pnor_init(struct pnor *pnor)
>  {
>         int rc, fd;
> +       struct blocklevel_device *bl;
>         mtd_info_t mtd_info;
>
>         if (!pnor)
> @@ -67,10 +68,17 @@ int pnor_init(struct pnor *pnor)
>         pr_debug("PNOR: Found PNOR: %d bytes (%d blocks)", pnor->size,
>                pnor->erasesize);
>
> -       rc = ffs_open_image(fd, pnor->size, 0, &pnor->ffsh);
> +       rc = file_init(fd, &bl);

I know it's not added as part of this series, but file_init is a
pretty generic name of the api. I'd prefer to see libflash_file_init
or similar.

> +       if (rc) {
> +               pr_log(LOG_ERR, "PNOR: Couldn't blocklevel for pnor partition table");

Do you even blocklevel?

Perhaps:

pr_log(LOG_ERR, "PNOR: libflash_file_init failed");

> +               goto out;
> +       }
> +
> +       rc = ffs_init(0, pnor->size, 0, bl, &pnor->ffsh, 0);
>         if (rc)
>                 pr_log(LOG_ERR, "PNOR: Failed to open pnor partition table");
>
> +       file_exit(bl);
>  out:
>         close(fd);
>
> --
> 2.6.3
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot


More information about the Skiboot mailing list