linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] spi: pxa2xx: Introduce temporary variables to increase readability
@ 2019-10-21 10:36 Andy Shevchenko
  2019-10-21 10:36 ` [PATCH v1 2/2] spi: pxa2xx: Drop extra check of platform_get_resource() returned value Andy Shevchenko
  2019-10-25 10:12 ` Applied "spi: pxa2xx: Introduce temporary variables to increase readability" " Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2019-10-21 10:36 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, linux-arm-kernel,
	Mark Brown, linux-spi
  Cc: Andy Shevchenko

The current conditional for PCI ID matching is hard to read.
Introduce couple of temporary variables to increase readability
of the code.

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

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 0390053ed8f5..02daba3dbd0d 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1516,13 +1516,14 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
 	struct pxa2xx_spi_controller *pdata;
 	struct ssp_device *ssp;
 	struct resource *res;
+	struct device *parent = pdev->dev.parent;
+	struct pci_dev *pcidev = dev_is_pci(parent) ? to_pci_dev(parent) : NULL;
 	const struct pci_device_id *pcidev_id = NULL;
 	enum pxa_ssp_type type;
 	const void *match;
 
-	if (dev_is_pci(pdev->dev.parent))
-		pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match,
-					 to_pci_dev(pdev->dev.parent));
+	if (pcidev)
+		pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev);
 
 	match = device_get_match_data(&pdev->dev);
 	if (match)
@@ -1549,8 +1550,8 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
 
 #ifdef CONFIG_PCI
 	if (pcidev_id) {
-		pdata->tx_param = pdev->dev.parent;
-		pdata->rx_param = pdev->dev.parent;
+		pdata->tx_param = parent;
+		pdata->rx_param = parent;
 		pdata->dma_filter = pxa2xx_spi_idma_filter;
 	}
 #endif
-- 
2.23.0

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

end of thread, other threads:[~2019-10-25 10:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-21 10:36 [PATCH v1 1/2] spi: pxa2xx: Introduce temporary variables to increase readability Andy Shevchenko
2019-10-21 10:36 ` [PATCH v1 2/2] spi: pxa2xx: Drop extra check of platform_get_resource() returned value Andy Shevchenko
2019-10-23 18:56   ` Applied "spi: pxa2xx: Drop extra check of platform_get_resource() returned value" to the spi tree Mark Brown
2019-10-25 10:12 ` Applied "spi: pxa2xx: Introduce temporary variables to increase readability" " 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).