forked from kofal.net/zmk
refactor(app): replace struct device * with const struct device *
Replaced with RegExp: /(?<!const )(struct device \*)/g See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html PR: #467
This commit is contained in:
@@ -35,7 +35,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int behavior_bt_init(struct device *dev) { return 0; };
|
||||
static int behavior_bt_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
struct device *ext_power = device_get_binding("EXT_POWER");
|
||||
const struct device *ext_power = device_get_binding("EXT_POWER");
|
||||
if (ext_power == NULL) {
|
||||
LOG_ERR("Unable to retrieve ext_power device: %d", binding->param1);
|
||||
return -EIO;
|
||||
@@ -46,7 +46,7 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int behavior_ext_power_init(struct device *dev) { return 0; };
|
||||
static int behavior_ext_power_init(const struct device *dev) { return 0; };
|
||||
|
||||
static const struct behavior_driver_api behavior_ext_power_driver_api = {
|
||||
.binding_pressed = on_keymap_binding_pressed,
|
||||
|
||||
@@ -304,7 +304,7 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_mome
|
||||
|
||||
static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct behavior_hold_tap_config *cfg = dev->config;
|
||||
|
||||
if (undecided_hold_tap != NULL) {
|
||||
@@ -479,7 +479,7 @@ void behavior_hold_tap_timer_work_handler(struct k_work *item) {
|
||||
}
|
||||
}
|
||||
|
||||
static int behavior_hold_tap_init(struct device *dev) {
|
||||
static int behavior_hold_tap_init(const struct device *dev) {
|
||||
static bool init_first_run = true;
|
||||
|
||||
if (init_first_run) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
static int behavior_key_press_init(struct device *dev) { return 0; };
|
||||
static int behavior_key_press_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
struct behavior_mo_config {};
|
||||
struct behavior_mo_data {};
|
||||
|
||||
static int behavior_mo_init(struct device *dev) { return 0; };
|
||||
static int behavior_mo_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int mo_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
struct behavior_none_config {};
|
||||
struct behavior_none_data {};
|
||||
|
||||
static int behavior_none_init(struct device *dev) { return 0; };
|
||||
static int behavior_none_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
@@ -34,7 +34,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int behavior_out_init(struct device *dev) { return 0; }
|
||||
static int behavior_out_init(const struct device *dev) { return 0; }
|
||||
|
||||
static const struct behavior_driver_api behavior_outputs_driver_api = {
|
||||
.binding_pressed = on_keymap_binding_pressed,
|
||||
|
||||
@@ -19,11 +19,11 @@ struct behavior_reset_config {
|
||||
int type;
|
||||
};
|
||||
|
||||
static int behavior_reset_init(struct device *dev) { return 0; };
|
||||
static int behavior_reset_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct behavior_reset_config *cfg = dev->config;
|
||||
|
||||
// TODO: Correct magic code for going into DFU?
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
static int behavior_rgb_underglow_init(struct device *dev) { return 0; }
|
||||
static int behavior_rgb_underglow_init(const struct device *dev) { return 0; }
|
||||
|
||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
static int behavior_sensor_rotate_key_press_init(struct device *dev) { return 0; };
|
||||
static int behavior_sensor_rotate_key_press_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding, struct device *sensor,
|
||||
int64_t timestamp) {
|
||||
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
|
||||
const struct device *sensor, int64_t timestamp) {
|
||||
struct sensor_value value;
|
||||
int err;
|
||||
uint32_t keycode;
|
||||
|
||||
@@ -127,7 +127,7 @@ static int stop_timer(struct active_sticky_key *sticky_key) {
|
||||
|
||||
static int on_sticky_key_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct behavior_sticky_key_config *cfg = dev->config;
|
||||
struct active_sticky_key *sticky_key;
|
||||
sticky_key = find_sticky_key(event.position);
|
||||
@@ -242,7 +242,7 @@ void behavior_sticky_key_timer_handler(struct k_work *item) {
|
||||
}
|
||||
}
|
||||
|
||||
static int behavior_sticky_key_init(struct device *dev) {
|
||||
static int behavior_sticky_key_init(const struct device *dev) {
|
||||
static bool init_first_run = true;
|
||||
if (init_first_run) {
|
||||
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
|
||||
|
||||
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
struct behavior_tog_config {};
|
||||
struct behavior_tog_data {};
|
||||
|
||||
static int behavior_tog_init(struct device *dev) { return 0; };
|
||||
static int behavior_tog_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int tog_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
struct behavior_transparent_config {};
|
||||
struct behavior_transparent_data {};
|
||||
|
||||
static int behavior_transparent_init(struct device *dev) { return 0; };
|
||||
static int behavior_transparent_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
|
||||
Reference in New Issue
Block a user