device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all the other attributes, it is possible to switch all device driver instance to be constant. A coccinelle rule is used for this: @r_const_dev_1 disable optional_qualifier @ @@ -struct device * +const struct device * @r_const_dev_2 disable optional_qualifier @ @@ -struct device * const +const struct device * Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
c8906fef79
commit
e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions
|
@ -43,7 +43,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
|||
#include "nrf_802154.h"
|
||||
|
||||
struct nrf5_802154_config {
|
||||
void (*irq_config_func)(struct device *dev);
|
||||
void (*irq_config_func)(const struct device *dev);
|
||||
};
|
||||
|
||||
static struct nrf5_802154_data nrf5_data;
|
||||
|
@ -84,7 +84,7 @@ static void nrf5_get_eui64(uint8_t *mac)
|
|||
|
||||
static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
struct device *dev = (struct device *)arg1;
|
||||
const struct device *dev = (const struct device *)arg1;
|
||||
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
|
||||
struct net_pkt *pkt;
|
||||
struct nrf5_802154_rx_frame *rx_frame;
|
||||
|
@ -172,7 +172,7 @@ drop:
|
|||
|
||||
/* Radio device API */
|
||||
|
||||
static enum ieee802154_hw_caps nrf5_get_capabilities(struct device *dev)
|
||||
static enum ieee802154_hw_caps nrf5_get_capabilities(const struct device *dev)
|
||||
{
|
||||
return IEEE802154_HW_FCS | IEEE802154_HW_FILTER |
|
||||
IEEE802154_HW_CSMA | IEEE802154_HW_2_4_GHZ |
|
||||
|
@ -180,7 +180,7 @@ static enum ieee802154_hw_caps nrf5_get_capabilities(struct device *dev)
|
|||
IEEE802154_HW_SLEEP_TO_TX;
|
||||
}
|
||||
|
||||
static int nrf5_cca(struct device *dev)
|
||||
static int nrf5_cca(const struct device *dev)
|
||||
{
|
||||
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
|
||||
|
||||
|
@ -199,7 +199,7 @@ static int nrf5_cca(struct device *dev)
|
|||
return nrf5_radio->channel_free ? 0 : -EBUSY;
|
||||
}
|
||||
|
||||
static int nrf5_set_channel(struct device *dev, uint16_t channel)
|
||||
static int nrf5_set_channel(const struct device *dev, uint16_t channel)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -214,7 +214,7 @@ static int nrf5_set_channel(struct device *dev, uint16_t channel)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nrf5_energy_scan_start(struct device *dev,
|
||||
static int nrf5_energy_scan_start(const struct device *dev,
|
||||
uint16_t duration,
|
||||
energy_scan_done_cb_t done_cb)
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ static int nrf5_energy_scan_start(struct device *dev,
|
|||
return err;
|
||||
}
|
||||
|
||||
static int nrf5_set_pan_id(struct device *dev, uint16_t pan_id)
|
||||
static int nrf5_set_pan_id(const struct device *dev, uint16_t pan_id)
|
||||
{
|
||||
uint8_t pan_id_le[2];
|
||||
|
||||
|
@ -250,7 +250,7 @@ static int nrf5_set_pan_id(struct device *dev, uint16_t pan_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nrf5_set_short_addr(struct device *dev, uint16_t short_addr)
|
||||
static int nrf5_set_short_addr(const struct device *dev, uint16_t short_addr)
|
||||
{
|
||||
uint8_t short_addr_le[2];
|
||||
|
||||
|
@ -264,7 +264,8 @@ static int nrf5_set_short_addr(struct device *dev, uint16_t short_addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nrf5_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
|
||||
static int nrf5_set_ieee_addr(const struct device *dev,
|
||||
const uint8_t *ieee_addr)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -277,7 +278,7 @@ static int nrf5_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nrf5_filter(struct device *dev, bool set,
|
||||
static int nrf5_filter(const struct device *dev, bool set,
|
||||
enum ieee802154_filter_type type,
|
||||
const struct ieee802154_filter *filter)
|
||||
{
|
||||
|
@ -298,7 +299,7 @@ static int nrf5_filter(struct device *dev, bool set,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int nrf5_set_txpower(struct device *dev, int16_t dbm)
|
||||
static int nrf5_set_txpower(const struct device *dev, int16_t dbm)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -352,7 +353,7 @@ free_nrf_ack:
|
|||
return err;
|
||||
}
|
||||
|
||||
static void nrf5_tx_started(struct device *dev,
|
||||
static void nrf5_tx_started(const struct device *dev,
|
||||
struct net_pkt *pkt,
|
||||
struct net_buf *frag)
|
||||
{
|
||||
|
@ -364,7 +365,7 @@ static void nrf5_tx_started(struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
static int nrf5_tx(struct device *dev,
|
||||
static int nrf5_tx(const struct device *dev,
|
||||
enum ieee802154_tx_mode mode,
|
||||
struct net_pkt *pkt,
|
||||
struct net_buf *frag)
|
||||
|
@ -427,7 +428,7 @@ static int nrf5_tx(struct device *dev,
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static int nrf5_start(struct device *dev)
|
||||
static int nrf5_start(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -442,7 +443,7 @@ static int nrf5_start(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nrf5_stop(struct device *dev)
|
||||
static int nrf5_stop(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -465,7 +466,7 @@ static void nrf5_radio_irq(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void nrf5_irq_config(struct device *dev)
|
||||
static void nrf5_irq_config(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -476,7 +477,7 @@ static void nrf5_irq_config(struct device *dev)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int nrf5_init(struct device *dev)
|
||||
static int nrf5_init(const struct device *dev)
|
||||
{
|
||||
const struct nrf5_802154_config *nrf5_radio_cfg = NRF5_802154_CFG(dev);
|
||||
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
|
||||
|
@ -503,7 +504,7 @@ static int nrf5_init(struct device *dev)
|
|||
|
||||
static void nrf5_iface_init(struct net_if *iface)
|
||||
{
|
||||
struct device *dev = net_if_get_device(iface);
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
|
||||
|
||||
nrf5_get_eui64(nrf5_radio->mac);
|
||||
|
@ -515,7 +516,8 @@ static void nrf5_iface_init(struct net_if *iface)
|
|||
ieee802154_init(iface);
|
||||
}
|
||||
|
||||
static int nrf5_configure(struct device *dev, enum ieee802154_config_type type,
|
||||
static int nrf5_configure(const struct device *dev,
|
||||
enum ieee802154_config_type type,
|
||||
const struct ieee802154_config *config)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue