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:
@@ -26,7 +26,7 @@ struct ext_power_generic_config {
|
||||
};
|
||||
|
||||
struct ext_power_generic_data {
|
||||
struct device *gpio;
|
||||
const struct device *gpio;
|
||||
bool status;
|
||||
#if IS_ENABLED(CONFIG_SETTINGS)
|
||||
bool settings_init;
|
||||
@@ -36,7 +36,7 @@ struct ext_power_generic_data {
|
||||
#if IS_ENABLED(CONFIG_SETTINGS)
|
||||
static void ext_power_save_state_work(struct k_work *work) {
|
||||
char setting_path[40];
|
||||
struct device *ext_power = device_get_binding(DT_INST_LABEL(0));
|
||||
const struct device *ext_power = device_get_binding(DT_INST_LABEL(0));
|
||||
struct ext_power_generic_data *data = ext_power->data;
|
||||
|
||||
snprintf(setting_path, 40, "ext_power/state/%s", DT_INST_LABEL(0));
|
||||
@@ -55,7 +55,7 @@ int ext_power_save_state() {
|
||||
#endif
|
||||
}
|
||||
|
||||
static int ext_power_generic_enable(struct device *dev) {
|
||||
static int ext_power_generic_enable(const struct device *dev) {
|
||||
struct ext_power_generic_data *data = dev->data;
|
||||
const struct ext_power_generic_config *config = dev->config;
|
||||
|
||||
@@ -67,7 +67,7 @@ static int ext_power_generic_enable(struct device *dev) {
|
||||
return ext_power_save_state();
|
||||
}
|
||||
|
||||
static int ext_power_generic_disable(struct device *dev) {
|
||||
static int ext_power_generic_disable(const struct device *dev) {
|
||||
struct ext_power_generic_data *data = dev->data;
|
||||
const struct ext_power_generic_config *config = dev->config;
|
||||
|
||||
@@ -79,7 +79,7 @@ static int ext_power_generic_disable(struct device *dev) {
|
||||
return ext_power_save_state();
|
||||
}
|
||||
|
||||
static int ext_power_generic_get(struct device *dev) {
|
||||
static int ext_power_generic_get(const struct device *dev) {
|
||||
struct ext_power_generic_data *data = dev->data;
|
||||
return data->status;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ static int ext_power_settings_set(const char *name, size_t len, settings_read_cb
|
||||
int rc;
|
||||
|
||||
if (settings_name_steq(name, DT_INST_LABEL(0), &next) && !next) {
|
||||
struct device *ext_power = device_get_binding(DT_INST_LABEL(0));
|
||||
const struct device *ext_power = device_get_binding(DT_INST_LABEL(0));
|
||||
struct ext_power_generic_data *data = ext_power->data;
|
||||
|
||||
if (len != sizeof(data->status)) {
|
||||
@@ -124,7 +124,7 @@ struct settings_handler ext_power_conf = {.name = "ext_power/state",
|
||||
.h_set = ext_power_settings_set};
|
||||
#endif
|
||||
|
||||
static int ext_power_generic_init(struct device *dev) {
|
||||
static int ext_power_generic_init(const struct device *dev) {
|
||||
struct ext_power_generic_data *data = dev->data;
|
||||
const struct ext_power_generic_config *config = dev->config;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user