forked from kofal.net/zmk
refactor(app): replace driver_data with data
See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html PR: #467
This commit is contained in:
@@ -56,7 +56,7 @@ static uint8_t lithium_ion_mv_to_pct(int16_t bat_mv) {
|
||||
}
|
||||
|
||||
static int bvd_sample_fetch(struct device *dev, enum sensor_channel chan) {
|
||||
struct bvd_data *drv_data = dev->driver_data;
|
||||
struct bvd_data *drv_data = dev->data;
|
||||
const struct bvd_config *drv_cfg = dev->config;
|
||||
struct adc_sequence *as = &drv_data->as;
|
||||
|
||||
@@ -114,7 +114,7 @@ static int bvd_sample_fetch(struct device *dev, enum sensor_channel chan) {
|
||||
}
|
||||
|
||||
static int bvd_channel_get(struct device *dev, enum sensor_channel chan, struct sensor_value *val) {
|
||||
struct bvd_data *drv_data = dev->driver_data;
|
||||
struct bvd_data *drv_data = dev->data;
|
||||
|
||||
switch (chan) {
|
||||
case SENSOR_CHAN_GAUGE_VOLTAGE:
|
||||
@@ -140,7 +140,7 @@ static const struct sensor_driver_api bvd_api = {
|
||||
};
|
||||
|
||||
static int bvd_init(struct device *dev) {
|
||||
struct bvd_data *drv_data = dev->driver_data;
|
||||
struct bvd_data *drv_data = dev->data;
|
||||
const struct bvd_config *drv_cfg = dev->config;
|
||||
|
||||
drv_data->adc = device_get_binding(drv_cfg->io_channel.label);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
LOG_MODULE_REGISTER(EC11, CONFIG_SENSOR_LOG_LEVEL);
|
||||
|
||||
static int ec11_get_ab_state(struct device *dev) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
const struct ec11_config *drv_cfg = dev->config;
|
||||
|
||||
return (gpio_pin_get(drv_data->a, drv_cfg->a_pin) << 1) |
|
||||
@@ -27,7 +27,7 @@ static int ec11_get_ab_state(struct device *dev) {
|
||||
}
|
||||
|
||||
static int ec11_sample_fetch(struct device *dev, enum sensor_channel chan) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
const struct ec11_config *drv_cfg = dev->config;
|
||||
uint8_t val;
|
||||
int8_t delta;
|
||||
@@ -70,7 +70,7 @@ static int ec11_sample_fetch(struct device *dev, enum sensor_channel chan) {
|
||||
|
||||
static int ec11_channel_get(struct device *dev, enum sensor_channel chan,
|
||||
struct sensor_value *val) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
|
||||
if (chan != SENSOR_CHAN_ROTATION) {
|
||||
return -ENOTSUP;
|
||||
@@ -91,7 +91,7 @@ static const struct sensor_driver_api ec11_driver_api = {
|
||||
};
|
||||
|
||||
int ec11_init(struct device *dev) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
const struct ec11_config *drv_cfg = dev->config;
|
||||
|
||||
LOG_DBG("A: %s %d B: %s %d resolution %d", drv_cfg->a_label, drv_cfg->a_pin, drv_cfg->b_label,
|
||||
|
||||
@@ -20,7 +20,7 @@ extern struct ec11_data ec11_driver;
|
||||
LOG_MODULE_DECLARE(EC11, CONFIG_SENSOR_LOG_LEVEL);
|
||||
|
||||
static inline void setup_int(struct device *dev, bool enable) {
|
||||
struct ec11_data *data = dev->driver_data;
|
||||
struct ec11_data *data = dev->data;
|
||||
const struct ec11_config *cfg = dev->config;
|
||||
|
||||
LOG_DBG("enabled %s", (enable ? "true" : "false"));
|
||||
@@ -66,7 +66,7 @@ static void ec11_b_gpio_callback(struct device *dev, struct gpio_callback *cb, u
|
||||
|
||||
static void ec11_thread_cb(void *arg) {
|
||||
struct device *dev = arg;
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
|
||||
drv_data->handler(dev, drv_data->trigger);
|
||||
|
||||
@@ -76,7 +76,7 @@ static void ec11_thread_cb(void *arg) {
|
||||
#ifdef CONFIG_EC11_TRIGGER_OWN_THREAD
|
||||
static void ec11_thread(int dev_ptr, int unused) {
|
||||
struct device *dev = INT_TO_POINTER(dev_ptr);
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
|
||||
ARG_UNUSED(unused);
|
||||
|
||||
@@ -99,7 +99,7 @@ static void ec11_work_cb(struct k_work *work) {
|
||||
|
||||
int ec11_trigger_set(struct device *dev, const struct sensor_trigger *trig,
|
||||
sensor_trigger_handler_t handler) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
|
||||
setup_int(dev, false);
|
||||
|
||||
@@ -114,7 +114,7 @@ int ec11_trigger_set(struct device *dev, const struct sensor_trigger *trig,
|
||||
}
|
||||
|
||||
int ec11_init_interrupt(struct device *dev) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
struct ec11_data *drv_data = dev->data;
|
||||
const struct ec11_config *drv_cfg = dev->config;
|
||||
|
||||
drv_data->dev = dev;
|
||||
|
||||
Reference in New Issue
Block a user