linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 01/11] spi: pxa2xx-pci: Refactor CE4100 to use ->setup()
@ 2022-02-25 17:23 Andy Shevchenko
  2022-02-25 17:23 ` [PATCH v1 02/11] spi: pxa2xx-pci: Refactor Quark X1000 " Andy Shevchenko
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Andy Shevchenko @ 2022-02-25 17:23 UTC (permalink / raw)
  To: Andy Shevchenko, linux-arm-kernel, linux-spi, linux-kernel
  Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown

Refactor CE4100 handling code to use ->setup() instead of spreading
potentially confusing conditional.

Besides that, it will allow to refactor further to avoid intermediate
storage for the used configuration parameters.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx-pci.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 6d60972e4e20..bd20379d9342 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -30,7 +30,7 @@ enum {
 struct pxa_spi_info {
 	enum pxa_ssp_type type;
 	int port_id;
-	int num_chipselect;
+	unsigned int num_chipselect;
 	unsigned long max_clk_rate;
 
 	/* DMA channel request parameters */
@@ -114,6 +114,14 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
 	return 0;
 }
 
+static int ce4100_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
+{
+	c->num_chipselect = dev->devfn;
+	c->max_clk_rate = 3686400;
+
+	return 0;
+}
+
 static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
 {
 	struct dw_dma_slave *tx, *rx;
@@ -163,8 +171,7 @@ static struct pxa_spi_info spi_info_configs[] = {
 	[PORT_CE4100] = {
 		.type = PXA25x_SSP,
 		.port_id =  -1,
-		.num_chipselect = -1,
-		.max_clk_rate = 3686400,
+		.setup = ce4100_spi_setup,
 	},
 	[PORT_BYT] = {
 		.type = LPSS_BYT_SSP,
@@ -248,7 +255,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
 	}
 
 	memset(&spi_pdata, 0, sizeof(spi_pdata));
-	spi_pdata.num_chipselect = (c->num_chipselect > 0) ? c->num_chipselect : dev->devfn;
+	spi_pdata.num_chipselect = c->num_chipselect;
 	spi_pdata.dma_filter = c->dma_filter;
 	spi_pdata.tx_param = c->tx_param;
 	spi_pdata.rx_param = c->rx_param;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-02-28 22:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-25 17:23 [PATCH v1 01/11] spi: pxa2xx-pci: Refactor CE4100 to use ->setup() Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 02/11] spi: pxa2xx-pci: Refactor Quark X1000 " Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 03/11] spi: pxa2xx-pci: Drop redundant NULL check in ->probe() Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 04/11] spi: pxa2xx-pci: Move port_id assignment to ->setup() Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 05/11] spi: pxa2xx-pci: Move dma_burst_size " Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 06/11] spi: pxa2xx-pci: Move max_clk_rate " Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 07/11] spi: pxa2xx-pci: Replace enum with direct use of PCI IDs Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 08/11] spi: pxa2xx-pci: Drop unneeded checks in lpss_spi_setup() Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 09/11] spi: pxa2xx-pci: Extract pxa2xx_spi_pci_clk_register() Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 10/11] spi: pxa2xx-pci: Drop temporary storage use for a handful of members Andy Shevchenko
2022-02-25 17:23 ` [PATCH v1 11/11] spi: pxa2xx-pci: Constify struct pxa_spi_info variables Andy Shevchenko
2022-02-28 22:00 ` [PATCH v1 01/11] spi: pxa2xx-pci: Refactor CE4100 to use ->setup() Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).