Skip to content

Commit 1ed585c

Browse files
committed
atca_iface.h: Fix function mismatches in function pointers
Newer compilers e.g. clang16 can detect signature mismatches in the functions used as function pointers, therefore correct the function prototypes and ensure the typedefs they use are available at the time of use Fixes 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] (*hal)->halinit = cfg->atcacustom.halinit; ^ ~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 parent 86b3046 commit 1ed585c

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/atca_iface.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ typedef enum
8181
ATCA_KIT_SPI_IFACE,
8282
ATCA_KIT_UNKNOWN_IFACE } ATCAKitType;
8383

84+
typedef struct atca_iface * ATCAIface;
8485

8586
/* ATCAIfaceCfg is the configuration object for a device
8687
*/
8788

88-
typedef struct
89+
typedef struct ATCAIfaceCfgType
8990
{
9091

9192
ATCAIfaceType iface_type; // active iface - how to interpret the union below
@@ -147,13 +148,13 @@ typedef struct
147148

148149
struct
149150
{
150-
ATCA_STATUS (*halinit)(void *hal, void *cfg);
151-
ATCA_STATUS (*halpostinit)(void *iface);
152-
ATCA_STATUS (*halsend)(void *iface, uint8_t word_address, uint8_t *txdata, int txlength);
153-
ATCA_STATUS (*halreceive)(void *iface, uint8_t word_address, uint8_t* rxdata, uint16_t* rxlength);
154-
ATCA_STATUS (*halwake)(void *iface);
155-
ATCA_STATUS (*halidle)(void *iface);
156-
ATCA_STATUS (*halsleep)(void *iface);
151+
ATCA_STATUS (*halinit)(ATCAIface hal, struct ATCAIfaceCfgType* cfg);
152+
ATCA_STATUS (*halpostinit)(ATCAIface iface);
153+
ATCA_STATUS (*halsend)(ATCAIface iface, uint8_t word_address, uint8_t *txdata, int txlength);
154+
ATCA_STATUS (*halreceive)(ATCAIface iface, uint8_t word_address, uint8_t* rxdata, uint16_t* rxlength);
155+
ATCA_STATUS (*halwake)(ATCAIface iface);
156+
ATCA_STATUS (*halidle)(ATCAIface iface);
157+
ATCA_STATUS (*halsleep)(ATCAIface iface);
157158
ATCA_STATUS (*halrelease)(void* hal_data);
158159
} atcacustom;
159160
} ATCA_IFACECFG_NAME(cfg);
@@ -163,10 +164,6 @@ typedef struct
163164
void * cfg_data; // opaque data used by HAL in device discovery
164165
} ATCAIfaceCfg;
165166

166-
167-
168-
typedef struct atca_iface * ATCAIface;
169-
170167
/** \brief HAL Driver Structure
171168
*/
172169
typedef struct

0 commit comments

Comments
 (0)