net/eui_provider: drop useless EUI provider arg parameter

This has never been used and we might as well define a second
callback function instead of using a generic one with an arg.
This commit is contained in:
Benjamin Valentin 2020-12-10 22:47:06 +01:00
parent 9c20540e3d
commit d4acf95a27
8 changed files with 10 additions and 36 deletions

View File

@ -27,10 +27,8 @@ extern "C" {
/** /**
* @brief AT24Mac provides a EUI-64, this is also printed on the board * @brief AT24Mac provides a EUI-64, this is also printed on the board
*/ */
static inline int _at24mac_get_eui64(const void *arg, eui64_t *addr, uint8_t index) static inline int _at24mac_get_eui64(uint8_t index, eui64_t *addr)
{ {
(void) arg;
return at24mac_get_eui64(index, addr); return at24mac_get_eui64(index, addr);
} }

View File

@ -34,9 +34,8 @@ extern "C" {
/** /**
* @brief Constant in EEPROM provides a EUI-64, this is also printed on the board * @brief Constant in EEPROM provides a EUI-64, this is also printed on the board
*/ */
static inline int _eeprom_mac_get_eui64(const void *arg, eui64_t *addr, uint8_t index) static inline int _eeprom_mac_get_eui64(uint8_t index, eui64_t *addr)
{ {
(void) arg;
(void) index; (void) index;
if (eeprom_read(EEPROM_MAC_ADDR, addr, sizeof(eui64_t)) != sizeof(eui64_t)) { if (eeprom_read(EEPROM_MAC_ADDR, addr, sizeof(eui64_t)) != sizeof(eui64_t)) {

View File

@ -27,10 +27,8 @@ extern "C" {
/** /**
* @brief AT24Mac provides a EUI-48 * @brief AT24Mac provides a EUI-48
*/ */
static inline int _at24mac_get_eui48(const void *arg, eui48_t *addr, uint8_t index) static inline int _at24mac_get_eui48(uint8_t index, eui48_t *addr)
{ {
(void) arg;
return at24mac_get_eui48(index, addr); return at24mac_get_eui48(index, addr);
} }

View File

@ -27,9 +27,8 @@ extern "C" {
/** /**
* @brief EDBG provides a EUI-64, the same that is printed on the board * @brief EDBG provides a EUI-64, the same that is printed on the board
*/ */
static inline int _edbg_get_eui64(const void *arg, eui64_t *addr, uint8_t index) static inline int _edbg_get_eui64(uint8_t index, eui64_t *addr)
{ {
(void) arg;
(void) index; (void) index;
/* EDBG can take a while to respond on cold boot */ /* EDBG can take a while to respond on cold boot */

View File

@ -106,35 +106,32 @@ extern "C" {
/** /**
* @brief Function for providing a EUI-48 to a device * @brief Function for providing a EUI-48 to a device
* *
* @param[in] arg Optional argument provided by eui48_conf_t
* @param[out] addr Destination pointer for the EUI-48 address
* @param[in] index index of the netdev * @param[in] index index of the netdev
* @param[out] addr Destination pointer for the EUI-48 address
* *
* @return 0 on success, next provider in eui48_conf_t will be * @return 0 on success, next provider in eui48_conf_t will be
* used otherwise. * used otherwise.
* Will fall back to @see luid_get_eui48 eventually. * Will fall back to @see luid_get_eui48 eventually.
*/ */
typedef int (*netdev_get_eui48_cb_t)(const void *arg, eui48_t *addr, uint8_t index); typedef int (*netdev_get_eui48_cb_t)(uint8_t index, eui48_t *addr);
/** /**
* @brief Function for providing a EUI-64 to a device * @brief Function for providing a EUI-64 to a device
* *
* @param[in] arg Optional argument provided by eui64_conf_t
* @param[out] addr Destination pointer for the EUI-64 address
* @param[in] index index of the netdev * @param[in] index index of the netdev
* @param[out] addr Destination pointer for the EUI-64 address
* *
* @return 0 on success, next provider in eui64_conf_t will be * @return 0 on success, next provider in eui64_conf_t will be
* used otherwise. * used otherwise.
* Will fall back to @see luid_get_eui64 eventually. * Will fall back to @see luid_get_eui64 eventually.
*/ */
typedef int (*netdev_get_eui64_cb_t)(const void *arg, eui64_t *addr, uint8_t index); typedef int (*netdev_get_eui64_cb_t)(uint8_t index, eui64_t *addr);
/** /**
* @brief Structure to hold providers for EUI-48 addresses * @brief Structure to hold providers for EUI-48 addresses
*/ */
typedef struct { typedef struct {
netdev_get_eui48_cb_t provider; /**< function to provide an EUI-48 */ netdev_get_eui48_cb_t provider; /**< function to provide an EUI-48 */
const void *arg; /**< argument to the provider function */
netdev_type_t type; /**< device type to match or `NETDEV_ANY` */ netdev_type_t type; /**< device type to match or `NETDEV_ANY` */
uint8_t index; /**< device index to match or `NETDEV_INDEX_ANY` */ uint8_t index; /**< device index to match or `NETDEV_INDEX_ANY` */
} eui48_conf_t; } eui48_conf_t;
@ -144,7 +141,6 @@ typedef struct {
*/ */
typedef struct { typedef struct {
netdev_get_eui64_cb_t provider; /**< function to provide an EUI-64 */ netdev_get_eui64_cb_t provider; /**< function to provide an EUI-64 */
const void *arg; /**< argument to the provider function */
netdev_type_t type; /**< device type to match or `NETDEV_ANY` */ netdev_type_t type; /**< device type to match or `NETDEV_ANY` */
uint8_t index; /**< device index to match or `NETDEV_INDEX_ANY` */ uint8_t index; /**< device index to match or `NETDEV_INDEX_ANY` */
} eui64_conf_t; } eui64_conf_t;

View File

@ -35,7 +35,7 @@ void netdev_eui48_get(netdev_t *netdev, eui48_t *addr)
#else #else
(void) netdev; (void) netdev;
#endif #endif
if (eui48_conf[i].provider(eui48_conf[i].arg, addr, i) == 0) { if (eui48_conf[i].provider(i, addr) == 0) {
return; return;
} }
} }
@ -60,7 +60,7 @@ void netdev_eui64_get(netdev_t *netdev, eui64_t *addr)
#else #else
(void) netdev; (void) netdev;
#endif #endif
if (eui64_conf[i].provider(eui64_conf[i].arg, addr, i) == 0) { if (eui64_conf[i].provider(i, addr) == 0) {
return; return;
} }
} }

View File

@ -40,13 +40,6 @@ extern "C" {
#endif #endif
#endif #endif
/**
* @brief Optional function argument to `netdev_get_eui48_cb_t`
*/
#ifndef EUI48_PROVIDER_ARG
#define EUI48_PROVIDER_ARG NULL
#endif
/** /**
* @brief Driver type to match with EUI-48 provider * @brief Driver type to match with EUI-48 provider
*/ */
@ -68,7 +61,6 @@ extern "C" {
#ifndef EUI48_PROVIDER_PARAMS #ifndef EUI48_PROVIDER_PARAMS
#define EUI48_PROVIDER_PARAMS { \ #define EUI48_PROVIDER_PARAMS { \
.provider = EUI48_PROVIDER_FUNC, \ .provider = EUI48_PROVIDER_FUNC, \
.arg = EUI48_PROVIDER_ARG, \
.type = EUI48_PROVIDER_TYPE, \ .type = EUI48_PROVIDER_TYPE, \
.index = EUI48_PROVIDER_INDEX, \ .index = EUI48_PROVIDER_INDEX, \
}, },

View File

@ -40,13 +40,6 @@ extern "C" {
#endif #endif
#endif #endif
/**
* @brief Optional function argument to `netdev_get_eui64_cb_t`
*/
#ifndef EUI64_PROVIDER_ARG
#define EUI64_PROVIDER_ARG NULL
#endif
/** /**
* @brief Driver type to match with EUI-64 provider * @brief Driver type to match with EUI-64 provider
*/ */
@ -68,7 +61,6 @@ extern "C" {
#ifndef EUI64_PROVIDER_PARAMS #ifndef EUI64_PROVIDER_PARAMS
#define EUI64_PROVIDER_PARAMS { \ #define EUI64_PROVIDER_PARAMS { \
.provider = EUI64_PROVIDER_FUNC, \ .provider = EUI64_PROVIDER_FUNC, \
.arg = EUI64_PROVIDER_ARG, \
.type = EUI64_PROVIDER_TYPE, \ .type = EUI64_PROVIDER_TYPE, \
.index = EUI64_PROVIDER_INDEX, \ .index = EUI64_PROVIDER_INDEX, \
}, },