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/amd/rs780/gfx.c | 60 ++++++++++------------------------------- src/southbridge/amd/sb600/usb.c | 31 +++++++-------------- 2 files changed, 24 insertions(+), 67 deletions(-) (limited to 'src/southbridge/amd') diff --git a/src/southbridge/amd/rs780/gfx.c b/src/southbridge/amd/rs780/gfx.c index 904e154de5..f70cd9bb79 100644 --- a/src/southbridge/amd/rs780/gfx.c +++ b/src/southbridge/amd/rs780/gfx.c @@ -1005,56 +1005,24 @@ static struct device_operations pcie_ops = { /* * We should list all of them here. * */ -static const struct pci_driver pcie_driver_780 __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS780_INT_GFX, +static const unsigned short pcie_780_ids[] = { + PCI_DEVICE_ID_ATI_RS780_INT_GFX, + PCI_DEVICE_ID_ATI_RS780C_INT_GFX, + PCI_DEVICE_ID_ATI_RS780M_INT_GFX, + PCI_DEVICE_ID_ATI_RS780MC_INT_GFX, + PCI_DEVICE_ID_ATI_RS780E_INT_GFX, + PCI_DEVICE_ID_ATI_RS785G_INT_GFX, + PCI_DEVICE_ID_ATI_RS785C_INT_GFX, + PCI_DEVICE_ID_ATI_RS785M_INT_GFX, + PCI_DEVICE_ID_ATI_RS785MC_INT_GFX, + PCI_DEVICE_ID_ATI_RS785D_INT_GFX, + 0 }; -static const struct pci_driver pcie_driver_780c __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS780C_INT_GFX, -}; -static const struct pci_driver pcie_driver_780m __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS780M_INT_GFX, -}; -static const struct pci_driver pcie_driver_780mc __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS780MC_INT_GFX, -}; -static const struct pci_driver pcie_driver_780e __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS780E_INT_GFX, -}; -static const struct pci_driver pcie_driver_785g __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS785G_INT_GFX, -}; -static const struct pci_driver pcie_driver_785c __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS785C_INT_GFX, -}; -static const struct pci_driver pcie_driver_785m __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS785M_INT_GFX, -}; -static const struct pci_driver pcie_driver_785mc __pci_driver = { - .ops = &pcie_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS785MC_INT_GFX, -}; -static const struct pci_driver pcie_driver_785d __pci_driver = { +static const struct pci_driver pcie_driver_780 __pci_driver = { .ops = &pcie_ops, .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_RS785D_INT_GFX, + .devices = pcie_780_ids, }; /* step 12 ~ step 14 from rpr */ diff --git a/src/southbridge/amd/sb600/usb.c b/src/southbridge/amd/sb600/usb.c index 7ff8f5c9a4..5023578fbf 100644 --- a/src/southbridge/amd/sb600/usb.c +++ b/src/southbridge/amd/sb600/usb.c @@ -164,30 +164,19 @@ static struct device_operations usb_ops = { .ops_pci = &lops_pci, }; -static const struct pci_driver usb_0_driver __pci_driver = { - .ops = &usb_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_SB600_USB_0, -}; -static const struct pci_driver usb_1_driver __pci_driver = { - .ops = &usb_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_SB600_USB_1, -}; -static const struct pci_driver usb_2_driver __pci_driver = { - .ops = &usb_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_SB600_USB_2, +static const unsigned short usb_ids[] = { + PCI_DEVICE_ID_ATI_SB600_USB_0, + PCI_DEVICE_ID_ATI_SB600_USB_1, + PCI_DEVICE_ID_ATI_SB600_USB_2, + PCI_DEVICE_ID_ATI_SB600_USB_3, + PCI_DEVICE_ID_ATI_SB600_USB_4, + 0, }; -static const struct pci_driver usb_3_driver __pci_driver = { - .ops = &usb_ops, - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_SB600_USB_3, -}; -static const struct pci_driver usb_4_driver __pci_driver = { + +static const struct pci_driver usb_0_driver __pci_driver = { .ops = &usb_ops, .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_SB600_USB_4, + .devices= usb_ids, }; static struct device_operations usb_ops2 = { -- cgit v1.2.3