[PATCH] pbl: factor out pbl_bio API into pbl/bio.h

Sascha Hauer sha at pengutronix.de
Mon Aug 8 05:45:24 PDT 2022


On Fri, Aug 05, 2022 at 10:21:37AM +0200, Ahmad Fatoum wrote:
> We'll be adding more PBL driver interface definitions into
> include/pbl, so move the block I/O stuff there as well.
> 
> No functional change.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  arch/arm/mach-at91/at91sam9_xload_mmc.c |  2 +-
>  arch/arm/mach-at91/include/mach/xload.h |  2 +-
>  arch/arm/mach-at91/xload-mmc.c          |  2 +-
>  drivers/mci/atmel-sdhci-pbl.c           |  2 +-
>  fs/fat/fat-pbl.c                        |  2 +-
>  include/pbl.h                           | 13 -------------
>  include/pbl/bio.h                       | 19 +++++++++++++++++++
>  7 files changed, 24 insertions(+), 18 deletions(-)
>  create mode 100644 include/pbl/bio.h

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-at91/at91sam9_xload_mmc.c b/arch/arm/mach-at91/at91sam9_xload_mmc.c
> index 64266757d63a..5cf41c483d0f 100644
> --- a/arch/arm/mach-at91/at91sam9_xload_mmc.c
> +++ b/arch/arm/mach-at91/at91sam9_xload_mmc.c
> @@ -3,7 +3,7 @@
>  
>  #include <debug_ll.h>
>  #include <common.h>
> -#include <pbl.h>
> +#include <pbl/bio.h>
>  
>  #include <linux/sizes.h>
>  #include <asm/cache.h>
> diff --git a/arch/arm/mach-at91/include/mach/xload.h b/arch/arm/mach-at91/include/mach/xload.h
> index 82db65e30768..6b9492193b96 100644
> --- a/arch/arm/mach-at91/include/mach/xload.h
> +++ b/arch/arm/mach-at91/include/mach/xload.h
> @@ -4,7 +4,7 @@
>  #define __MACH_XLOAD_H
>  
>  #include <linux/compiler.h>
> -#include <pbl.h>
> +#include <pbl/bio.h>
>  
>  void __noreturn sama5d2_sdhci_start_image(u32 r4);
>  void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,
> diff --git a/arch/arm/mach-at91/xload-mmc.c b/arch/arm/mach-at91/xload-mmc.c
> index 28d122f0a357..33e5b203fe90 100644
> --- a/arch/arm/mach-at91/xload-mmc.c
> +++ b/arch/arm/mach-at91/xload-mmc.c
> @@ -9,7 +9,7 @@
>  #include <mach/gpio.h>
>  #include <linux/sizes.h>
>  #include <asm/cache.h>
> -#include <pbl.h>
> +#include <pbl/bio.h>
>  
>  static void at91_fat_start_image(struct pbl_bio *bio,
>  				 void *buf, unsigned int len,
> diff --git a/drivers/mci/atmel-sdhci-pbl.c b/drivers/mci/atmel-sdhci-pbl.c
> index 626e4008fe85..2c5f107abd7e 100644
> --- a/drivers/mci/atmel-sdhci-pbl.c
> +++ b/drivers/mci/atmel-sdhci-pbl.c
> @@ -8,7 +8,7 @@
>   */
>  
>  #include <common.h>
> -#include <pbl.h>
> +#include <pbl/bio.h>
>  #include <mci.h>
>  #include <debug_ll.h>
>  #include <mach/xload.h>
> diff --git a/fs/fat/fat-pbl.c b/fs/fat/fat-pbl.c
> index 93cd6decbcb0..6b8a807657d4 100644
> --- a/fs/fat/fat-pbl.c
> +++ b/fs/fat/fat-pbl.c
> @@ -8,10 +8,10 @@
>  #define pr_fmt(fmt) "fat-pbl: " fmt
>  
>  #include <common.h>
> +#include <pbl/bio.h>
>  #include "integer.h"
>  #include "ff.h"
>  #include "diskio.h"
> -#include "pbl.h"
>  
>  DRESULT disk_read(FATFS *fat, BYTE *buf, DWORD sector, BYTE count)
>  {
> diff --git a/include/pbl.h b/include/pbl.h
> index f58daec7351a..0dc23c72dcf5 100644
> --- a/include/pbl.h
> +++ b/include/pbl.h
> @@ -15,19 +15,6 @@ void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len
>  
>  #ifdef __PBL__
>  #define IN_PBL	1
> -
> -struct pbl_bio {
> -	void *priv;
> -	int (*read)(struct pbl_bio *bio, off_t block_off, void *buf, unsigned nblocks);
> -};
> -
> -static inline int pbl_bio_read(struct pbl_bio *bio, off_t block_off,
> -			       void *buf, unsigned nblocks)
> -{
> -	return bio->read(bio, block_off, buf, nblocks);
> -}
> -
> -ssize_t pbl_fat_load(struct pbl_bio *, const char *filename, void *dest, size_t len);
>  #else
>  #define IN_PBL	0
>  #endif
> diff --git a/include/pbl/bio.h b/include/pbl/bio.h
> new file mode 100644
> index 000000000000..79e47451a0e4
> --- /dev/null
> +++ b/include/pbl/bio.h
> @@ -0,0 +1,19 @@
> +#ifndef __PBL_BIO_H__
> +#define __PBL_BIO_H__
> +
> +#include <linux/types.h>
> +
> +struct pbl_bio {
> +	void *priv;
> +	int (*read)(struct pbl_bio *bio, off_t block_off, void *buf, unsigned nblocks);
> +};
> +
> +static inline int pbl_bio_read(struct pbl_bio *bio, off_t block_off,
> +			       void *buf, unsigned nblocks)
> +{
> +	return bio->read(bio, block_off, buf, nblocks);
> +}
> +
> +ssize_t pbl_fat_load(struct pbl_bio *, const char *filename, void *dest, size_t len);
> +
> +#endif /* __PBL_H__ */
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list