summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSerge Semin <Sergey.Semin@baikalelectronics.ru>2020-05-22 03:07:52 +0300
committerMark Brown <broonie@kernel.org>2020-05-22 13:45:53 +0100
commit2afccbd283ae63072391ea17ac1d772ed9d33749 (patch)
tree5704de9430a5f0e00753a5079b8265f1d38c2a98 /drivers
parent43dba9f3f98c2b184a19f856f06fe22817bfd9e0 (diff)
downloadlinux-2afccbd283ae63072391ea17ac1d772ed9d33749.tar.bz2
spi: dw: Discard static DW DMA slave structures
Having them declared is redundant since each struct dw_dma_chan has the same structure embedded and the structure from the passed dma_chan private pointer will be copied there as a result of the next calls chain: dma_request_channel() -> find_candidate() -> dma_chan_get() -> device_alloc_chan_resources() = dwc_alloc_chan_resources() -> dw_dma_filter(). So just remove the static dw_dma_chan structures and use a locally declared data instance with dst_id/src_id set to the same values as the static copies used to have. Co-developed-by: Georgy Vlasov <Georgy.Vlasov@baikalelectronics.ru> Signed-off-by: Georgy Vlasov <Georgy.Vlasov@baikalelectronics.ru> Co-developed-by: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru> Signed-off-by: Ramil Zaripov <Ramil.Zaripov@baikalelectronics.ru> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Paul Burton <paulburton@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Rob Herring <robh+dt@kernel.org> Cc: linux-mips@vger.kernel.org Cc: devicetree@vger.kernel.org Link: https://lore.kernel.org/r/20200522000806.7381-4-Sergey.Semin@baikalelectronics.ru Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-dw-mid.c19
-rw-r--r--drivers/spi/spi-dw.h2
2 files changed, 8 insertions, 13 deletions
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index 1578dfebc92b..a39bde9996a4 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -20,9 +20,6 @@
#define RX_BUSY 0
#define TX_BUSY 1
-static struct dw_dma_slave mid_dma_tx = { .dst_id = 1 };
-static struct dw_dma_slave mid_dma_rx = { .src_id = 0 };
-
static bool mid_spi_dma_chan_filter(struct dma_chan *chan, void *param)
{
struct dw_dma_slave *s = param;
@@ -36,9 +33,11 @@ static bool mid_spi_dma_chan_filter(struct dma_chan *chan, void *param)
static int mid_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws)
{
+ struct dw_dma_slave slave = {
+ .src_id = 0,
+ .dst_id = 0
+ };
struct pci_dev *dma_dev;
- struct dw_dma_slave *tx = dws->dma_tx;
- struct dw_dma_slave *rx = dws->dma_rx;
dma_cap_mask_t mask;
/*
@@ -53,14 +52,14 @@ static int mid_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws)
dma_cap_set(DMA_SLAVE, mask);
/* 1. Init rx channel */
- rx->dma_dev = &dma_dev->dev;
- dws->rxchan = dma_request_channel(mask, mid_spi_dma_chan_filter, rx);
+ slave.dma_dev = &dma_dev->dev;
+ dws->rxchan = dma_request_channel(mask, mid_spi_dma_chan_filter, &slave);
if (!dws->rxchan)
goto err_exit;
/* 2. Init tx channel */
- tx->dma_dev = &dma_dev->dev;
- dws->txchan = dma_request_channel(mask, mid_spi_dma_chan_filter, tx);
+ slave.dst_id = 1;
+ dws->txchan = dma_request_channel(mask, mid_spi_dma_chan_filter, &slave);
if (!dws->txchan)
goto free_rxchan;
@@ -317,8 +316,6 @@ static const struct dw_spi_dma_ops mfld_dma_ops = {
static void dw_spi_mid_setup_dma_mfld(struct dw_spi *dws)
{
- dws->dma_tx = &mid_dma_tx;
- dws->dma_rx = &mid_dma_rx;
dws->dma_ops = &mfld_dma_ops;
}
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index e92d43b9a9e6..e1b565438f23 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -146,8 +146,6 @@ struct dw_spi {
unsigned long dma_chan_busy;
dma_addr_t dma_addr; /* phy address of the Data register */
const struct dw_spi_dma_ops *dma_ops;
- void *dma_tx;
- void *dma_rx;
/* Bus interface info */
void *priv;