From efff733ad83acf8502561a9cadc9202c6974e510 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 26 Jul 2012 19:48:23 +0200 Subject: Refactor driver structs Our driver infrastructure became more flexible recently. Make use of it. These are the low hanging fruits (files with 5 device variants or more), but there are still lots of files with less potential for deduplication. Change-Id: If6b7be5046581f81485a511b150f99b029b95c3b Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/1358 Reviewed-by: Stefan Reinauer Reviewed-by: Alexandru Gagniuc Tested-by: build bot (Jenkins) --- src/southbridge/nvidia/mcp55/lpc.c | 48 +++++++++---------------------------- src/southbridge/nvidia/mcp55/pcie.c | 32 ++++++++----------------- 2 files changed, 21 insertions(+), 59 deletions(-) (limited to 'src/southbridge/nvidia/mcp55') diff --git a/src/southbridge/nvidia/mcp55/lpc.c b/src/southbridge/nvidia/mcp55/lpc.c index 9ea192337f..d16e3cc509 100644 --- a/src/southbridge/nvidia/mcp55/lpc.c +++ b/src/southbridge/nvidia/mcp55/lpc.c @@ -260,46 +260,20 @@ static struct device_operations lpc_ops = { // .enable = mcp55_enable, .ops_pci = &mcp55_pci_ops, }; -static const struct pci_driver lpc_driver __pci_driver = { - .ops = &lpc_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC, -}; - -static const struct pci_driver lpc_driver_pro __pci_driver = { - .ops = &lpc_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_PRO, +static const unsigned short lpc_ids[] = { + PCI_DEVICE_ID_NVIDIA_MCP55_LPC, + PCI_DEVICE_ID_NVIDIA_MCP55_PRO, + PCI_DEVICE_ID_NVIDIA_MCP55_LPC_2, + PCI_DEVICE_ID_NVIDIA_MCP55_LPC_3, + PCI_DEVICE_ID_NVIDIA_MCP55_LPC_4, + PCI_DEVICE_ID_NVIDIA_MCP55_LPC_5, + PCI_DEVICE_ID_NVIDIA_MCP55_LPC_6, + 0 }; - -static const struct pci_driver lpc_driver_lpc2 __pci_driver = { - .ops = &lpc_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_2, -}; - -static const struct pci_driver lpc_driver_lpc3 __pci_driver = { - .ops = &lpc_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_3, -}; - -static const struct pci_driver lpc_driver_lpc4 __pci_driver = { - .ops = &lpc_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_4, -}; - -static const struct pci_driver lpc_driver_lpc5 __pci_driver = { - .ops = &lpc_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_5, -}; - -static const struct pci_driver lpc_driver_lpc6 __pci_driver = { +static const struct pci_driver lpc_driver __pci_driver = { .ops = &lpc_ops, .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_LPC_6, + .devices = lpc_ids, }; static struct device_operations lpc_slave_ops = { diff --git a/src/southbridge/nvidia/mcp55/pcie.c b/src/southbridge/nvidia/mcp55/pcie.c index cd43f878aa..108a9b1167 100644 --- a/src/southbridge/nvidia/mcp55/pcie.c +++ b/src/southbridge/nvidia/mcp55/pcie.c @@ -50,29 +50,17 @@ static struct device_operations pcie_ops = { // .enable = mcp55_enable, }; -static const struct pci_driver pciebc_driver __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_B_C, -}; -static const struct pci_driver pciee_driver __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_E, +static const unsigned short pcie_ids[] = { + PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_B_C, + PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_E, + PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_A, + PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_F, + PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_D, + 0 }; -static const struct pci_driver pciea_driver __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_A, -}; -static const struct pci_driver pcief_driver __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_F, -}; -static const struct pci_driver pcied_driver __pci_driver = { + +static const struct pci_driver pciebc_driver __pci_driver = { .ops = &pcie_ops, .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_MCP55_PCIE_D, + .devices= pcie_ids, }; - -- cgit v1.2.3