aboutsummaryrefslogtreecommitdiff
path: root/external/pflash
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-08-26 16:02:32 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-08-28 15:24:04 +1000
commit315acaa5d6a271d2dd6516a358a38c51c10667fa (patch)
tree6c8126f2493804c7983ec3b339cca73d9e5ee4c1 /external/pflash
parent123441e17fc5a9a40e45fde5ecc8209e5c0ad0cc (diff)
downloadskiboot-315acaa5d6a271d2dd6516a358a38c51c10667fa.zip
skiboot-315acaa5d6a271d2dd6516a358a38c51c10667fa.tar.gz
skiboot-315acaa5d6a271d2dd6516a358a38c51c10667fa.tar.bz2
libflash: Return a pointer to internal structure.
There are some functions (notably: erase_chip and set_4b_mode) which cannot be abstracted away by the blocklevel interface, this means that if they are really needed (by pflash for example) then at the moment a program like pflash would need to pass a blocklevel_device struct to libflash. This forces libflash to trust that it was given a blocklevel that it did init. If it didn't init it the container_of call will return junk and libflash has no way to protect its self. This method (while very useful) has destroyed type safety. As such, this commit reintroduces some typesafety back into this stack. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/pflash')
-rw-r--r--external/pflash/pflash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index 0d2d669..5c10037 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -434,7 +434,7 @@ static void flash_access_setup_bmc(bool use_lpc, bool need_write)
}
/* Open flash chip */
- rc = flash_init(fl_ctrl, &bl);
+ rc = flash_init(fl_ctrl, &bl, NULL);
if (rc) {
fprintf(stderr, "Failed to open flash chip\n");
exit(1);
@@ -493,7 +493,7 @@ static void flash_access_setup_pnor(bool use_lpc, bool use_sfc, bool need_write)
#endif
/* Open flash chip */
- rc = flash_init(fl_ctrl, &bl);
+ rc = flash_init(fl_ctrl, &bl, NULL);
if (rc) {
fprintf(stderr, "Failed to open flash chip\n");
exit(1);