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

Cyril Bur cyril.bur at au1.ibm.com
Fri Dec 18 09:58:51 AEDT 2015


On Thu, 17 Dec 2015 16:50:25 +1030
Joel Stanley <joel at jms.id.au> wrote:

> 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?

Yep, this is my goal before Chistmas. I came across this and thought that I can
just send these patches out.

I've got some libffs patches too.

> 
> >
> > 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.
> 

I'm not opposed. I can add a rename patch at the start of the series to do the
work mentioned above. Or, might be worth waiting untill Stewart is done playing
with pflash...

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

Well what we're getting is a blocklevel_device structure for the fd soooo...

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

I went to prefer more english, but since I suck at englishing and since this
realistically will never fail... I'll go with that.

> > +               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