diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2012-07-26 19:48:23 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-07-26 22:25:10 +0200 |
commit | efff733ad83acf8502561a9cadc9202c6974e510 (patch) | |
tree | b81785cd64f750ac790c5b4306dc4b0b16ca641c /src/southbridge/nvidia/mcp55 | |
parent | 8730bf8aad995bf105454ac1a93dee4c7b5565d5 (diff) |
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 <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/1358
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/southbridge/nvidia/mcp55')
-rw-r--r-- | src/southbridge/nvidia/mcp55/lpc.c | 48 | ||||
-rw-r--r-- | src/southbridge/nvidia/mcp55/pcie.c | 32 |
2 files changed, 21 insertions, 59 deletions
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, }; - |