Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/adc/adc_nrfx_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ static int init_adc(const struct device *dev)
{
const nrfx_adc_config_t config = NRFX_ADC_DEFAULT_CONFIG;

nrfx_err_t result = nrfx_adc_init(&config, event_handler);
int result = nrfx_adc_init(&config, event_handler);

if (result != NRFX_SUCCESS) {
if (result != 0) {
LOG_ERR("Failed to initialize device: %s",
dev->name);
return -EBUSY;
return result;
}

IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority),
Expand Down
67 changes: 32 additions & 35 deletions drivers/adc/adc_nrfx_saadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@
m_data.divide_single_ended_value &= ~BIT(channel_cfg->channel_id);
}

nrfx_err_t ret = nrfx_saadc_channel_config(&cfg);
err = nrfx_saadc_channel_config(&cfg);

if (ret != NRFX_SUCCESS) {
LOG_ERR("Cannot configure channel %d: 0x%08x", channel_cfg->channel_id, ret);
return -EINVAL;
if (err != 0) {
LOG_ERR("Cannot configure channel %d: %d", channel_cfg->channel_id, err);
return err;
}

return 0;
Expand All @@ -284,10 +284,10 @@
if (ctx->sequence.calibrate) {
nrfx_saadc_offset_calibrate(event_handler);
} else {
nrfx_err_t ret = nrfx_saadc_mode_trigger();
int ret = nrfx_saadc_mode_trigger();

if (ret != NRFX_SUCCESS) {
LOG_ERR("Cannot start sampling: 0x%08x", ret);
if (ret != 0) {
LOG_ERR("Cannot start sampling: %d", ret);
adc_context_complete(ctx, -EIO);
}
}
Expand All @@ -312,10 +312,9 @@
return;
}

nrfx_err_t nrfx_err =
nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt);
if (nrfx_err != NRFX_SUCCESS) {
LOG_ERR("Failed to set buffer: 0x%08x", nrfx_err);
error = nrfx_saadc_buffer_set(samples_buffer, m_data.active_channel_cnt);
if (error != 0) {
LOG_ERR("Failed to set buffer: %d", error);
adc_context_complete(ctx, -EIO);
}
}
Expand All @@ -326,10 +325,10 @@
if (!m_data.internal_timer_enabled) {
k_timer_start(&m_data.timer, K_NO_WAIT, K_USEC(ctx->options.interval_us));
} else {
nrfx_err_t ret = nrfx_saadc_mode_trigger();
int ret = nrfx_saadc_mode_trigger();

if (ret != NRFX_SUCCESS) {
LOG_ERR("Cannot start sampling: 0x%08x", ret);
if (ret != 0) {
LOG_ERR("Cannot start sampling: %d", ret);
adc_context_complete(&m_data.ctx, -EIO);
}
}
Expand Down Expand Up @@ -499,7 +498,6 @@
static int start_read(const struct device *dev,
const struct adc_sequence *sequence)
{
nrfx_err_t nrfx_err;
int error;
uint32_t selected_channels = sequence->channels;
nrf_saadc_resolution_t resolution;
Expand Down Expand Up @@ -557,21 +555,21 @@

m_data.internal_timer_enabled = true;

nrfx_err = nrfx_saadc_advanced_mode_set(selected_channels, resolution, &adv_config,
event_handler);
error = nrfx_saadc_advanced_mode_set(selected_channels, resolution, &adv_config,
event_handler);
} else {
m_data.internal_timer_enabled = false;

nrfx_err = nrfx_saadc_simple_mode_set(selected_channels, resolution, oversampling,
event_handler);
error = nrfx_saadc_simple_mode_set(selected_channels, resolution, oversampling,
event_handler);
}

if (nrfx_err != NRFX_SUCCESS) {
return -EINVAL;
if (error != 0) {
return error;
}

error = check_buffer_size(sequence, active_channel_cnt);
if (error) {
if (error != 0) {
return error;
}

Expand All @@ -592,14 +590,13 @@
/* Buffer is filled in chunks, each chunk composed of number of samples equal to number
* of active channels. Buffer pointer is advanced and reloaded after each chunk.
*/
nrfx_err = nrfx_saadc_buffer_set(
samples_buffer,
(m_data.internal_timer_enabled
? (1 + sequence->options->extra_samplings)
: active_channel_cnt));
if (nrfx_err != NRFX_SUCCESS) {
LOG_ERR("Failed to set buffer: 0x%08x", nrfx_err);
return -EINVAL;
error = nrfx_saadc_buffer_set(samples_buffer,
(m_data.internal_timer_enabled
? (1 + sequence->options->extra_samplings)
: active_channel_cnt));
if (error != 0) {

Check notice on line 597 in drivers/adc/adc_nrfx_saadc.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/adc/adc_nrfx_saadc.c:597 - ? (1 + sequence->options->extra_samplings) - : active_channel_cnt)); + ? (1 + sequence->options->extra_samplings) + : active_channel_cnt));
LOG_ERR("Failed to set buffer: %d", error);
return error;
}

adc_context_start_read(&m_data.ctx, sequence);
Expand Down Expand Up @@ -638,7 +635,7 @@

static void event_handler(const nrfx_saadc_evt_t *event)
{
nrfx_err_t err;
int err;

if (event->type == NRFX_SAADC_EVT_DONE) {
dmm_buffer_in_release(
Expand All @@ -657,8 +654,8 @@
adc_context_on_sampling_done(&m_data.ctx, DEVICE_DT_INST_GET(0));
} else if (event->type == NRFX_SAADC_EVT_CALIBRATEDONE) {
err = nrfx_saadc_mode_trigger();
if (err != NRFX_SUCCESS) {
LOG_ERR("Cannot start sampling: 0x%08x", err);
if (err != 0) {
LOG_ERR("Cannot start sampling: %d", err);
adc_context_complete(&m_data.ctx, -EIO);
}
} else if (event->type == NRFX_SAADC_EVT_FINISHED) {
Expand All @@ -668,13 +665,13 @@

static int init_saadc(const struct device *dev)
{
nrfx_err_t err;
int err;

k_timer_init(&m_data.timer, external_timer_expired_handler, NULL);

/* The priority value passed here is ignored (see nrfx_glue.h). */
err = nrfx_saadc_init(0);
if (err != NRFX_SUCCESS) {
if (err != 0) {
LOG_ERR("Failed to initialize device: %s", dev->name);
return -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/comparator/comparator_nrf_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static int shim_nrf_comp_init(const struct device *dev)
(void)shim_nrf_comp_diff_config_to_nrf(&shim_nrf_comp_config0, &nrf);
#endif

if (nrfx_comp_init(&nrf, shim_nrf_comp_event_handler) != NRFX_SUCCESS) {
if (nrfx_comp_init(&nrf, shim_nrf_comp_event_handler) != 0) {
return -ENODEV;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/comparator/comparator_nrf_lpcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@
&shim_nrf_lpcomp_data0.config);

if (nrfx_lpcomp_init(&shim_nrf_lpcomp_data0.config,
shim_nrf_lpcomp_event_handler) != NRFX_SUCCESS) {
shim_nrf_lpcomp_event_handler) != 0) {
return -ENODEV;

Check notice on line 360 in drivers/comparator/comparator_nrf_lpcomp.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/comparator/comparator_nrf_lpcomp.c:360 - if (nrfx_lpcomp_init(&shim_nrf_lpcomp_data0.config, - shim_nrf_lpcomp_event_handler) != 0) { + if (nrfx_lpcomp_init(&shim_nrf_lpcomp_data0.config, shim_nrf_lpcomp_event_handler) != 0) {
}

return pm_device_driver_init(dev, shim_nrf_lpcomp_pm_callback);
Expand Down
7 changes: 4 additions & 3 deletions drivers/counter/counter_nrfx_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ static int ppi_setup(const struct device *dev, uint8_t chan)
NRF_RTC_Type *rtc = nrfx_config->rtc;
nrf_rtc_event_t evt = NRF_RTC_CHANNEL_EVENT_ADDR(chan);
nrfx_err_t result;
int ret;

if (!nrfx_config->use_ppi) {
return 0;
Expand All @@ -405,10 +406,10 @@ static int ppi_setup(const struct device *dev, uint8_t chan)
evt_addr = nrfy_rtc_event_address_get(rtc, evt);
task_addr = nrfy_rtc_task_address_get(rtc, NRF_RTC_TASK_CLEAR);

result = nrfx_ppi_channel_alloc(&data->ppi_ch);
if (result != NRFX_SUCCESS) {
ret = nrfx_ppi_channel_alloc(&data->ppi_ch);
if (ret != 0) {
ERR("Failed to allocate PPI channel.");
return -ENODEV;
return ret;
}
(void)nrfx_ppi_channel_assign(data->ppi_ch, evt_addr, task_addr);
(void)nrfx_ppi_channel_enable(data->ppi_ch);
Expand Down
7 changes: 4 additions & 3 deletions drivers/display/display_nrf_led_matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,19 +438,20 @@ static int instance_init(const struct device *dev)
nrf_pwm_shorts_set(dev_config->pwm, NRF_PWM_SHORT_SEQEND0_STOP_MASK);
#else
nrfx_err_t err;
int ret;
nrf_ppi_channel_t ppi_ch;

for (int i = 0; i < GROUP_SIZE; ++i) {
uint8_t *gpiote_ch = &dev_data->gpiote_ch[i];

err = nrfx_ppi_channel_alloc(&ppi_ch);
if (err != NRFX_SUCCESS) {
ret = nrfx_ppi_channel_alloc(&ppi_ch);
if (ret != 0) {
LOG_ERR("Failed to allocate PPI channel.");
/* Do not bother with freeing resources allocated
* so far. The application needs to be reconfigured
* anyway.
*/
return -ENOMEM;
return ret;
}

err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch);
Expand Down
14 changes: 3 additions & 11 deletions drivers/entropy/entropy_nrf_cracen.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ static int nrf_cracen_get_entropy_isr(const struct device *dev, uint8_t *buf, ui

irq_unlock(key);

if (likely(ret == NRFX_SUCCESS)) {
if (likely(ret == 0)) {
return len;
} else if (ret == NRFX_ERROR_INVALID_PARAM) {
return -EINVAL;
} else {
return -EAGAIN;
return ret;
}
}

Expand All @@ -47,13 +45,7 @@ static int nrf_cracen_cracen_init(const struct device *dev)
{
(void)dev;

int ret = nrfx_cracen_ctr_drbg_init();

if (ret == NRFX_SUCCESS) {
return 0;
} else {
return -EIO;
}
return nrfx_cracen_ctr_drbg_init();
}

static DEVICE_API(entropy, nrf_cracen_api_funcs) = {
Expand Down
Loading
Loading