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
|
@ -110,9 +110,9 @@ struct dwt_hi_cfg {
|
|||
|
||||
struct dwt_context {
|
||||
struct net_if *iface;
|
||||
struct device *irq_gpio;
|
||||
struct device *rst_gpio;
|
||||
struct device *spi;
|
||||
const struct device *irq_gpio;
|
||||
const struct device *rst_gpio;
|
||||
const struct device *spi;
|
||||
struct spi_cs_control spi_cs;
|
||||
struct spi_config *spi_cfg;
|
||||
struct spi_config spi_cfg_slow;
|
||||
|
@ -626,7 +626,7 @@ static void dwt_irq_work_handler(struct k_work *item)
|
|||
k_sem_give(&ctx->dev_lock);
|
||||
}
|
||||
|
||||
static void dwt_gpio_callback(struct device *dev,
|
||||
static void dwt_gpio_callback(const struct device *dev,
|
||||
struct gpio_callback *cb, uint32_t pins)
|
||||
{
|
||||
struct dwt_context *ctx = CONTAINER_OF(cb, struct dwt_context, gpio_cb);
|
||||
|
@ -635,7 +635,7 @@ static void dwt_gpio_callback(struct device *dev,
|
|||
k_work_submit(&ctx->irq_cb_work);
|
||||
}
|
||||
|
||||
static enum ieee802154_hw_caps dwt_get_capabilities(struct device *dev)
|
||||
static enum ieee802154_hw_caps dwt_get_capabilities(const struct device *dev)
|
||||
{
|
||||
return IEEE802154_HW_FCS |
|
||||
IEEE802154_HW_2_4_GHZ | /* FIXME: add IEEE802154_HW_UWB_PHY */
|
||||
|
@ -650,7 +650,7 @@ static uint32_t dwt_get_pkt_duration_ns(struct dwt_context *ctx, uint8_t psdu_le
|
|||
return (rf_cfg->t_shr + rf_cfg->t_phr + t_psdu);
|
||||
}
|
||||
|
||||
static int dwt_cca(struct device *dev)
|
||||
static int dwt_cca(const struct device *dev)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
uint32_t cca_dur = (dwt_get_pkt_duration_ns(ctx, 127) +
|
||||
|
@ -683,7 +683,7 @@ static int dwt_cca(struct device *dev)
|
|||
return ctx->cca_busy ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int dwt_ed(struct device *dev, uint16_t duration,
|
||||
static int dwt_ed(const struct device *dev, uint16_t duration,
|
||||
energy_scan_done_cb_t done_cb)
|
||||
{
|
||||
/* TODO: see description Sub-Register 0x23:02 – AGC_CTRL1 */
|
||||
|
@ -691,7 +691,7 @@ static int dwt_ed(struct device *dev, uint16_t duration,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int dwt_set_channel(struct device *dev, uint16_t channel)
|
||||
static int dwt_set_channel(const struct device *dev, uint16_t channel)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
struct dwt_phy_config *rf_cfg = &ctx->rf_cfg;
|
||||
|
@ -713,7 +713,7 @@ static int dwt_set_channel(struct device *dev, uint16_t channel)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dwt_set_pan_id(struct device *dev, uint16_t pan_id)
|
||||
static int dwt_set_pan_id(const struct device *dev, uint16_t pan_id)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
||||
|
@ -726,7 +726,7 @@ static int dwt_set_pan_id(struct device *dev, uint16_t pan_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dwt_set_short_addr(struct device *dev, uint16_t short_addr)
|
||||
static int dwt_set_short_addr(const struct device *dev, uint16_t short_addr)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
||||
|
@ -740,7 +740,8 @@ static int dwt_set_short_addr(struct device *dev, uint16_t short_addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dwt_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
|
||||
static int dwt_set_ieee_addr(const struct device *dev,
|
||||
const uint8_t *ieee_addr)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
||||
|
@ -756,7 +757,7 @@ static int dwt_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dwt_filter(struct device *dev,
|
||||
static int dwt_filter(const struct device *dev,
|
||||
bool set,
|
||||
enum ieee802154_filter_type type,
|
||||
const struct ieee802154_filter *filter)
|
||||
|
@ -776,7 +777,7 @@ static int dwt_filter(struct device *dev,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int dwt_set_power(struct device *dev, int16_t dbm)
|
||||
static int dwt_set_power(const struct device *dev, int16_t dbm)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
||||
|
@ -785,7 +786,7 @@ static int dwt_set_power(struct device *dev, int16_t dbm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dwt_tx(struct device *dev, enum ieee802154_tx_mode tx_mode,
|
||||
static int dwt_tx(const struct device *dev, enum ieee802154_tx_mode tx_mode,
|
||||
struct net_pkt *pkt, struct net_buf *frag)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
@ -915,7 +916,8 @@ static void dwt_set_frame_filter(struct dwt_context *ctx,
|
|||
dwt_reg_write_u8(ctx, DWT_SYS_CFG_ID, 0, (uint8_t)sys_cfg_ff);
|
||||
}
|
||||
|
||||
static int dwt_configure(struct device *dev, enum ieee802154_config_type type,
|
||||
static int dwt_configure(const struct device *dev,
|
||||
enum ieee802154_config_type type,
|
||||
const struct ieee802154_config *config)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
@ -953,7 +955,7 @@ static int dwt_configure(struct device *dev, enum ieee802154_config_type type,
|
|||
/*
|
||||
* Note, the DW_RESET pin should not be driven high externally.
|
||||
*/
|
||||
static int dwt_hw_reset(struct device *dev)
|
||||
static int dwt_hw_reset(const struct device *dev)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
const struct dwt_hi_cfg *hi_cfg = dev->config;
|
||||
|
@ -1018,7 +1020,7 @@ static void dwt_set_rx_mode(struct dwt_context *ctx)
|
|||
dwt_reg_write_u32(ctx, DWT_PMSC_ID, DWT_PMSC_CTRL0_OFFSET, pmsc_ctrl0);
|
||||
}
|
||||
|
||||
static int dwt_start(struct device *dev)
|
||||
static int dwt_start(const struct device *dev)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
uint8_t cswakeup_buf[32] = {0};
|
||||
|
@ -1066,7 +1068,7 @@ static int dwt_start(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dwt_stop(struct device *dev)
|
||||
static int dwt_stop(const struct device *dev)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
|
||||
|
@ -1487,7 +1489,7 @@ static int dwt_configure_rf_phy(struct dwt_context *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dw1000_init(struct device *dev)
|
||||
static int dw1000_init(const struct device *dev)
|
||||
{
|
||||
struct dwt_context *ctx = dev->data;
|
||||
const struct dwt_hi_cfg *hi_cfg = dev->config;
|
||||
|
@ -1619,7 +1621,7 @@ static int dw1000_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline uint8_t *get_mac(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);
|
||||
|
@ -1635,7 +1637,7 @@ static inline uint8_t *get_mac(struct device *dev)
|
|||
|
||||
static void dwt_iface_api_init(struct net_if *iface)
|
||||
{
|
||||
struct device *dev = net_if_get_device(iface);
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
struct dwt_context *dw1000 = dev->data;
|
||||
uint8_t *mac = get_mac(dev);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue