diff mbox

[2/4] libflash: Remove dependencies on skiboot.h header

Message ID 1424739530.523192.812987427959.2.gpush@pablo
State Accepted
Headers show

Commit Message

Jeremy Kerr Feb. 24, 2015, 12:58 a.m. UTC
libflash should be compilable without the skiboot definitions.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 libflash/ecc.h    |    5 ++++-
 libflash/libffs.c |    4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Joel Stanley Feb. 25, 2015, 3:50 a.m. UTC | #1
On Tue, Feb 24, 2015 at 11:28 AM, Jeremy Kerr <jk@ozlabs.org> wrote:
> libflash should be compilable without the skiboot definitions.

We should add building the external projects to the Travis build. I
will follow up with a patch that does that.

> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

Reviewed-By: Joel Stanley <joel@jms.id.au>

>
> ---
>  libflash/ecc.h    |    5 ++++-
>  libflash/libffs.c |    4 ++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/libflash/ecc.h b/libflash/ecc.h
> index d5c30cb..581886f 100644
> --- a/libflash/ecc.h
> +++ b/libflash/ecc.h
> @@ -20,7 +20,6 @@
>  #define __ECC_H
>
>  #include <stdint.h>
> -#include <skiboot.h>
>
>  /* Bit field identifiers for syndrome calculations. */
>  enum eccbitfields
> @@ -45,6 +44,10 @@ extern uint8_t eccmemcpy(uint64_t *dst, uint64_t *src, uint32_t len);
>   * We add 1 byte of ecc for every 8 bytes of data.  So we need to round up to 8
>   * bytes length and then add 1/8
>   */
> +#ifndef ALIGN_UP
> +#define ALIGN_UP(_v, _a)       (((_v) + (_a) - 1) & ~((_a) - 1))
> +#endif
> +
>  #define ECC_SIZE(len) (ALIGN_UP((len), 8) >> 3)
>  #define ECC_BUFFER_SIZE(len) (ALIGN_UP((len), 8) + ECC_SIZE(len))
>  #define ECC_BUFFER_SIZE_CHECK(len) ((len) % 9)
> diff --git a/libflash/libffs.c b/libflash/libffs.c
> index c6cf9dd..bce4ac4 100644
> --- a/libflash/libffs.c
> +++ b/libflash/libffs.c
> @@ -24,6 +24,10 @@
>  #include "libffs.h"
>  #include "ecc.h"
>
> +#ifndef MIN
> +#define MIN(a, b)      ((a) < (b) ? (a) : (b))
> +#endif
> +
>  enum ffs_type {
>         ffs_type_flash,
>         ffs_type_image,
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
diff mbox

Patch

diff --git a/libflash/ecc.h b/libflash/ecc.h
index d5c30cb..581886f 100644
--- a/libflash/ecc.h
+++ b/libflash/ecc.h
@@ -20,7 +20,6 @@ 
 #define __ECC_H
 
 #include <stdint.h>
-#include <skiboot.h>
 
 /* Bit field identifiers for syndrome calculations. */
 enum eccbitfields
@@ -45,6 +44,10 @@  extern uint8_t eccmemcpy(uint64_t *dst, uint64_t *src, uint32_t len);
  * We add 1 byte of ecc for every 8 bytes of data.  So we need to round up to 8
  * bytes length and then add 1/8
  */
+#ifndef ALIGN_UP
+#define ALIGN_UP(_v, _a)	(((_v) + (_a) - 1) & ~((_a) - 1))
+#endif
+
 #define ECC_SIZE(len) (ALIGN_UP((len), 8) >> 3)
 #define ECC_BUFFER_SIZE(len) (ALIGN_UP((len), 8) + ECC_SIZE(len))
 #define ECC_BUFFER_SIZE_CHECK(len) ((len) % 9)
diff --git a/libflash/libffs.c b/libflash/libffs.c
index c6cf9dd..bce4ac4 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -24,6 +24,10 @@ 
 #include "libffs.h"
 #include "ecc.h"
 
+#ifndef MIN
+#define MIN(a, b)	((a) < (b) ? (a) : (b))
+#endif
+
 enum ffs_type {
 	ffs_type_flash,
 	ffs_type_image,