From 7f3507b606b0f5c0c44cc59eb27e87575cf87701 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 26 Oct 2024 02:58:42 -0600 Subject: conventions: Don't have 2 ways to spell "implements_foo" Stop defining "struct foo" as a synonym for "implements_foo". --- cmd/sbc_harness/hw/rp2040_hwspi.c | 2 +- cmd/sbc_harness/hw/rp2040_hwspi.h | 2 +- cmd/sbc_harness/hw/spi.h | 12 ++++++------ cmd/sbc_harness/hw/w5500.c | 2 +- cmd/sbc_harness/hw/w5500.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'cmd/sbc_harness') diff --git a/cmd/sbc_harness/hw/rp2040_hwspi.c b/cmd/sbc_harness/hw/rp2040_hwspi.c index dd9a577..6742c60 100644 --- a/cmd/sbc_harness/hw/rp2040_hwspi.c +++ b/cmd/sbc_harness/hw/rp2040_hwspi.c @@ -1,4 +1,4 @@ -/* hw/rp2040_hwspi.c - `struct spi` implementation for the RP2040's +/* hw/rp2040_hwspi.c - `implements_spi` implementation for the RP2040's * ARM Primecell SSP (PL022) (implementation file) * * Copyright (C) 2024 Luke T. Shumaker diff --git a/cmd/sbc_harness/hw/rp2040_hwspi.h b/cmd/sbc_harness/hw/rp2040_hwspi.h index 8bf783f..8cf8aff 100644 --- a/cmd/sbc_harness/hw/rp2040_hwspi.h +++ b/cmd/sbc_harness/hw/rp2040_hwspi.h @@ -1,4 +1,4 @@ -/* hw/rp2040_hwspi.h - `struct spi` implementation for the RP2040's +/* hw/rp2040_hwspi.h - `implements_spi` implementation for the RP2040's * ARM Primecell SSP (PL022) (header file) * * Copyright (C) 2024 Luke T. Shumaker diff --git a/cmd/sbc_harness/hw/spi.h b/cmd/sbc_harness/hw/spi.h index 653e80f..da588de 100644 --- a/cmd/sbc_harness/hw/spi.h +++ b/cmd/sbc_harness/hw/spi.h @@ -22,7 +22,11 @@ struct bidi_iovec { size_t iov_len; }; -struct spi; +struct spi_vtable; + +typedef struct { + struct spi_vtable *vtable; +} implements_spi; /* This API assumes that an SPI frame is a multiple of 8-bits. * @@ -37,11 +41,7 @@ struct spi; * non-multiple-of-8 number of bits. */ struct spi_vtable { - void (*readwritev)(struct spi *, const struct bidi_iovec *iov, int iovcnt); + void (*readwritev)(implements_spi *, const struct bidi_iovec *iov, int iovcnt); }; -typedef struct spi { - struct spi_vtable *vtable; -} implements_spi; - #endif /* _HW_SPI_H_ */ diff --git a/cmd/sbc_harness/hw/w5500.c b/cmd/sbc_harness/hw/w5500.c index a6cdc8b..5e36bcf 100644 --- a/cmd/sbc_harness/hw/w5500.c +++ b/cmd/sbc_harness/hw/w5500.c @@ -170,7 +170,7 @@ static void w5500_intrhandler(uint gpio, uint32_t UNUSED(event_mask)) { } void _w5500_init(struct w5500 *chip, - struct spi* spi, uint pin_intr, uint pin_reset, + implements_spi *spi, uint pin_intr, uint pin_reset, struct net_eth_addr addr) { assert(chip); assert(spi); diff --git a/cmd/sbc_harness/hw/w5500.h b/cmd/sbc_harness/hw/w5500.h index 1b485dd..2ff04df 100644 --- a/cmd/sbc_harness/hw/w5500.h +++ b/cmd/sbc_harness/hw/w5500.h @@ -35,7 +35,7 @@ struct _w5500_tcp_listener { struct w5500 { /* const-after-init */ - struct spi *spidev; + implements_spi *spidev; uint pin_intr; uint pin_reset; struct net_eth_addr hwaddr; @@ -66,7 +66,7 @@ struct w5500 { _w5500_init(self, spi, pin_intr, pin_reset, eth_addr); \ } while (0) void _w5500_init(struct w5500 *self, - struct spi* spi, uint pin_intr, uint pin_reset, + implements_spi *spi, uint pin_intr, uint pin_reset, struct net_eth_addr addr); /** -- cgit v1.2.3-2-g168b