Commit 9e8e21b3 authored by Fin Maaß's avatar Fin Maaß Committed by Carles Cufi
Browse files

drivers: ieee802154: use sys_rand_get directly



use sys_rand_get() directly.

Signed-off-by: default avatarFin Maaß <f.maass@vogl-electronic.com>
parent 362389ee
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -110,11 +110,7 @@ static inline uint8_t *b91_get_mac(const struct device *dev)
	struct b91_data *b91 = dev->data;

#if defined(CONFIG_IEEE802154_B91_RANDOM_MAC)
	uint32_t *ptr = (uint32_t *)(b91->mac_addr);

	UNALIGNED_PUT(sys_rand32_get(), ptr);
	ptr = (uint32_t *)(b91->mac_addr + 4);
	UNALIGNED_PUT(sys_rand32_get(), ptr);
	sys_rand_get(b91->mac_addr, sizeof(b91->mac_addr));

	/*
	 * Clear bit 0 to ensure it isn't a multicast address and set
+1 −3
Original line number Diff line number Diff line
@@ -129,9 +129,7 @@ static inline uint8_t *get_mac(const struct device *dev)
	struct cc1200_context *cc1200 = dev->data;

#if defined(CONFIG_IEEE802154_CC1200_RANDOM_MAC)
	uint32_t *ptr = (uint32_t *)(cc1200->mac_addr + 4);

	UNALIGNED_PUT(sys_rand32_get(), ptr);
	sys_rand_get(&cc1200->mac_addr[4], 4U);

	cc1200->mac_addr[7] = (cc1200->mac_addr[7] & ~0x01) | 0x02;
#else
+1 −3
Original line number Diff line number Diff line
@@ -279,9 +279,7 @@ static inline uint8_t *get_mac(const struct device *dev)
	struct cc2520_context *cc2520 = dev->data;

#if defined(CONFIG_IEEE802154_CC2520_RANDOM_MAC)
	uint32_t *ptr = (uint32_t *)(cc2520->mac_addr + 4);

	UNALIGNED_PUT(sys_rand32_get(), ptr);
	sys_rand_get(&cc2520->mac_addr[4], 4U);

	cc2520->mac_addr[7] = (cc2520->mac_addr[7] & ~0x01) | 0x02;
#else
+1 −4
Original line number Diff line number Diff line
@@ -1633,11 +1633,8 @@ static int dw1000_init(const struct device *dev)
static inline uint8_t *get_mac(const struct device *dev)
{
	struct dwt_context *dw1000 = dev->data;
	uint32_t *ptr = (uint32_t *)(dw1000->mac_addr);

	UNALIGNED_PUT(sys_rand32_get(), ptr);
	ptr = (uint32_t *)(dw1000->mac_addr + 4);
	UNALIGNED_PUT(sys_rand32_get(), ptr);
	sys_rand_get(dw1000->mac_addr, sizeof(dw1000->mac_addr));

	dw1000->mac_addr[0] = (dw1000->mac_addr[0] & ~0x01) | 0x02;

+1 −5
Original line number Diff line number Diff line
@@ -935,11 +935,7 @@ static inline uint8_t *get_mac(const struct device *dev)
	 *       and how to allow for a OUI portion?
	 */

	uint32_t *ptr = (uint32_t *)(kw41z->mac_addr);

	UNALIGNED_PUT(sys_rand32_get(), ptr);
	ptr = (uint32_t *)(kw41z->mac_addr + 4);
	UNALIGNED_PUT(sys_rand32_get(), ptr);
	sys_rand_get(kw41z->mac_addr, sizeof(kw41z->mac_addr));

	/*
	 * Clear bit 0 to ensure it isn't a multicast address and set
Loading