Skip to content

Conversation

martinbudden
Copy link

Fixes issue #2662.

Adds (void)transfer_count; for parameter transfer_count to avoid warning.

@lurch
Copy link
Contributor

lurch commented Sep 12, 2025

Would it be "better" to use the __unused attribute, e.g. https://github.com/raspberrypi/pico-sdk/blob/develop/src/rp2_common/hardware_dma/include/hardware/dma.h#L59 ?

@martinbudden
Copy link
Author

martinbudden commented Sep 12, 2025

I'm not familiar with the __unused attribute. Do you mean?

static inline uint32_t dma_encode_transfer_count_with_self_trigger(uint transfer_count) {
#if PICO_RP2040
    __unused transfer_count;
    panic_unsupported();
#else
    return dma_encode_transfer_count(transfer_count) | (DMA_CH0_TRANS_COUNT_MODE_VALUE_TRIGGER_SELF << DMA_CH0_TRANS_COUNT_MODE_LSB);
#endif
}

Since transfer_count is only unused in the PICO_RP2040 build.

Or do you mean

static inline uint32_t dma_encode_transfer_count_with_self_trigger(__unused uint transfer_count) {

Either way, I'll happily update the PR.

@lurch
Copy link
Contributor

lurch commented Sep 12, 2025

I'm not super-familiar either, I just remember seeing it used a lot of times (e.g. see the line that I linked to).
Perhaps @will-v-pi or @kilograham will be able to confirm the preferred style in pico-sdk. (I suspect they're just different ways of doing the same thing?)

@martinbudden
Copy link
Author

I've also seen (void) used in the code. As you say, it's just a question of confirming the prefered style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants