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

Cyril Bur cyril.bur at au1.ibm.com
Fri Dec 18 10:42:17 AEDT 2015


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.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
V2: Changed error message to Joels suggestion. When the work to rename
file_init() gets done I'll tweak it (and another others) to better reflect
the new name.

 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..7c98603 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);
+	if (rc) {
+		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



More information about the Skiboot mailing list