aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-dw-pci.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2014-08-29 05:41:42 -0400
committerMark Brown <broonie@kernel.org>2014-09-01 06:29:03 -0400
commitc95791b6a5c5f18addb41530d1c27c8f5d612d65 (patch)
treecd71d06d154c67d817d138145a59882c729dbc10 /drivers/spi/spi-dw-pci.c
parent35f2d4136477ce2cd684b03e7f1b802963750394 (diff)
spi: dw-pci: provide platform specific data via driver_data
Instead of checking for device and vendor IDs inside probe function let's provide a helper function via driver_data. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-dw-pci.c')
-rw-r--r--drivers/spi/spi-dw-pci.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c
index 9e8d18cac03f..958bc4600877 100644
--- a/drivers/spi/spi-dw-pci.c
+++ b/drivers/spi/spi-dw-pci.c
@@ -32,11 +32,19 @@ struct dw_spi_pci {
32 struct dw_spi dws; 32 struct dw_spi dws;
33}; 33};
34 34
35static int spi_pci_probe(struct pci_dev *pdev, 35struct spi_pci_desc {
36 const struct pci_device_id *ent) 36 int (*setup)(struct dw_spi *);
37};
38
39static struct spi_pci_desc spi_pci_mid_desc = {
40 .setup = dw_spi_mid_init,
41};
42
43static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
37{ 44{
38 struct dw_spi_pci *dwpci; 45 struct dw_spi_pci *dwpci;
39 struct dw_spi *dws; 46 struct dw_spi *dws;
47 struct spi_pci_desc *desc = (struct spi_pci_desc *)ent->driver_data;
40 int pci_bar = 0; 48 int pci_bar = 0;
41 int ret; 49 int ret;
42 50
@@ -64,11 +72,11 @@ static int spi_pci_probe(struct pci_dev *pdev,
64 dws->irq = pdev->irq; 72 dws->irq = pdev->irq;
65 73
66 /* 74 /*
67 * Specific handling for Intel MID paltforms, like dma setup, 75 * Specific handling for paltforms, like dma setup,
68 * clock rate, FIFO depth. 76 * clock rate, FIFO depth.
69 */ 77 */
70 if (pdev->device == 0x0800) { 78 if (desc && desc->setup) {
71 ret = dw_spi_mid_init(dws); 79 ret = desc->setup(dws);
72 if (ret) 80 if (ret)
73 return ret; 81 return ret;
74 } 82 }
@@ -115,7 +123,7 @@ static SIMPLE_DEV_PM_OPS(dw_spi_pm_ops, spi_suspend, spi_resume);
115 123
116static const struct pci_device_id pci_ids[] = { 124static const struct pci_device_id pci_ids[] = {
117 /* Intel MID platform SPI controller 0 */ 125 /* Intel MID platform SPI controller 0 */
118 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) }, 126 { PCI_VDEVICE(INTEL, 0x0800), (kernel_ulong_t)&spi_pci_mid_desc},
119 {}, 127 {},
120}; 128};
121 129