diff mbox series

[v1,01/11] spi: pxa2xx-pci: Refactor CE4100 to use ->setup()

Message ID 20220225172350.69797-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit 78e27f970f73a4ee57dc050a6233e09a56963391
Headers show
Series [v1,01/11] spi: pxa2xx-pci: Refactor CE4100 to use ->setup() | expand

Commit Message

Andy Shevchenko Feb. 25, 2022, 5:23 p.m. UTC
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(-)

Comments

Mark Brown Feb. 28, 2022, 10 p.m. UTC | #1
On Fri, 25 Feb 2022 19:23:40 +0200, Andy Shevchenko wrote:
> 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.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[01/11] spi: pxa2xx-pci: Refactor CE4100 to use ->setup()
        commit: 78e27f970f73a4ee57dc050a6233e09a56963391
[02/11] spi: pxa2xx-pci: Refactor Quark X1000 to use ->setup()
        commit: 71ea0e3ac70a50b0c56105e116ed903f8e504e8f
[03/11] spi: pxa2xx-pci: Drop redundant NULL check in ->probe()
        commit: 1d9d62959f1b52eb939df38b9fda8beea455c751
[04/11] spi: pxa2xx-pci: Move port_id assignment to ->setup()
        commit: 108607ce4e39a51caca51aa97c44c31041a597d1
[05/11] spi: pxa2xx-pci: Move dma_burst_size assignment to ->setup()
        commit: bd2e24de10da015147b02f8c2c4b8ebea8fa9574
[06/11] spi: pxa2xx-pci: Move max_clk_rate assignment to ->setup()
        commit: 03f8e04e9f9be8d28c52ae801f37d49988f02ce4
[07/11] spi: pxa2xx-pci: Replace enum with direct use of PCI IDs
        commit: 7e425c3c3d15241aa5b6c442a83f11b8bc4fee91
[08/11] spi: pxa2xx-pci: Drop unneeded checks in lpss_spi_setup()
        commit: cb50f3f32a044ea45192a43e756b26048d35ba95
[09/11] spi: pxa2xx-pci: Extract pxa2xx_spi_pci_clk_register()
        commit: c3f4fc096b37bc2e4535f16ac3d65d517bbc14eb
[10/11] spi: pxa2xx-pci: Drop temporary storage use for a handful of members
        commit: ba8d1353d9c2d9190a523860e37bd7cb7b9de31b
[11/11] spi: pxa2xx-pci: Constify struct pxa_spi_info variables
        commit: fcaaf76ed5f3bbf346db9e49d9d9c0978d8f8dce

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

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;