summaryrefslogtreecommitdiff
path: root/libhw_cr/rp2040_hwspi.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-16 09:05:28 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-16 09:05:28 -0600
commit29ad1efc7c6de44a965db9f181165b72a9ef8ff1 (patch)
treee13794366a09d0480253076d458b413faa5680a5 /libhw_cr/rp2040_hwspi.c
parent802ed1e3cd0252cafd1be2aada0addf4d3f7eb2e (diff)
parenta5061fa634af1e7011182e1c115151dd96af8393 (diff)
Merge branch 'lukeshu/9p-fix-flush'
Diffstat (limited to 'libhw_cr/rp2040_hwspi.c')
-rw-r--r--libhw_cr/rp2040_hwspi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c
index d181650..29a7bac 100644
--- a/libhw_cr/rp2040_hwspi.c
+++ b/libhw_cr/rp2040_hwspi.c
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-#include <alloca.h>
#include <inttypes.h> /* for PRIu{n} */
#include <hardware/clocks.h> /* for clock_get_hz() and clk_peri */
@@ -12,6 +11,7 @@
#include <hardware/spi.h>
#include <libcr/coroutine.h>
+#include <libmisc/alloc.h>
#include <libmisc/assert.h>
#define LOG_NAME RP2040_SPI
@@ -198,8 +198,8 @@ static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct dupl
* happens, so the IRQ machinery doesn't need to be engaged
* at all.
*/
- struct dma_alias1 *tx_data_blocks = alloca(sizeof(struct dma_alias1)*(pruned_iovcnt+1));
- struct dma_alias0 *rx_data_blocks = alloca(sizeof(struct dma_alias0)*(pruned_iovcnt+1));
+ struct dma_alias1 *tx_data_blocks = stack_alloc(pruned_iovcnt+1, struct dma_alias1);
+ struct dma_alias0 *rx_data_blocks = stack_alloc(pruned_iovcnt+1, struct dma_alias0);
static_assert(!DMA_IS_TRIGGER(typeof(tx_data_blocks[0]), ctrl));
static_assert(DMA_IS_TRIGGER(typeof(rx_data_blocks[0]), ctrl));