28757B2 / cc1101-driver

Linux device driver for the Texas Instruments CC1101 radio
GNU General Public License v2.0
31 stars 12 forks source link

I too cannot compile... #8

Open johnineasttexas opened 5 months ago

johnineasttexas commented 5 months ago

This seems to be the same issue that danucu was having

Neither: sudo dkms build -m cc1101 -v 1.4.0

nor: sudo dkms build -m cc1101 -v 1.3.3

work - the make.log that I get for them are:

DKMS make.log for cc1101-1.4.0 for kernel 6.1.0-rpi7-rpi-v8 (aarch64)
Mon 15 Jan 20:39:20 CST 2024
make -C /lib/modules/6.1.0-rpi7-rpi-v8/build M=/var/lib/dkms/cc1101/1.4.0/build modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
  CC [M]  /var/lib/dkms/cc1101/1.4.0/build/cc1101_main.o
/var/lib/dkms/cc1101/1.4.0/build/cc1101_main.c:161:15: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Werror=incompatible-pointer-types]
  161 |     .remove = cc1101_spi_remove,
      |               ^~~~~~~~~~~~~~~~~
/var/lib/dkms/cc1101/1.4.0/build/cc1101_main.c:161:15: note: (near initialization for ‘cc1101_driver.remove’)
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/scripts/Makefile.build:255: /var/lib/dkms/cc1101/1.4.0/build/cc1101_main.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/Makefile:2039: /var/lib/dkms/cc1101/1.4.0/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make: *** [Makefile:5: all] Error 2

and:

DKMS make.log for cc1101-1.3.3 for kernel 6.1.0-rpi7-rpi-v8 (aarch64)
Mon 15 Jan 20:45:48 CST 2024
make -C /lib/modules/6.1.0-rpi7-rpi-v8/build M=/var/lib/dkms/cc1101/1.3.3/build modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
  CC [M]  /var/lib/dkms/cc1101/1.3.3/build/cc1101_main.o
/var/lib/dkms/cc1101/1.3.3/build/cc1101_main.c:161:15: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Werror=incompatible-pointer-types]
  161 |     .remove = cc1101_spi_remove,
      |               ^~~~~~~~~~~~~~~~~
/var/lib/dkms/cc1101/1.3.3/build/cc1101_main.c:161:15: note: (near initialization for ‘cc1101_driver.remove’)
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/scripts/Makefile.build:255: /var/lib/dkms/cc1101/1.3.3/build/cc1101_main.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/Makefile:2039: /var/lib/dkms/cc1101/1.3.3/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make: *** [Makefile:5: all] Error 2
felepeg commented 4 months ago

change the function cc1101_spi_remove in file cc1101_main.c for this one:

static void cc1101_spi_remove(struct spi_device *spi)
{
    cc1101_t* cc1101;
    cc1101 = spi_get_drvdata(spi);

    // Remove the RX timeout timer
    del_timer(&cc1101->rx_timeout);

    // Reset the hardware, placing it in idle mode
    cc1101_reset(cc1101);

    // Remove /dev/cc1101.x.x
    cc1101_chrdev_remove_device(cc1101);
    CC1101_INFO(cc1101, "Removed");
}
BubuOT commented 3 months ago

I've run into this too. Is this kernel version dependent (we're on 6.1) or gcc version dependent (we are on gcc 13)?

BubuOT commented 2 weeks ago

Another required change for compiling for kernel 6.6 (rpi default for a while now):

diff --git a/cc1101_chrdev.c b/cc1101_chrdev.c
index 489c569..9516fee 100644
--- a/cc1101_chrdev.c
+++ b/cc1101_chrdev.c
@@ -432,7 +432,7 @@ int cc1101_chrdev_setup(struct spi_driver* cc1101_driver)
         goto err_register;
     }

-       dev_class = class_create(THIS_MODULE, "cc1101");
+       dev_class = class_create("cc1101");^M
        if (IS_ERR(dev_class)) {
                ret = PTR_ERR(dev_class);
         goto err_class_create;
@@ -462,4 +462,4 @@ void cc1101_chrdev_teardown(struct spi_driver* cc1101_driver)
     spi_unregister_driver(cc1101_driver);
        class_destroy(dev_class);
        unregister_chrdev(SPI_MAJOR_NUMBER, cc1101_driver->driver.name);
-}
\ No newline at end of file
+}^M