aymanbagabas/Huawei-WMI

Unable to compile for 6.3.7 kernel

Timarrr opened this issue · 4 comments

Describe the bug
Compilation fails on kernel 6.3.7 with incompatible pointer types error

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/aymanbagabas/Huawei-WMI
  2. make
  490 |         .add_battery = huawei_wmi_battery_add,
      |                        ^~~~~~~~~~~~~~~~~~~~~~
/home/mango/Huawei-WMI/huawei-wmi.c:490:24: note: (near initialization for ‘huawei_wmi_battery_hook.add_battery’)
/home/mango/Huawei-WMI/huawei-wmi.c:491:27: error: initialization of ‘int (*)(struct power_supply *, struct acpi_battery_hook *)’ from incompatible pointer type ‘int (*)(struct power_supply *)’ [-Werror=incompatible-pointer-types]
  491 |         .remove_battery = huawei_wmi_battery_remove,
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/mango/Huawei-WMI/huawei-wmi.c:491:27: note: (near initialization for ‘huawei_wmi_battery_hook.remove_battery’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:252: /home/mango/Huawei-WMI/huawei-wmi.o] Error 1
make[1]: *** [Makefile:2025: /home/mango/Huawei-WMI] Error 2
make: *** [Makefile:7: modules] Error 2

Expected behavior
Successful compilation and installation of module

Screenshots
image

(please complete the following information):

  • acpidump sudo acpidump > acpidump.txt
    acpidump.txt

  • dmidecode dmidecode > dmidecode
    dmidecode.txt

  • Kernel [e.g. 5.2.9-200.fc30.x86_64] uname -a
    Linux MangoTree 6.3.7-gentoo-dist #1 SMP PREEMPT_DYNAMIC Mon Jun 12 17:52:17 +10 2023 x86_64 AMD Ryzen 5 4600H with Radeon Graphics AuthenticAMD GNU/Linux

  • Distro [e.g. Fedora 30] `
    Gentoo

  • Loaded WMI modules lsmod | grep wmi

huawei_wmi             24576  0
ledtrig_audio          16384  1 huawei_wmi
wmi_bmof               16384  0
sparse_keymap          16384  1 huawei_wmi
wmi                    36864  3 video,huawei_wmi,wmi_bmof

Additional context
If any

Hello Ayman! I have the same problem on 6.2.0-31-generic kernel.
image

Could you try the latest code from master?

I've tried with the latest code from master and got this.
image

Adding #include <linux/version.h> fixes the build for me. I sent PR #77