David Hendricks has uploaded this change for review.

View Change

Move get_layout() from flashrom.c to layout.c

Change-Id: Ic67cf53abddc0aa905674acbcde717d9aed2f66e
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
---
M flashrom.c
M layout.c
M layout.h
3 files changed, 12 insertions(+), 8 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/67/21367/1
diff --git a/flashrom.c b/flashrom.c
index c600efc..7a3d9bf 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1529,14 +1529,6 @@
return 0;
}

-static const struct flashrom_layout *get_layout(const struct flashctx *const flashctx)
-{
- if (flashctx->layout && flashctx->layout->num_entries)
- return flashctx->layout;
- else
- return &flashctx->fallback_layout.base;
-}
-
/**
* @brief Reads the included layout regions into a buffer.
*
diff --git a/layout.c b/layout.c
index 9bf0b03..c416ec8 100644
--- a/layout.c
+++ b/layout.c
@@ -40,6 +40,14 @@
return &layout;
}

+const struct flashrom_layout *get_layout(const struct flashctx *const flashctx)
+{
+ if (flashctx->layout && flashctx->layout->num_entries)
+ return flashctx->layout;
+ else
+ return &flashctx->fallback_layout.base;
+}
+
#ifndef __LIBPAYLOAD__
int read_romlayout(const char *name)
{
diff --git a/layout.h b/layout.h
index f32dc82..3f78ced 100644
--- a/layout.h
+++ b/layout.h
@@ -28,6 +28,9 @@
#include <stddef.h>
#include <stdint.h>

+struct flashrom_flashctx;
+#define flashctx flashrom_flashctx /* TODO: Agree on a name and convert all occurences. */
+
/* Types and macros regarding the maximum flash space size supported by generic code. */
typedef uint32_t chipoff_t; /* Able to store any addressable offset within a supported flash memory. */
typedef uint32_t chipsize_t; /* Able to store the number of bytes of any supported flash memory. */
@@ -58,6 +61,7 @@
};

struct flashrom_layout *get_global_layout(void);
+const struct flashrom_layout *get_layout(const struct flashctx *const flashctx);

int process_include_args(struct flashrom_layout *);

To view, visit change 21367. To unsubscribe, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic67cf53abddc0aa905674acbcde717d9aed2f66e
Gerrit-Change-Number: 21367
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks@gmail.com>