summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Valla <francesco@valla.it>2026-09-15 22:24:37 +0200
committerMark Brown <broonie@kernel.org>2026-09-17 15:54:10 +0100
commit62b223cf4334c646bbb0b842ca0ff13c5cd0e875 (patch)
tree09d0a0d1a25a38b14e1699fecb412b6625cd2442
parent26f42ca8becd01877e762916865a168c1b6c4ff4 (diff)
downloadlinux-next-62b223cf4334c646bbb0b842ca0ff13c5cd0e875.tar.gz
linux-next-62b223cf4334c646bbb0b842ca0ff13c5cd0e875.zip
spi: virtio: drop unused field from private data
The mode_func_supported field is read from the config space into the driver's private data, but then never used outside of the function it is read in. Drop the variable from the private data and parse it from the stack instead. Signed-off-by: Francesco Valla <francesco@valla.it> Link: https://patch.msgid.link/20260915-virtio-spi-fix2-v1-2-7a474cb1b13b@valla.it Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-virtio.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/spi/spi-virtio.c b/drivers/spi/spi-virtio.c
index 96cdaf1b3697..cdee3a78979b 100644
--- a/drivers/spi/spi-virtio.c
+++ b/drivers/spi/spi-virtio.c
@@ -31,8 +31,6 @@ struct virtio_spi_priv {
struct virtio_device *vdev;
/* Pointer to the virtqueue */
struct virtqueue *vq;
- /* Copy of config space mode_func_supported */
- u32 mode_func_supported;
};
static void virtio_spi_msg_done(struct virtqueue *vq)
@@ -256,7 +254,7 @@ msg_done:
static void virtio_spi_read_config(struct virtio_device *vdev)
{
struct spi_controller *ctrl = dev_get_drvdata(&vdev->dev);
- struct virtio_spi_priv *priv = vdev->priv;
+ u32 mode_func_supported;
u8 cs_max_number;
u8 tx_nbits_supported;
u8 rx_nbits_supported;
@@ -266,18 +264,18 @@ static void virtio_spi_read_config(struct virtio_device *vdev)
ctrl->num_chipselect = cs_max_number;
/* Set the mode bits which are understood by this driver */
- priv->mode_func_supported =
+ mode_func_supported =
virtio_cread32(vdev, offsetof(struct virtio_spi_config,
mode_func_supported));
- ctrl->mode_bits = priv->mode_func_supported &
+ ctrl->mode_bits = mode_func_supported &
(VIRTIO_SPI_CS_HIGH | VIRTIO_SPI_MODE_LSB_FIRST);
- if (priv->mode_func_supported & VIRTIO_SPI_MF_SUPPORT_CPHA_1)
+ if (mode_func_supported & VIRTIO_SPI_MF_SUPPORT_CPHA_1)
ctrl->mode_bits |= VIRTIO_SPI_CPHA;
- if (priv->mode_func_supported & VIRTIO_SPI_MF_SUPPORT_CPOL_1)
+ if (mode_func_supported & VIRTIO_SPI_MF_SUPPORT_CPOL_1)
ctrl->mode_bits |= VIRTIO_SPI_CPOL;
- if (priv->mode_func_supported & VIRTIO_SPI_MF_SUPPORT_LSB_FIRST)
+ if (mode_func_supported & VIRTIO_SPI_MF_SUPPORT_LSB_FIRST)
ctrl->mode_bits |= SPI_LSB_FIRST;
- if (priv->mode_func_supported & VIRTIO_SPI_MF_SUPPORT_LOOPBACK)
+ if (mode_func_supported & VIRTIO_SPI_MF_SUPPORT_LOOPBACK)
ctrl->mode_bits |= SPI_LOOP;
tx_nbits_supported =
virtio_cread8(vdev, offsetof(struct virtio_spi_config,