Skip to content

Commit 7425070

Browse files
xodus7kartben
authored andcommitted
drivers: sensor: tmp112: format file
Format before other changes. Signed-off-by: Corey Wharton <xodus7@cwharton.com>
1 parent 881c64d commit 7425070

File tree

1 file changed

+23
-34
lines changed

1 file changed

+23
-34
lines changed

drivers/sensor/ti/tmp112/tmp112.c

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
LOG_MODULE_REGISTER(TMP112, CONFIG_SENSOR_LOG_LEVEL);
2020

21-
static int tmp112_reg_read(const struct tmp112_config *cfg,
22-
uint8_t reg, uint16_t *val)
21+
static int tmp112_reg_read(const struct tmp112_config *cfg, uint8_t reg, uint16_t *val)
2322
{
2423
if (i2c_burst_read_dt(&cfg->bus, reg, (uint8_t *)val, sizeof(*val)) < 0) {
2524
return -EIO;
@@ -30,8 +29,7 @@ static int tmp112_reg_read(const struct tmp112_config *cfg,
3029
return 0;
3130
}
3231

33-
static int tmp112_reg_write(const struct tmp112_config *cfg,
34-
uint8_t reg, uint16_t val)
32+
static int tmp112_reg_write(const struct tmp112_config *cfg, uint8_t reg, uint16_t val)
3533
{
3634
uint8_t buf[3];
3735

@@ -41,14 +39,12 @@ static int tmp112_reg_write(const struct tmp112_config *cfg,
4139
return i2c_write_dt(&cfg->bus, buf, sizeof(buf));
4240
}
4341

44-
static uint16_t set_config_flags(struct tmp112_data *data, uint16_t mask,
45-
uint16_t value)
42+
static uint16_t set_config_flags(struct tmp112_data *data, uint16_t mask, uint16_t value)
4643
{
4744
return (data->config_reg & ~mask) | (value & mask);
4845
}
4946

50-
static int tmp112_update_config(const struct device *dev, uint16_t mask,
51-
uint16_t val)
47+
static int tmp112_update_config(const struct device *dev, uint16_t mask, uint16_t val)
5248
{
5349
int rc;
5450
struct tmp112_data *data = dev->data;
@@ -62,10 +58,8 @@ static int tmp112_update_config(const struct device *dev, uint16_t mask,
6258
return rc;
6359
}
6460

65-
static int tmp112_attr_set(const struct device *dev,
66-
enum sensor_channel chan,
67-
enum sensor_attribute attr,
68-
const struct sensor_value *val)
61+
static int tmp112_attr_set(const struct device *dev, enum sensor_channel chan,
62+
enum sensor_attribute attr, const struct sensor_value *val)
6963
{
7064
uint16_t value;
7165
uint16_t cr;
@@ -136,8 +130,7 @@ static int tmp112_attr_set(const struct device *dev,
136130
return 0;
137131
}
138132

139-
static int tmp112_sample_fetch(const struct device *dev,
140-
enum sensor_channel chan)
133+
static int tmp112_sample_fetch(const struct device *dev, enum sensor_channel chan)
141134
{
142135
struct tmp112_data *drv_data = dev->data;
143136
const struct tmp112_config *cfg = dev->config;
@@ -150,18 +143,15 @@ static int tmp112_sample_fetch(const struct device *dev,
150143
}
151144

152145
if (val & TMP112_DATA_EXTENDED) {
153-
drv_data->sample = arithmetic_shift_right((int16_t)val,
154-
TMP112_DATA_EXTENDED_SHIFT);
146+
drv_data->sample = arithmetic_shift_right((int16_t)val, TMP112_DATA_EXTENDED_SHIFT);
155147
} else {
156-
drv_data->sample = arithmetic_shift_right((int16_t)val,
157-
TMP112_DATA_NORMAL_SHIFT);
148+
drv_data->sample = arithmetic_shift_right((int16_t)val, TMP112_DATA_NORMAL_SHIFT);
158149
}
159150

160151
return 0;
161152
}
162153

163-
static int tmp112_channel_get(const struct device *dev,
164-
enum sensor_channel chan,
154+
static int tmp112_channel_get(const struct device *dev, enum sensor_channel chan,
165155
struct sensor_value *val)
166156
{
167157
struct tmp112_data *drv_data = dev->data;
@@ -194,23 +184,22 @@ int tmp112_init(const struct device *dev)
194184
return -EINVAL;
195185
}
196186

197-
data->config_reg = TMP112_CONV_RATE(cfg->cr) | TMP112_CONV_RES_MASK
198-
| (cfg->extended_mode ? TMP112_CONFIG_EM : 0);
187+
data->config_reg = TMP112_CONV_RATE(cfg->cr) | TMP112_CONV_RES_MASK |
188+
(cfg->extended_mode ? TMP112_CONFIG_EM : 0);
199189

200190
return tmp112_update_config(dev, 0, 0);
201191
}
202192

203-
204-
#define TMP112_INST(inst) \
205-
static struct tmp112_data tmp112_data_##inst; \
206-
static const struct tmp112_config tmp112_config_##inst = { \
207-
.bus = I2C_DT_SPEC_INST_GET(inst), \
208-
.cr = DT_INST_ENUM_IDX(inst, conversion_rate), \
209-
.extended_mode = DT_INST_PROP(inst, extended_mode), \
210-
}; \
211-
\
212-
SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp112_init, NULL, &tmp112_data_##inst, \
213-
&tmp112_config_##inst, POST_KERNEL, \
214-
CONFIG_SENSOR_INIT_PRIORITY, &tmp112_driver_api);
193+
#define TMP112_INST(inst) \
194+
static struct tmp112_data tmp112_data_##inst; \
195+
static const struct tmp112_config tmp112_config_##inst = { \
196+
.bus = I2C_DT_SPEC_INST_GET(inst), \
197+
.cr = DT_INST_ENUM_IDX(inst, conversion_rate), \
198+
.extended_mode = DT_INST_PROP(inst, extended_mode), \
199+
}; \
200+
\
201+
SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp112_init, NULL, &tmp112_data_##inst, \
202+
&tmp112_config_##inst, POST_KERNEL, \
203+
CONFIG_SENSOR_INIT_PRIORITY, &tmp112_driver_api);
215204

216205
DT_INST_FOREACH_STATUS_OKAY(TMP112_INST)

0 commit comments

Comments
 (0)