Skip to content

Commit 588bde2

Browse files
[nrf fromlist] drivers: i2c: i2c_nrfx_twis: Align shim to new error handling
Aligned nrfx_twis shim to new errno error handling in NRFX. Upstream PR #: 98569 Signed-off-by: Adam Kondraciuk <[email protected]>
1 parent 6a24b36 commit 588bde2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/i2c/i2c_nrfx_twis.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void shim_nrf_twis_handle_read_req(const struct device *dev)
116116
nrfx_twis_t *twis = &dev_data->twis;
117117
uint8_t *buf;
118118
uint32_t buf_size;
119-
nrfx_err_t err;
119+
int err;
120120

121121
if (callbacks->buf_read_requested(target_config, &buf, &buf_size)) {
122122
LOG_ERR("no buffer provided");
@@ -131,7 +131,7 @@ static void shim_nrf_twis_handle_read_req(const struct device *dev)
131131
memcpy(dev_config->buf, buf, buf_size);
132132

133133
err = nrfx_twis_tx_prepare(twis, dev_config->buf, buf_size);
134-
if (err != NRFX_SUCCESS) {
134+
if (err < 0) {
135135
LOG_ERR("tx prepare failed");
136136
return;
137137
}
@@ -142,10 +142,10 @@ static void shim_nrf_twis_handle_write_req(const struct device *dev)
142142
struct shim_nrf_twis_data *dev_data = dev->data;
143143
const struct shim_nrf_twis_config *dev_config = dev->config;
144144
nrfx_twis_t *twis = &dev_data->twis;
145-
nrfx_err_t err;
145+
int err;
146146

147147
err = nrfx_twis_rx_prepare(twis, dev_config->buf, SHIM_NRF_TWIS_BUF_SIZE);
148-
if (err != NRFX_SUCCESS) {
148+
if (err < 0) {
149149
LOG_ERR("rx prepare failed");
150150
return;
151151
}
@@ -209,7 +209,7 @@ static int shim_nrf_twis_target_register(const struct device *dev,
209209
{
210210
struct shim_nrf_twis_data *dev_data = dev->data;
211211
nrfx_twis_t *twis = &dev_data->twis;
212-
nrfx_err_t err;
212+
int err;
213213
const nrfx_twis_config_t config = {
214214
.addr = {
215215
target_config->address,
@@ -226,7 +226,7 @@ static int shim_nrf_twis_target_register(const struct device *dev,
226226
shim_nrf_twis_disable(dev);
227227

228228
err = nrfx_twis_reconfigure(twis, &config);
229-
if (err != NRFX_SUCCESS) {
229+
if (err < 0) {
230230
return -ENODEV;
231231
}
232232

@@ -262,15 +262,15 @@ static int shim_nrf_twis_init(const struct device *dev)
262262
{
263263
struct shim_nrf_twis_data *dev_data = dev->data;
264264
const struct shim_nrf_twis_config *dev_config = dev->config;
265-
nrfx_err_t err;
265+
int err;
266266
const nrfx_twis_config_t config = {
267267
.skip_gpio_cfg = true,
268268
.skip_psel_cfg = true,
269269
};
270270

271271
dev_config->pre_init();
272272
err = nrfx_twis_init(&dev_data->twis, &config, dev_config->event_handler);
273-
if (err != NRFX_SUCCESS) {
273+
if (err < 0) {
274274
return -ENODEV;
275275
}
276276

0 commit comments

Comments
 (0)