gschorcht / spi-ch341-usb

Linux kernel driver for CH341A USB to SPI and GPIO adapters
160 stars 63 forks source link

Compile errors from 2023 #27

Open enomado opened 1 year ago

enomado commented 1 year ago

Trying to make and

make[1]: Entering directory '/usr/lib/modules/6.5.4-arch2-1/build'
  CC [M]  /home/sc/t/spi-ch341-usb/spi-ch341-usb.o
/home/sc/t/spi-ch341-usb/spi-ch341-usb.c:163:30: error: field 'gpio' has incomplete type
  163 |     struct gpio_chip         gpio;                              // chip descriptor for GPIOs
      |                              ^~~~

/home/sc/t/spi-ch341-usb/spi-ch341-usb.c: In function 'ch341_spi_probe':
/home/sc/t/spi-ch341-usb/spi-ch341-usb.c:598:33: error: implicit declaration of function 'spi_busnum_to_master' [-Werror=implicit-function-declaration]
  598 |     while ((ch341_dev->master = spi_busnum_to_master(bus)))
enomado commented 1 year ago

fixed by adding

#include <linux/gpio/driver.h>

enomado commented 1 year ago

Now it cant find gpio_export. What a beautiful language.

Pigpog commented 1 year ago

There have been significant changes to the Linux kernel's GPIO API, which removed a few functions. The SPI API changed as well, removing spi_busnum_to_master. I think the SPI probe function will need to be mostly rewritten with the new device tree paradigm.

In addition, all instances of the term "master" have been deprecated and replaced with "controller", though for now there are macros keeping it backwards compatible.

A maintained fork (that built successfully on my 6.5.7 kernel) can be found at dimich-dmb/spi-ch341-usb

Hope this helps