stoth68000 / sc0710

Linux driver for the Elgato 4k60 Pro Mk.2
Other
137 stars 18 forks source link

bus_to_virt deprecated and changes to dma on 6.0 Kernel #12

Open QuantumGerbil opened 1 year ago

QuantumGerbil commented 1 year ago
make -C /lib/modules/6.0.12-gentoo-dist/build M=/home/bmorgan/repos/sc0710 modules
make[1]: Entering directory '/usr/src/linux-6.0.12-gentoo-dist'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-pc-linux-gnu-gcc (Gentoo 11.3.0 p7) 11.3.0
  You are using:           gcc (Gentoo 11.3.0 p7) 11.3.0
  CC [M]  /home/bmorgan/repos/sc0710/sc0710-cards.o
  CC [M]  /home/bmorgan/repos/sc0710/sc0710-core.o
  CC [M]  /home/bmorgan/repos/sc0710/sc0710-i2c.o
/home/bmorgan/repos/sc0710/sc0710-i2c.c: In function ‘sc0710_i2c_read_hdmi_status’:
/home/bmorgan/repos/sc0710/sc0710-i2c.c:177:13: warning: unused variable ‘i’ [-Wunused-variable]
  177 |         int i;
      |             ^
  CC [M]  /home/bmorgan/repos/sc0710/sc0710-dma-channel.o
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c: In function ‘sc0710_dma_channel_chains_link’:
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c:369:50: error: implicit declaration of function ‘bus_to_virt’; did you mean ‘fix_to_virt’? [-Werror=implicit-function-declaration]
  369 |                         dca->wbm[0]            = bus_to_virt(curr_wbm);
      |                                                  ^~~~~~~~~~~
      |                                                  fix_to_virt
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c:369:48: warning: assignment to ‘u32 *’ {aka ‘unsigned int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  369 |                         dca->wbm[0]            = bus_to_virt(curr_wbm);
      |                                                ^
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c:370:48: warning: assignment to ‘u32 *’ {aka ‘unsigned int *’} from ‘long unsigned int’ makes pointer from integer without a cast [-Wint-conversion]
  370 |                         dca->wbm[1]            = bus_to_virt(curr_wbm) + sizeof(u32);
      |                                                ^
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c: In function ‘sc0710_dma_channel_alloc’:
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c:428:22: error: implicit declaration of function ‘pci_alloc_consistent’ [-Werror=implicit-function-declaration]
  428 |         ch->pt_cpu = pci_alloc_consistent(dev->pci, ch->pt_size, &ch->pt_dma);
      |                      ^~~~~~~~~~~~~~~~~~~~
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c:428:20: warning: assignment to ‘u64 *’ {aka ‘long long unsigned int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  428 |         ch->pt_cpu = pci_alloc_consistent(dev->pci, ch->pt_size, &ch->pt_dma);
      |                    ^
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c: In function ‘sc0710_dma_channel_resize’:
/home/bmorgan/repos/sc0710/sc0710-dma-channel.c:532:20: warning: assignment to ‘u64 *’ {aka ‘long long unsigned int *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  532 |         ch->pt_cpu = pci_alloc_consistent(dev->pci, ch->pt_size, &ch->pt_dma);
      |                    ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:249: /home/bmorgan/repos/sc0710/sc0710-dma-channel.o] Error 1
make[1]: *** [Makefile:1852: /home/bmorgan/repos/sc0710] Error 2
make[1]: Leaving directory '/usr/src/linux-6.0.12-gentoo-dist'
make: *** [Makefile:14: all] Error 2

Looking at the kernel documentation there is no direct replacement for bus_to_virt. pci_alloc_consistent and pci_free_consistent can be almost directly replaced with dma_alloc_consistent and dma_free_consistent however.

Subtixx commented 1 year ago

There is a fork here that has support for 6.0 kernels.

stoth68000 commented 1 year ago

Or, you could just submit a merge request.

On Wed, Jan 18, 2023 at 10:52 AM Dominic Hock @.***> wrote:

There is a fork here https://github.com/yerlikayao/sc0710 that has support for 6.0 kernels.

— Reply to this email directly, view it on GitHub https://github.com/stoth68000/sc0710/issues/12#issuecomment-1387294024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEERBCWTKWG67WE4UP7CFLWTAGSRANCNFSM6AAAAAAS5ZDVNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Subtixx commented 1 year ago

Submitted a PR https://github.com/stoth68000/sc0710/pull/15 that fixes the building on those kernel versions.