[PATCH v5 3/6] fpga: xilinx: pass an address of xilinx_desc in fpga_desc
Oleksandr Suvorov
oleksandr.suvorov at foundries.io
Tue Dec 14 15:48:24 CET 2021
Pass an address of xilinx_desc pointer in an fpga_desc to use parent
fpga_desc structure members inside a xilinx fpga driver.
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
Tested-by: Ricardo Salveti <ricardo at foundries.io>
---
(no changes since v1)
drivers/fpga/fpga.c | 4 ++--
drivers/fpga/xilinx.c | 4 +++-
include/xilinx.h | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
index 2266c7d83a4..781ab8bbef0 100644
--- a/drivers/fpga/fpga.c
+++ b/drivers/fpga/fpga.c
@@ -277,8 +277,8 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype)
switch (desc->devtype) {
case fpga_xilinx:
#if defined(CONFIG_FPGA_XILINX)
- ret_val = xilinx_load(desc->devdesc, buf, bsize,
- bstype);
+ ret_val = xilinx_load((xilinx_desc **)&desc->devdesc,
+ buf, bsize, bstype);
#else
fpga_no_sup((char *)__func__, "Xilinx devices");
#endif
diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c
index 6bc1bc491fb..640baac66e6 100644
--- a/drivers/fpga/xilinx.c
+++ b/drivers/fpga/xilinx.c
@@ -138,9 +138,11 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
return fpga_load(devnum, dataptr, swapsize, bstype);
}
-int xilinx_load(xilinx_desc *desc, const void *buf, size_t bsize,
+int xilinx_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
bitstream_type bstype)
{
+ xilinx_desc *desc = *desc_ptr;
+
if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
return FPGA_FAIL;
diff --git a/include/xilinx.h b/include/xilinx.h
index ab4537becfa..57b0e7be113 100644
--- a/include/xilinx.h
+++ b/include/xilinx.h
@@ -58,7 +58,7 @@ struct xilinx_fpga_op {
/* Generic Xilinx Functions
*********************************************************************/
-int xilinx_load(xilinx_desc *desc, const void *image, size_t size,
+int xilinx_load(xilinx_desc **desc_ptr, const void *image, size_t size,
bitstream_type bstype);
int xilinx_dump(xilinx_desc *desc, const void *buf, size_t bsize);
int xilinx_info(xilinx_desc *desc);
--
2.33.1
More information about the U-Boot
mailing list