KermsGit / dht22

DHT22 Kernel driver for Raspberry Pi
5 stars 4 forks source link

Cannot compile this on kernel 5.10.11-v7l+ #1

Open cinadr opened 3 years ago

cinadr commented 3 years ago

Hi!

I don't know if I can use this with kernel 5.10.11-v7l+ make throws back this:

make -C /lib/modules/5.10.11-v7l+/build M=/home/pi/dht22 clean
make[1]: Entering directory '/usr/src/linux-headers-5.10.11-v7l+'
make[1]: Leaving directory '/usr/src/linux-headers-5.10.11-v7l+'
make -C /lib/modules/5.10.11-v7l+/build M=/home/pi/dht22 modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.11-v7l+'
  CC [M]  /home/pi/dht22/dht22.o
/home/pi/dht22/dht22.c: In function ‘proc_show’:
/home/pi/dht22/dht22.c:312:17: error: storage size of ‘tv’ isn’t known
  struct timeval tv;
                 ^~
/home/pi/dht22/dht22.c:322:7: error: implicit declaration of function ‘ktime_to_timeval’; did you mean ‘ktime_get_real’? [-Werror=implicit-function-declaration]
  tv = ktime_to_timeval((dht22->read_timestamp));
       ^~~~~~~~~~~~~~~~
       ktime_get_real
/home/pi/dht22/dht22.c:312:17: warning: unused variable ‘tv’ [-Wunused-variable]
  struct timeval tv;
                 ^~
/home/pi/dht22/dht22.c: In function ‘proc_init’:
/home/pi/dht22/dht22.c:356:51: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  proc_file = proc_create(name, S_IRUGO, proc_dir, &proc_fileops);
                                                   ^~~~~~~~~~~~~
In file included from /home/pi/dht22/dht22.c:24:
./include/linux/proc_fs.h:109:24: note: expected ‘const struct proc_ops *’ but argument is of type ‘const struct file_operations *’
 struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops);
                        ^~~~~~~~~~~
/home/pi/dht22/dht22.c: At top level:
/home/pi/dht22/dht22.c:435:3: error: ‘const struct iio_info’ has no member named ‘driver_module’
  .driver_module = THIS_MODULE,
   ^~~~~~~~~~~~~
In file included from ./include/linux/linkage.h:7,
                 from ./include/linux/kernel.h:8,
                 from ./include/linux/interrupt.h:6,
                 from /home/pi/dht22/dht22.c:17:
./include/linux/export.h:17:21: error: initialization of ‘const struct attribute_group *’ from incompatible pointer type ‘struct module *’ [-Werror=incompatible-pointer-types]
 #define THIS_MODULE (&__this_module)
                     ^
/home/pi/dht22/dht22.c:435:19: note: in expansion of macro ‘THIS_MODULE’
  .driver_module = THIS_MODULE,
                   ^~~~~~~~~~~
./include/linux/export.h:17:21: note: (near initialization for ‘dht22_iio_info.event_attrs’)
 #define THIS_MODULE (&__this_module)
                     ^
/home/pi/dht22/dht22.c:435:19: note: in expansion of macro ‘THIS_MODULE’
  .driver_module = THIS_MODULE,
                   ^~~~~~~~~~~
/home/pi/dht22/dht22.c: In function ‘probe_dht22’:
/home/pi/dht22/dht22.c:517:2: error: implicit declaration of function ‘devm_iio_device_free’; did you mean ‘devm_iio_device_alloc’? [-Werror=implicit-function-declaration]
  devm_iio_device_free(dev, iio);
  ^~~~~~~~~~~~~~~~~~~~
  devm_iio_device_alloc
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:279: /home/pi/dht22/dht22.o] Error 1
make[1]: *** [Makefile:1808: /home/pi/dht22] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.11-v7l+'
make: *** [Makefile:14: compile] Error 2

Can you please correct this?

Quota commented 3 years ago

Same here, I also get compile errors starting with unknown storage size of 'tv' and that 'ktime_to_timeval' is unknown, and more.

My system is a raspberry pi 2 model b, and "uname -r" says "5.10.17-v7+".