[Skiboot] [PATCH 03/16] libffs: Add comment for to clarify endian requirments

Michael Neuling mikey at neuling.org
Fri Feb 20 11:37:46 AEDT 2015

In some parts of libffs we access struct ffs_entry with endian access and in
other parts we don't.  This adds a comment to clarify why we do this.

Signed-off-by: Michael Neuling <mikey at neuling.org>
 libflash/libffs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libflash/libffs.c b/libflash/libffs.c
index ef2aa4d..abb9775 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -267,6 +267,10 @@ int ffs_update_act_size(struct ffs_handle *ffs, uint32_t part_idx,
 	FL_DBG("FFS: part index %d at offset 0x%08x\n",
 	       part_idx, offset);
+	/*
+	 * NOTE: We are accessing the unconverted ffs_entry from the PNOR here
+	 * (since we are going to write it back) so we need to be endian safe.
+	 */
 	if (ent->actual == cpu_to_be32(act_size)) {
 		FL_DBG("FFS: ent->actual alrady matches: 0x%08x==0x%08x\n",
 		       cpu_to_be32(act_size), ent->actual);

More information about the Skiboot mailing list