Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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 @@ -32,7 +32,7 @@
#endif
1,
"Definitions from nrf-saadc.h do not match those from nrfx_analog_common.h");

Check notice on line 35 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:35 - (NRF_SAADC_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && - (NRF_SAADC_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && - (NRF_SAADC_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && - (NRF_SAADC_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && - (NRF_SAADC_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && - (NRF_SAADC_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && - (NRF_SAADC_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) && + (NRF_SAADC_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && + (NRF_SAADC_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && + (NRF_SAADC_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && + (NRF_SAADC_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && + (NRF_SAADC_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && + (NRF_SAADC_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && + (NRF_SAADC_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) && #if defined(SAADC_CH_PSELP_PSELP_VDDHDIV5) - (NRF_SAADC_VDDHDIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) && + (NRF_SAADC_VDDHDIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) && #endif #if defined(SAADC_CH_PSELP_PSELP_VDD) - (NRF_SAADC_VDD == NRFX_ANALOG_INTERNAL_VDD) && -#endif - 1, + (NRF_SAADC_VDD == NRFX_ANALOG_INTERNAL_VDD) && +#endif + 1,
struct driver_data {
struct adc_context ctx;
uint8_t single_ended_channels;
Expand Down Expand Up @@ -222,7 +222,7 @@
#endif
},
.channel_index = channel_cfg->channel_id,
.pin_p = channel_cfg->input_positive,

Check notice on line 225 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:225 - .channel_config = { + .channel_config = + { #if NRF_SAADC_HAS_CH_CONFIG_RES - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, #endif #if NRF_SAADC_HAS_CH_BURST - .burst = NRF_SAADC_BURST_DISABLED, -#endif - }, + .burst = NRF_SAADC_BURST_DISABLED, +#endif + },
.pin_n = (channel_cfg->differential &&
(channel_cfg->input_negative != NRF_SAADC_GND))
? channel_cfg->input_negative
Expand Down 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);

Check notice on line 598 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:598 - ? (1 + sequence->options->extra_samplings) - : active_channel_cnt)); + ? (1 + sequence->options->extra_samplings) + : active_channel_cnt));
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 All @@ -694,7 +691,7 @@
#endif
.ref_internal = NRFX_SAADC_REF_INTERNAL_VALUE,
};

Check notice on line 694 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:694 - .read = adc_nrfx_read, + .read = adc_nrfx_read, #ifdef CONFIG_ADC_ASYNC - .read_async = adc_nrfx_read_async, -#endif - .ref_internal = NRFX_SAADC_REF_INTERNAL_VALUE, + .read_async = adc_nrfx_read_async, +#endif + .ref_internal = NRFX_SAADC_REF_INTERNAL_VALUE,
NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(0));

DEVICE_DT_INST_DEFINE(0, init_saadc, NULL, NULL, NULL, POST_KERNEL,
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 @@ -85,7 +85,7 @@
(NRF_COMP_AIN_VDD_DIV2 == NRFX_ANALOG_INTERNAL_VDDDIV2) &&
#endif
1,
"Definitions from nrf-comp.h do not match those from nrfx_analog_common.h");

Check notice on line 88 in drivers/comparator/comparator_nrf_comp.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_comp.c:88 - (NRF_COMP_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && - (NRF_COMP_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && - (NRF_COMP_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && - (NRF_COMP_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && - (NRF_COMP_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && - (NRF_COMP_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && - (NRF_COMP_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) && + (NRF_COMP_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && + (NRF_COMP_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && + (NRF_COMP_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && + (NRF_COMP_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && + (NRF_COMP_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && + (NRF_COMP_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && + (NRF_COMP_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) && #if defined(COMP_PSEL_PSEL_VddhDiv5) - (NRF_COMP_AIN_VDDH_DIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) && + (NRF_COMP_AIN_VDDH_DIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) && #endif #if defined(COMP_PSEL_PSEL_VddDiv2) - (NRF_COMP_AIN_VDD_DIV2 == NRFX_ANALOG_INTERNAL_VDDDIV2) && -#endif - 1, + (NRF_COMP_AIN_VDD_DIV2 == NRFX_ANALOG_INTERNAL_VDDDIV2) && +#endif + 1,

#ifndef COMP_MODE_SP_Normal
BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_SP_MODE(0) != COMP_NRF_COMP_SP_MODE_NORMAL);
Expand Down Expand Up @@ -537,7 +537,7 @@
(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 @@ -44,7 +44,7 @@
(NRF_COMP_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) &&
(NRF_COMP_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) &&
(NRF_COMP_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7),
"Definitions from nrf-comp.h do not match those from nrfx_analog_common.h");

Check notice on line 47 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:47 - (NRF_COMP_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && - (NRF_COMP_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && - (NRF_COMP_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && - (NRF_COMP_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && - (NRF_COMP_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && - (NRF_COMP_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && - (NRF_COMP_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7), + (NRF_COMP_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && + (NRF_COMP_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && + (NRF_COMP_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && + (NRF_COMP_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && + (NRF_COMP_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && + (NRF_COMP_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && + (NRF_COMP_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7),

#if (LPCOMP_REFSEL_RESOLUTION == 8)
BUILD_ASSERT((SHIM_NRF_LPCOMP_DT_INST_REFSEL(0) < COMP_NRF_LPCOMP_REFSEL_VDD_1_16) ||
Expand Down 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) {

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