0c9e7231518c3f4af2081d01fbc3506f1379da02
[openwrt/staging/aparcar.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 --- a/drivers/spi/spi-cadence-quadspi.c
27 +++ b/drivers/spi/spi-cadence-quadspi.c
28 @@ -1230,10 +1230,7 @@ static bool cqspi_supports_mem_op(struct
29 if (!(all_true || all_false))
30 return false;
31
32 - if (all_true)
33 - return spi_mem_dtr_supports_op(mem, op);
34 - else
35 - return spi_mem_default_supports_op(mem, op);
36 + return spi_mem_default_supports_op(mem, op);
37 }
38
39 static int cqspi_of_get_flash_pdata(struct platform_device *pdev,
40 --- a/drivers/spi/spi-mem.c
41 +++ b/drivers/spi/spi-mem.c
42 @@ -160,16 +160,6 @@ static bool spi_mem_check_buswidth(struc
43 return true;
44 }
45
46 -bool spi_mem_dtr_supports_op(struct spi_mem *mem,
47 - const struct spi_mem_op *op)
48 -{
49 - if (op->cmd.nbytes != 2)
50 - return false;
51 -
52 - return spi_mem_check_buswidth(mem, op);
53 -}
54 -EXPORT_SYMBOL_GPL(spi_mem_dtr_supports_op);
55 -
56 bool spi_mem_default_supports_op(struct spi_mem *mem,
57 const struct spi_mem_op *op)
58 {
59 --- a/drivers/spi/spi-mxic.c
60 +++ b/drivers/spi/spi-mxic.c
61 @@ -331,8 +331,6 @@ static int mxic_spi_data_xfer(struct mxi
62 static bool mxic_spi_mem_supports_op(struct spi_mem *mem,
63 const struct spi_mem_op *op)
64 {
65 - bool all_false;
66 -
67 if (op->data.buswidth > 8 || op->addr.buswidth > 8 ||
68 op->dummy.buswidth > 8 || op->cmd.buswidth > 8)
69 return false;
70 @@ -344,13 +342,7 @@ static bool mxic_spi_mem_supports_op(str
71 if (op->addr.nbytes > 7)
72 return false;
73
74 - all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr &&
75 - !op->data.dtr;
76 -
77 - if (all_false)
78 - return spi_mem_default_supports_op(mem, op);
79 - else
80 - return spi_mem_dtr_supports_op(mem, op);
81 + return spi_mem_default_supports_op(mem, op);
82 }
83
84 static int mxic_spi_mem_exec_op(struct spi_mem *mem,
85 --- a/include/linux/spi/spi-mem.h
86 +++ b/include/linux/spi/spi-mem.h
87 @@ -330,10 +330,6 @@ void spi_controller_dma_unmap_mem_op_dat
88
89 bool spi_mem_default_supports_op(struct spi_mem *mem,
90 const struct spi_mem_op *op);
91 -
92 -bool spi_mem_dtr_supports_op(struct spi_mem *mem,
93 - const struct spi_mem_op *op);
94 -
95 #else
96 static inline int
97 spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr,
98 @@ -356,13 +352,6 @@ bool spi_mem_default_supports_op(struct
99 {
100 return false;
101 }
102 -
103 -static inline
104 -bool spi_mem_dtr_supports_op(struct spi_mem *mem,
105 - const struct spi_mem_op *op)
106 -{
107 - return false;
108 -}
109 #endif /* CONFIG_SPI_MEM */
110
111 int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op);