Skip to content

RFC: device: convert device struct instances to const #25208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion arch/arc/core/arc_smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void arch_sched_ipi(void)
}
}

static int arc_smp_init(struct device *dev)
static int arc_smp_init(const struct device *dev)
{
ARG_UNUSED(dev);
struct arc_connect_bcr bcr;
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/core/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void init_dcache_line_size(void)
}
#endif

static int init_dcache(struct device *unused)
static int init_dcache(const struct device *unused)
{
ARG_UNUSED(unused);

Expand Down
2 changes: 1 addition & 1 deletion arch/arc/core/mpu/arc_mpu_v2_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
* This function provides the default configuration mechanism for the Memory
* Protection Unit (MPU).
*/
static int arc_mpu_init(struct device *arg)
static int arc_mpu_init(const struct device *arg)
{
ARG_UNUSED(arg);

Expand Down
2 changes: 1 addition & 1 deletion arch/arc/core/mpu/arc_mpu_v3_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
* This function provides the default configuration mechanism for the Memory
* Protection Unit (MPU).
*/
static int arc_mpu_init(struct device *arg)
static int arc_mpu_init(const struct device *arg)
{
ARG_UNUSED(arg);
u32_t num_regions;
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/core/secureshield/arc_sjli.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void sjli_table_init(void)
/*
* @brief initializaiton of secureshield related functions.
*/
static int arc_secureshield_init(struct device *arg)
static int arc_secureshield_init(const struct device *arg)
{
sjli_table_init();

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/aarch32/cortex_m/mpu/arm_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void arm_core_mpu_configure_dynamic_mpu_regions(const struct k_mem_partition
* This function provides the default configuration mechanism for the Memory
* Protection Unit (MPU).
*/
static int arm_mpu_init(struct device *arg)
static int arm_mpu_init(const struct device *arg)
{
u32_t r_index;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/aarch32/cortex_m/mpu/nxp_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ void arm_core_mpu_configure_dynamic_mpu_regions(const struct k_mem_partition
* This function provides the default configuration mechanism for the Memory
* Protection Unit (MPU).
*/
static int nxp_mpu_init(struct device *arg)
static int nxp_mpu_init(const struct device *arg)
{
ARG_UNUSED(arg);

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/aarch64/arm_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static void enable_mmu_el1(unsigned int flags)
* This function provides the default configuration mechanism for the Memory
* Management Unit (MMU).
*/
static int arm_mmu_init(struct device *arg)
static int arm_mmu_init(const struct device *arg)
{
u64_t val;
unsigned int idx, flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/ia32/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void init_cache_line_size(void)
#define init_cache_line_size() do { } while ((0))
#endif

static int init_cache(struct device *unused)
static int init_cache(const struct device *unused)
{
ARG_UNUSED(unused);

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/multiboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static struct framebuf_dev_data multiboot_framebuf_data = {
.height = CONFIG_MULTIBOOT_FRAMEBUF_Y
};

static int multiboot_framebuf_init(struct device *dev)
static int multiboot_framebuf_init(const struct device *dev)
{
struct framebuf_dev_data *data = FRAMEBUF_DATA(dev);
struct multiboot_info *info = &multiboot_info;
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/spec_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static u32_t cpuid_extended_features(void)
return edx;
}

static int spec_ctrl_init(struct device *dev)
static int spec_ctrl_init(const struct device *dev)
{
ARG_UNUSED(dev);

Expand Down
2 changes: 1 addition & 1 deletion boards/arc/em_starterkit/pmodmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#define PM6_LR_CSS_STAT ((1 << BIT2) << PM6_OFFSET)


static int pmod_mux_init(struct device *device)
static int pmod_mux_init(const struct device *device)
{
volatile u32_t *mux_regs = (u32_t *)(PMODMUX_BASE_ADDR);

Expand Down
4 changes: 2 additions & 2 deletions boards/arc/hsdk/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include <init.h>
#include <drivers/pinmux.h>

static int board_pinmux_init(struct device *device)
static int board_pinmux_init(const struct device *device)
{
ARG_UNUSED(device);

struct device *pinmux = device_get_binding(CONFIG_PINMUX_NAME);
const struct device *pinmux = device_get_binding(CONFIG_PINMUX_NAME);

if (pinmux == NULL) {
return -ENXIO;
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_aerocore2/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static const struct pin_config pinconf[] = {
#endif /* CONFIG_USB_DC_STM32 */
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_argonkey/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static const struct pin_config pinconf[] = {
#endif
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_avenger96/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const struct pin_config pinconf[] = {
#endif
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_carbon/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static const struct pin_config pinconf[] = {
#endif /* CONFIG_USB_DC_STM32 */
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_meerkat96/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <init.h>
#include "device_imx.h"

static int meerakt96_pinmux_init(struct device *dev)
static int meerakt96_pinmux_init(const struct device *dev)
{
ARG_UNUSED(dev);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_neonkey/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static const struct pin_config pinconf[] = {
#endif
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_stm32_sensor_mez/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static const struct pin_config pinconf[] = {
#endif
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
4 changes: 2 additions & 2 deletions boards/arm/96b_wistrio/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB7, STM32_PUSHPULL_PULLUP},
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);
struct device *gpioa, *gpiob, *gpioh;
const struct device *gpioa, *gpiob, *gpioh;

stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));

Expand Down
4 changes: 2 additions & 2 deletions boards/arm/actinius_icarus/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_ICARUS_LOG_LEVEL);

static void select_sim(void)
{
struct device *port = device_get_binding(DT_LABEL(DT_NODELABEL(gpio0)));
const struct device *port = device_get_binding(DT_LABEL(DT_NODELABEL(gpio0)));

if (!port) {
LOG_ERR("Could not get GPIO Device Binding");
Expand All @@ -31,7 +31,7 @@ static void select_sim(void)
#endif
}

static int board_actinius_icarus_init(struct device *dev)
static int board_actinius_icarus_init(const struct device *dev)
{
ARG_UNUSED(dev);

Expand Down
6 changes: 3 additions & 3 deletions boards/arm/adafruit_feather_m0_basic_proto/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
const struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi)
struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
const struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
#endif
ARG_UNUSED(dev);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/adafruit_feather_stm32f405/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static const struct pin_config pinconf[] = {
#endif /* CONFIG_USB_DC_STM32 */
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
4 changes: 2 additions & 2 deletions boards/arm/adafruit_trinket_m0/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
const struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));

ARG_UNUSED(dev);

Expand Down
6 changes: 3 additions & 3 deletions boards/arm/arduino_zero/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
const struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
const struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));

ARG_UNUSED(dev);

Expand Down
6 changes: 3 additions & 3 deletions boards/arm/atsamd20_xpro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
const struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
const struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));

ARG_UNUSED(dev);

Expand Down
6 changes: 3 additions & 3 deletions boards/arm/atsamd21_xpro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
const struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
const struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));

ARG_UNUSED(dev);

Expand Down
10 changes: 5 additions & 5 deletions boards/arm/atsame54_xpro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding("PINMUX_A");
struct device *muxb = device_get_binding("PINMUX_B");
struct device *muxc = device_get_binding("PINMUX_C");
struct device *muxd = device_get_binding("PINMUX_D");
const struct device *muxa = device_get_binding("PINMUX_A");
const struct device *muxb = device_get_binding("PINMUX_B");
const struct device *muxc = device_get_binding("PINMUX_C");
const struct device *muxd = device_get_binding("PINMUX_D");

ARG_UNUSED(dev);
ARG_UNUSED(muxa);
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/atsamr21_xpro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(struct device *dev)
static int board_pinmux_init(const struct device *dev)
{
struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
struct device *muxc = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_c)));
const struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a)));
const struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b)));
const struct device *muxc = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_c)));

ARG_UNUSED(dev);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/b_l072z_lrwan1/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static const struct pin_config pinconf[] = {
#endif
};

static int pinmux_stm32_init(struct device *port)
static int pinmux_stm32_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/black_f407ve/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static const struct pin_config pinconf[] = {
#endif
};

static int pinmux_black_f407ve_init(struct device *port)
static int pinmux_black_f407ve_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/black_f407zg_pro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static const struct pin_config pinconf[] = {
};


static int pinmux_black_f407zg_init(struct device *port)
static int pinmux_black_f407zg_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/cc3220sf_launchxl/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */
#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */

int pinmux_initialize(struct device *port)
int pinmux_initialize(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/cc3235sf_launchxl/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */
#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */

int pinmux_initialize(struct device *port)
int pinmux_initialize(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/colibri_imx7d_m4/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <init.h>
#include "device_imx.h"

static int colibri_imx7d_m4_pinmux_init(struct device *dev)
static int colibri_imx7d_m4_pinmux_init(const struct device *dev)
{
ARG_UNUSED(dev);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/cy8ckit_062_wifi_bt_m0/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "pinmux/pinmux.h"

static int pinmux_init(struct device *port)
static int pinmux_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/cy8ckit_062_wifi_bt_m4/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "pinmux/pinmux.h"

static int pinmux_init(struct device *port)
static int pinmux_init(const struct device *port)
{
ARG_UNUSED(port);

Expand Down
Loading