drivers: ieee802154: Fix device instance const qualifier loss
In all of these drivers, passing the device's data was sufficient as only the data is being used by thread. Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
681fcd17b1
commit
949b25cf68
7 changed files with 26 additions and 24 deletions
|
@ -448,9 +448,9 @@ static inline bool verify_crc(struct cc1200_context *ctx, struct net_pkt *pkt)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void cc1200_rx(const struct device *dev)
|
||||
static void cc1200_rx(void *arg)
|
||||
{
|
||||
struct cc1200_context *cc1200 = dev->data;
|
||||
struct cc1200_context *cc1200 = arg;
|
||||
struct net_pkt *pkt;
|
||||
uint8_t pkt_len;
|
||||
|
||||
|
@ -817,7 +817,7 @@ static int cc1200_init(const struct device *dev)
|
|||
k_thread_create(&cc1200->rx_thread, cc1200->rx_stack,
|
||||
CONFIG_IEEE802154_CC1200_RX_STACK_SIZE,
|
||||
(k_thread_entry_t)cc1200_rx,
|
||||
dev, NULL, NULL, K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
cc1200, NULL, NULL, K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
k_thread_name_set(&cc1200->rx_thread, "cc1200_rx");
|
||||
|
||||
LOG_INF("CC1200 initialized");
|
||||
|
|
|
@ -273,9 +273,9 @@ static inline uint8_t ieee802154_cc13xx_cc26xx_convert_rssi(int8_t rssi)
|
|||
CC13XX_CC26XX_RSSI_DYNAMIC_RANGE;
|
||||
}
|
||||
|
||||
static void ieee802154_cc13xx_cc26xx_rx_done(const struct device *dev)
|
||||
static void ieee802154_cc13xx_cc26xx_rx_done(
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data = get_dev_data(dev);
|
||||
struct net_pkt *pkt;
|
||||
uint8_t len, seq, corr;
|
||||
int8_t rssi;
|
||||
|
@ -328,7 +328,7 @@ static void ieee802154_cc13xx_cc26xx_rx_done(const struct device *dev)
|
|||
|
||||
static void ieee802154_cc13xx_cc26xx_rx(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data = get_dev_data(arg1);
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data = arg1;
|
||||
|
||||
ARG_UNUSED(arg2);
|
||||
ARG_UNUSED(arg3);
|
||||
|
@ -336,7 +336,7 @@ static void ieee802154_cc13xx_cc26xx_rx(void *arg1, void *arg2, void *arg3)
|
|||
while (true) {
|
||||
k_sem_take(&drv_data->rx_done, K_FOREVER);
|
||||
|
||||
ieee802154_cc13xx_cc26xx_rx_done(arg1);
|
||||
ieee802154_cc13xx_cc26xx_rx_done(drv_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ static void ieee802154_cc13xx_cc26xx_data_init(const struct device *dev)
|
|||
|
||||
k_thread_create(&drv_data->rx_thread, drv_data->rx_stack,
|
||||
K_KERNEL_STACK_SIZEOF(drv_data->rx_stack),
|
||||
ieee802154_cc13xx_cc26xx_rx, dev, NULL, NULL,
|
||||
ieee802154_cc13xx_cc26xx_rx, drv_data, NULL, NULL,
|
||||
K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
}
|
||||
|
||||
|
|
|
@ -607,10 +607,9 @@ static inline bool verify_rxfifo_validity(struct cc2520_context *ctx,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void cc2520_rx(int arg)
|
||||
static void cc2520_rx(void *arg)
|
||||
{
|
||||
const struct device *dev = INT_TO_POINTER(arg);
|
||||
struct cc2520_context *cc2520 = dev->data;
|
||||
struct cc2520_context *cc2520 = arg;
|
||||
struct net_pkt *pkt;
|
||||
uint8_t pkt_len;
|
||||
|
||||
|
@ -1114,7 +1113,7 @@ static int cc2520_init(const struct device *dev)
|
|||
k_thread_create(&cc2520->cc2520_rx_thread, cc2520->cc2520_rx_stack,
|
||||
CONFIG_IEEE802154_CC2520_RX_STACK_SIZE,
|
||||
(k_thread_entry_t)cc2520_rx,
|
||||
dev, NULL, NULL, K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
cc2520, NULL, NULL, K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
k_thread_name_set(&cc2520->cc2520_rx_thread, "cc2520_rx");
|
||||
|
||||
LOG_INF("CC2520 initialized");
|
||||
|
|
|
@ -712,8 +712,7 @@ static inline bool irqsts3_event(struct mcr20a_context *mcr20a,
|
|||
|
||||
static void mcr20a_thread_main(void *arg)
|
||||
{
|
||||
const struct device *dev = (const struct device *)arg;
|
||||
struct mcr20a_context *mcr20a = dev->data;
|
||||
struct mcr20a_context *mcr20a = (struct mcr20a_context *)arg;
|
||||
uint8_t dregs[MCR20A_PHY_CTRL4 + 1];
|
||||
bool set_new_seq;
|
||||
uint8_t ctrl1 = 0U;
|
||||
|
@ -1441,7 +1440,7 @@ static int mcr20a_init(const struct device *dev)
|
|||
k_thread_create(&mcr20a->mcr20a_rx_thread, mcr20a->mcr20a_rx_stack,
|
||||
CONFIG_IEEE802154_MCR20A_RX_STACK_SIZE,
|
||||
(k_thread_entry_t)mcr20a_thread_main,
|
||||
dev, NULL, NULL, K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
mcr20a, NULL, NULL, K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
k_thread_name_set(&mcr20a->mcr20a_rx_thread, "mcr20a_rx");
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -84,8 +84,7 @@ static void nrf5_get_eui64(uint8_t *mac)
|
|||
|
||||
static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
const struct device *dev = (const struct device *)arg1;
|
||||
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
|
||||
struct nrf5_802154_data *nrf5_radio = (struct nrf5_802154_data *)arg1;
|
||||
struct net_pkt *pkt;
|
||||
struct nrf5_802154_rx_frame *rx_frame;
|
||||
uint8_t pkt_len;
|
||||
|
@ -492,7 +491,7 @@ static int nrf5_init(const struct device *dev)
|
|||
|
||||
k_thread_create(&nrf5_radio->rx_thread, nrf5_radio->rx_stack,
|
||||
CONFIG_IEEE802154_NRF5_RX_STACK_SIZE,
|
||||
nrf5_rx_thread, dev, NULL, NULL,
|
||||
nrf5_rx_thread, nrf5_radio, NULL, NULL,
|
||||
K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&nrf5_radio->rx_thread, "nrf5_rx");
|
||||
|
|
|
@ -302,14 +302,14 @@ static void rf2xx_process_trx_end(const struct device *dev)
|
|||
|
||||
static void rf2xx_thread_main(void *arg)
|
||||
{
|
||||
const struct device *dev = INT_TO_POINTER(arg);
|
||||
struct rf2xx_context *ctx = dev->data;
|
||||
struct rf2xx_context *ctx = arg;
|
||||
uint8_t isr_status;
|
||||
|
||||
while (true) {
|
||||
k_sem_take(&ctx->trx_isr_lock, K_FOREVER);
|
||||
|
||||
isr_status = rf2xx_iface_reg_read(dev, RF2XX_IRQ_STATUS_REG);
|
||||
isr_status = rf2xx_iface_reg_read(ctx->dev,
|
||||
RF2XX_IRQ_STATUS_REG);
|
||||
|
||||
/*
|
||||
* IRQ_7 (BAT_LOW) Indicates a supply voltage below the
|
||||
|
@ -339,10 +339,11 @@ static void rf2xx_thread_main(void *arg)
|
|||
*/
|
||||
if (isr_status & (1 << RF2XX_RX_START)) {
|
||||
if (ctx->trx_model != RF2XX_TRX_MODEL_231) {
|
||||
rf2xx_iface_sram_read(dev, 0, &ctx->rx_phr, 1);
|
||||
rf2xx_iface_sram_read(ctx->dev, 0,
|
||||
&ctx->rx_phr, 1);
|
||||
}
|
||||
} else if (isr_status & (1 << RF2XX_TRX_END)) {
|
||||
rf2xx_process_trx_end(dev);
|
||||
rf2xx_process_trx_end(ctx->dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -803,6 +804,8 @@ static int rf2xx_init(const struct device *dev)
|
|||
|
||||
LOG_DBG("\nInitialize RF2XX Transceiver\n");
|
||||
|
||||
ctx->dev = dev;
|
||||
|
||||
k_sem_init(&ctx->trx_tx_sync, 0, 1);
|
||||
k_sem_init(&ctx->trx_isr_lock, 0, 1);
|
||||
|
||||
|
@ -827,7 +830,7 @@ static int rf2xx_init(const struct device *dev)
|
|||
ctx->trx_stack,
|
||||
CONFIG_IEEE802154_RF2XX_RX_STACK_SIZE,
|
||||
(k_thread_entry_t) rf2xx_thread_main,
|
||||
dev, NULL, NULL,
|
||||
ctx, NULL, NULL,
|
||||
K_PRIO_COOP(2), 0, K_NO_WAIT);
|
||||
|
||||
snprintk(thread_name, sizeof(thread_name),
|
||||
|
|
|
@ -103,6 +103,8 @@ struct rf2xx_config {
|
|||
struct rf2xx_context {
|
||||
struct net_if *iface;
|
||||
|
||||
const struct device *dev;
|
||||
|
||||
const struct device *irq_gpio;
|
||||
const struct device *reset_gpio;
|
||||
const struct device *slptr_gpio;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue