efc0ed526c8b40932adaf42925f5df39f2257b04
[openwrt/staging/svanheule.git] /
1 From 2e5fba82e4aeb72d71230eef2541881615aaf7cf Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Thu, 27 Jan 2022 10:18:00 +0100
4 Subject: [PATCH 06/15] spi: spi-mem: Kill the spi_mem_dtr_supports_op() helper
5
6 Now that spi_mem_default_supports_op() has access to the static
7 controller capabilities (relating to memory operations), and now that
8 these capabilities have been filled by the relevant controllers, there
9 is no need for a specific helper checking only DTR operations, so let's
10 just kill spi_mem_dtr_supports_op() and simply use
11 spi_mem_default_supports_op() instead.
12
13 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
14 Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
15 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
16 Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
17 Link: https://lore.kernel.org/linux-mtd/20220127091808.1043392-6-miquel.raynal@bootlin.com
18 (cherry picked from commit 9a15efc5d5e6b5beaed0883e5bdcd0b1384c1b20)
19 ---
20 drivers/spi/spi-cadence-quadspi.c | 5 +----
21 drivers/spi/spi-mem.c | 10 ----------
22 drivers/spi/spi-mxic.c | 10 +---------
23 include/linux/spi/spi-mem.h | 11 -----------
24 4 files changed, 2 insertions(+), 34 deletions(-)
25
26 diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
27 index 101cc71bffa7..2c98d6a9a2aa 100644
28 --- a/drivers/spi/spi-cadence-quadspi.c
29 +++ b/drivers/spi/spi-cadence-quadspi.c
30 @@ -1252,10 +1252,7 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem,
31 if (!(all_true || all_false))
32 return false;
33
34 - if (all_true)
35 - return spi_mem_dtr_supports_op(mem, op);
36 - else
37 - return spi_mem_default_supports_op(mem, op);
38 + return spi_mem_default_supports_op(mem, op);
39 }
40
41 static int cqspi_of_get_flash_pdata(struct platform_device *pdev,
42 diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
43 index 86e6597bc3dc..ed966d8129eb 100644
44 --- a/drivers/spi/spi-mem.c
45 +++ b/drivers/spi/spi-mem.c
46 @@ -160,16 +160,6 @@ static bool spi_mem_check_buswidth(struct spi_mem *mem,
47 return true;
48 }
49
50 -bool spi_mem_dtr_supports_op(struct spi_mem *mem,
51 - const struct spi_mem_op *op)
52 -{
53 - if (op->cmd.nbytes != 2)
54 - return false;
55 -
56 - return spi_mem_check_buswidth(mem, op);
57 -}
58 -EXPORT_SYMBOL_GPL(spi_mem_dtr_supports_op);
59 -
60 bool spi_mem_default_supports_op(struct spi_mem *mem,
61 const struct spi_mem_op *op)
62 {
63 diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c
64 index 45889947afed..e895df09896a 100644
65 --- a/drivers/spi/spi-mxic.c
66 +++ b/drivers/spi/spi-mxic.c
67 @@ -335,8 +335,6 @@ static int mxic_spi_data_xfer(struct mxic_spi *mxic, const void *txbuf,
68 static bool mxic_spi_mem_supports_op(struct spi_mem *mem,
69 const struct spi_mem_op *op)
70 {
71 - bool all_false;
72 -
73 if (op->data.buswidth > 8 || op->addr.buswidth > 8 ||
74 op->dummy.buswidth > 8 || op->cmd.buswidth > 8)
75 return false;
76 @@ -348,13 +346,7 @@ static bool mxic_spi_mem_supports_op(struct spi_mem *mem,
77 if (op->addr.nbytes > 7)
78 return false;
79
80 - all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr &&
81 - !op->data.dtr;
82 -
83 - if (all_false)
84 - return spi_mem_default_supports_op(mem, op);
85 - else
86 - return spi_mem_dtr_supports_op(mem, op);
87 + return spi_mem_default_supports_op(mem, op);
88 }
89
90 static int mxic_spi_mem_exec_op(struct spi_mem *mem,
91 diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
92 index 38e5d45c9842..4a1bfe689872 100644
93 --- a/include/linux/spi/spi-mem.h
94 +++ b/include/linux/spi/spi-mem.h
95 @@ -330,10 +330,6 @@ void spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr,
96
97 bool spi_mem_default_supports_op(struct spi_mem *mem,
98 const struct spi_mem_op *op);
99 -
100 -bool spi_mem_dtr_supports_op(struct spi_mem *mem,
101 - const struct spi_mem_op *op);
102 -
103 #else
104 static inline int
105 spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr,
106 @@ -356,13 +352,6 @@ bool spi_mem_default_supports_op(struct spi_mem *mem,
107 {
108 return false;
109 }
110 -
111 -static inline
112 -bool spi_mem_dtr_supports_op(struct spi_mem *mem,
113 - const struct spi_mem_op *op)
114 -{
115 - return false;
116 -}
117 #endif /* CONFIG_SPI_MEM */
118
119 int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op);
120 --
121 2.35.1
122