mafredri / asustor-platform-driver

Linux kernel platform driver for ASUSTOR NAS hardware (leds, buttons)
GNU General Public License v3.0
62 stars 9 forks source link

Make `find_chip_by_name` work with kernel 6.7 and newer #15

Closed DanielGibson closed 8 months ago

DanielGibson commented 8 months ago

gpiochip_find() was removed and replaced with gpio_device_find()

I haven't tested this myself (I don't have Linux 6.7 or newer on my machines), but this should fix the compilation issue mentioned in #14

vincentDcmps commented 8 months ago

hi try to compile and I have following error

make[1] : on entre dans le répertoire « /usr/lib/modules/6.7.4-arch1-1/build »
  CC [M]  /home/vincent/Documents/PKG_AUR/asustor-platform-driver-dkms-git/src/asustor-platform-driver/asustor.o
/home/vincent/Documents/PKG_AUR/asustor-platform-driver-dkms-git/src/asustor-platform-driver/asustor.c:277:5: attention: « LINUX_VERSION_CODE » n’est pas défini, évalué à 0 [-Wundef]
  277 | #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
      |     ^~~~~~~~~~~~~~~~~~
/home/vincent/Documents/PKG_AUR/asustor-platform-driver-dkms-git/src/asustor-platform-driver/asustor.c:277:26: attention: « KERNEL_VERSION » n’est pas défini, évalué à 0 [-Wundef]
  277 | #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
      |                          ^~~~~~~~~~~~~~
/home/vincent/Documents/PKG_AUR/asustor-platform-driver-dkms-git/src/asustor-platform-driver/asustor.c:277:40: erreur: missing binary operator before token "("
  277 | #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)

probably need #include <linux/version.h>

DanielGibson commented 8 months ago

yeah, does it compile and work if you add #include <linux/version.h> at the top of the file where the other includes are? possibly in my kernel version that headers is included implicitly through some other header, and in 6.7 it's not

vincentDcmps commented 8 months ago

yes compile correctly with this include, but I don't have currently test to install compiled file on my asustor

DanielGibson commented 8 months ago

Ok, I added the change, please let us know when you have tested this so we know this fix really works and @mafredri can merge it :)

vincentDcmps commented 8 months ago

Hi everyone Just test on my nas seem works well by the way I have create an archlinux package I will publish them when pull request will be merge https://git.ducamps.eu/vincent/asustor-platform-driver-dkms-git

mafredri commented 8 months ago

Thanks for working on this @DanielGibson!

And thanks for confirming the fix @vincentDcmps. PS. Nice work on the Arch package!

DanielGibson commented 8 months ago

Cool, thanks for testing and merging!