|
| 1 | +From 0b76ffe124719f96fe8bc3daf6410cf3198309f4 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Khem Raj < [email protected]> |
| 3 | +Date: Mon, 13 Feb 2023 22:07:10 -0800 |
| 4 | +Subject: [PATCH] atca_iface.h: Fix function mismatches in function pointers |
| 5 | + |
| 6 | +Newer compilers e.g. clang16 can detect signature mismatches in the |
| 7 | +functions used as function pointers, therefore correct the function |
| 8 | +prototypes and ensure the typedefs they use are available at the time of |
| 9 | +use |
| 10 | + |
| 11 | +Fixes |
| 12 | +lib/hal/atca_hal.c:310:33: error: incompatible function pointer types assigning to 'ATCA_STATUS (*)(ATCAIface, ATCAIfaceCfg *)' (aka 'ATCA_STATUS (*)(struct atca_iface *, ATCAIfaceCfg *)') from 'ATCA_STATUS (*)(void *, void *)' [-Wincompatible-function- pointer-types] |
| 13 | + (*hal)->halinit = cfg->atcacustom.halinit; |
| 14 | + ^ ~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 | + |
| 16 | +Upstream-Status: Submitted [https://github.com/MicrochipTech/cryptoauthlib/pull/330] |
| 17 | +Signed-off-by: Khem Raj < [email protected]> |
| 18 | +--- |
| 19 | + lib/atca_iface.h | 21 +++++++++------------ |
| 20 | + 1 file changed, 9 insertions(+), 12 deletions(-) |
| 21 | + |
| 22 | +diff --git a/lib/atca_iface.h b/lib/atca_iface.h |
| 23 | +index 9dfc422..e669b33 100644 |
| 24 | +--- a/lib/atca_iface.h |
| 25 | ++++ b/lib/atca_iface.h |
| 26 | +@@ -81,11 +81,12 @@ typedef enum |
| 27 | + ATCA_KIT_SPI_IFACE, |
| 28 | + ATCA_KIT_UNKNOWN_IFACE } ATCAKitType; |
| 29 | + |
| 30 | ++typedef struct atca_iface * ATCAIface; |
| 31 | + |
| 32 | + /* ATCAIfaceCfg is the configuration object for a device |
| 33 | + */ |
| 34 | + |
| 35 | +-typedef struct |
| 36 | ++typedef struct ATCAIfaceCfgType |
| 37 | + { |
| 38 | + |
| 39 | + ATCAIfaceType iface_type; // active iface - how to interpret the union below |
| 40 | +@@ -147,13 +148,13 @@ typedef struct |
| 41 | + |
| 42 | + struct |
| 43 | + { |
| 44 | +- ATCA_STATUS (*halinit)(void *hal, void *cfg); |
| 45 | +- ATCA_STATUS (*halpostinit)(void *iface); |
| 46 | +- ATCA_STATUS (*halsend)(void *iface, uint8_t word_address, uint8_t *txdata, int txlength); |
| 47 | +- ATCA_STATUS (*halreceive)(void *iface, uint8_t word_address, uint8_t* rxdata, uint16_t* rxlength); |
| 48 | +- ATCA_STATUS (*halwake)(void *iface); |
| 49 | +- ATCA_STATUS (*halidle)(void *iface); |
| 50 | +- ATCA_STATUS (*halsleep)(void *iface); |
| 51 | ++ ATCA_STATUS (*halinit)(ATCAIface hal, struct ATCAIfaceCfgType* cfg); |
| 52 | ++ ATCA_STATUS (*halpostinit)(ATCAIface iface); |
| 53 | ++ ATCA_STATUS (*halsend)(ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength); |
| 54 | ++ ATCA_STATUS (*halreceive)(ATCAIface iface, uint8_t word_address, uint8_t* rxdata, uint16_t* rxlength); |
| 55 | ++ ATCA_STATUS (*halwake)(ATCAIface iface); |
| 56 | ++ ATCA_STATUS (*halidle)(ATCAIface iface); |
| 57 | ++ ATCA_STATUS (*halsleep)(ATCAIface iface); |
| 58 | + ATCA_STATUS (*halrelease)(void* hal_data); |
| 59 | + } atcacustom; |
| 60 | + } ATCA_IFACECFG_NAME(cfg); |
| 61 | +@@ -163,10 +164,6 @@ typedef struct |
| 62 | + void * cfg_data; // opaque data used by HAL in device discovery |
| 63 | + } ATCAIfaceCfg; |
| 64 | + |
| 65 | +- |
| 66 | +- |
| 67 | +-typedef struct atca_iface * ATCAIface; |
| 68 | +- |
| 69 | + /** \brief HAL Driver Structure |
| 70 | + */ |
| 71 | + typedef struct |
| 72 | +-- |
| 73 | +2.39.1 |
| 74 | + |
0 commit comments