--- conftest.sh.old 2004-09-15 10:57:44.000000000 +1000 +++ conftest.sh 2004-09-15 11:48:52.561314384 +1000 @@ -23,6 +23,30 @@ fi case "$4" in + check_pci_class) + # + # Determine if the current kernel uses pci_find_class or pci_get_class + # + + echo "#include + int do_test_pci_class(void) { + struct pci_dev *get_dev; + get_dev = pci_get_class(0,NULL); + }" > conftest$$.c + + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then + echo "get" + rm -f conftest$$.o + exit 0 + else + echo "find" + exit 0 + fi + ;; + remap_page_range) # # Determine the number of arguments expected by remap_page_range. --- nv.c.old 2004-09-15 11:40:05.079503808 +1000 +++ nv.c 2004-09-15 11:47:40.042338944 +1000 @@ -639,7 +639,11 @@ u8 cap_ptr; int func, slot; +#ifdef HAVE_PCI_GET_CLASS + dev = pci_get_class(class << 8, NULL); +#else dev = pci_find_class(class << 8, NULL); +#endif do { for (func = 0; func < 8; func++) { slot = PCI_SLOT(dev->devfn); @@ -650,7 +654,11 @@ if (cap_ptr) return fn; } +#ifdef HAVE_PCI_GET_CLASS + dev = pci_get_class(class << 8, dev); +#else dev = pci_find_class(class << 8, dev); +#endif } while (dev); return NULL; @@ -3484,12 +3492,20 @@ struct pci_dev *dev = NULL; int count = 0; +#ifdef HAVE_PCI_GET_CLASS + dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev); +#else dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, dev); +#endif while (dev) { if ((dev->vendor == 0x10de) && (dev->device >= 0x20)) count++; +#ifdef HAVE_PCI_GET_CLASS + dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev); +#else dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, dev); +#endif } return count; } --- Makefile.kbuild.old 2004-09-15 10:57:52.000000000 +1000 +++ Makefile.kbuild 2004-09-15 11:39:30.153813320 +1000 @@ -185,6 +185,12 @@ endif endif +ifeq ($(shell $(CONFTEST) check_pci_class), get) + EXTRA_CFLAGS += -DHAVE_PCI_GET_CLASS +else + EXTRA_CFLAGS += -DHAVE_PCI_FIND_CLASS +endif + # # Miscellaneous NVIDIA kernel module build support targets. They are needed # to satisfy KBUILD requirements and to support NVIDIA specifics. --- Makefile.nvidia.old 2004-09-15 11:44:30.980080776 +1000 +++ Makefile.nvidia 2004-09-15 11:45:37.209012448 +1000 @@ -73,6 +73,12 @@ DEFINES += -DNV_CHANGE_PAGE_ATTR_PRESENT endif +ifeq ($(shell $(CONFTEST) check_pci_class), get) + DEFINES += -DHAVE_PCI_GET_CLASS +else + DEFINES += -DHAVE_PCI_FIND_CLASS +endif + DEFINES+=$(EXTRA_DEFINES) # allow build parameters to be passed in through the environment