happycube / cxadc-linux3

CX2388x direct ADC capture driver, updated for Linux 3.x+ and 64-bit
81 stars 18 forks source link

Use of deprecated functions seem to break compilation with recent kernels #28

Closed oyvindln closed 1 year ago

oyvindln commented 2 years ago

As reported by alan_ and kaliohelix on discord - pci_alloc_consistent , pci_free_consistent and possibly more functions currently used have been removed

See e.g:

https://lore.kernel.org/lkml/20220106222804.GA330366@bhelgaas/T/

Looks like it's mostly just replacing with different functions with potentially slightly different signature that is needed: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2397228.html Seems this has been around for a bit

atsampson commented 1 year ago

Building against Linux 6.1:

make[1]: Entering directory '/src/linux/linux/work/v6.1'
  CC [M]  /src/linux/linux/work/cxadc-module/cxadc.o
/src/linux/linux/work/cxadc-module/cxadc.c: In function ‘alloc_risc_inst_buffer’:
/src/linux/linux/work/cxadc-module/cxadc.c:221:31: error: implicit declaration of function ‘pci_alloc_consistent’ [-Werror=implicit-function-declaration]
  221 |         ctd->risc_inst_virt = pci_alloc_consistent(ctd->pci, ctd->risc_inst_buff_size, &ctd->risc_inst_phy);
      |                               ^~~~~~~~~~~~~~~~~~~~
/src/linux/linux/work/cxadc-module/cxadc.c:221:29: warning: assignment to ‘unsigned int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  221 |         ctd->risc_inst_virt = pci_alloc_consistent(ctd->pci, ctd->risc_inst_buff_size, &ctd->risc_inst_phy);
      |                             ^
/src/linux/linux/work/cxadc-module/cxadc.c: In function ‘free_risc_inst_buffer’:
/src/linux/linux/work/cxadc-module/cxadc.c:235:17: error: implicit declaration of function ‘pci_free_consistent’ [-Werror=implicit-function-declaration]
  235 |                 pci_free_consistent(ctd->pci, ctd->risc_inst_buff_size, ctd->risc_inst_virt, ctd->risc_inst_phy);
      |                 ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:250: /src/linux/linux/work/cxadc-module/cxadc.o] Error 1
make[1]: *** [Makefile:1992: /src/linux/linux/work/cxadc-module] Error 2
make[1]: Leaving directory '/src/linux/linux/work/v6.1'