Article 5E5BG Error compiling htu21 kernel iio module

Error compiling htu21 kernel iio module

by
justwantin
from LinuxQuestions.org on (#5E5BG)
I'm not quite sure if this is the place for this post. Please advise if not.

I have been trying to compile an iio kernel module for an htu21 breakout board. I have compiled other iio modules previously but this one has me stumped. It appears with my limited understanding that /include/linux/export.h is not working as intended. Perhaps someone can give me a heads up on a way to solve the problem.Code:root@bpro8: make M=drivers/iio/humidity/
AR drivers/iio/humidity//built-in.a
CC [M] drivers/iio/humidity//htu21.o
drivers/iio/humidity//htu21.c:178:3: error: const struct iio_info' has no member named driver_module'
178 | .driver_module = THIS_MODULE,
| ^~~~~~~~~~~~~
In file included from ./include/linux/linkage.h:7,
from ./include/linux/kernel.h:8,
from ./include/linux/list.h:9,
from ./include/linux/kobject.h:19,
from ./include/linux/device.h:16,
from drivers/iio/humidity//htu21.c:19:
./include/linux/export.h:17:21: error: initialization of int (*)(struct iio_dev *, const struct iio_chan_spec *, int *, int *, long int)' from incompatible pointer type struct module *' [-Werror=incompatible-pointer-types]
17 | #define THIS_MODULE (&__this_module)
| ^
drivers/iio/humidity//htu21.c:178:19: note: in expansion of macro THIS_MODULE'
178 | .driver_module = THIS_MODULE,
| ^~~~~~~~~~~
./include/linux/export.h:17:21: note: (near initialization for htu21_info.read_raw')
17 | #define THIS_MODULE (&__this_module)
| ^
drivers/iio/humidity//htu21.c:178:19: note: in expansion of macro THIS_MODULE'
178 | .driver_module = THIS_MODULE,
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:266: drivers/iio/humidity//htu21.o] Error 1
make: *** [Makefile:1729: drivers/iio/humidity/] Error 2This is the section of /include/linux/export.h where THIS_MODULE is definedCode:#ifndef __ASSEMBLY__
#ifdef MODULE
extern struct module __this_module;
#define THIS_MODULE (&__this_module)
#else
#define THIS_MODULE ((struct module *)0)
#endifI do not understand why the above fails. However by commenting out line 178 in htu21.cCode:static const struct iio_info htu21_info = {
.read_raw = htu21_read_raw,
.write_raw = htu21_write_raw,
.attrs = &htu21_attribute_group,
/* .driver_module = THIS_MODULE,*/it appears that the module htu21.ko remains undefined which seems to me to be something that export.h is supposed to take care of and then pass to htu21.c.Code:root@bpro8: make M=drivers/iio/humidity
AR drivers/iio/humidity/built-in.a
CC [M] drivers/iio/humidity/htu21.o
Building modules, stage 2.
MODPOST 1 modules
ERROR: "ms_sensors_read_serial" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_reset" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_show_battery_low" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_show_heater" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_write_heater" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_ht_read_temperature" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_ht_read_humidity" [drivers/iio/humidity/htu21.ko] undefined!
ERROR: "ms_sensors_write_resolution" [drivers/iio/humidity/htu21.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make: *** [Makefile:1642: modules] Error 2latest?d=yIl2AUoC8zA latest?i=V6dHw9-yLyg:KCzW_8YuNdU:F7zBnMy latest?i=V6dHw9-yLyg:KCzW_8YuNdU:V_sGLiP latest?d=qj6IDK7rITs latest?i=V6dHw9-yLyg:KCzW_8YuNdU:gIN9vFwV6dHw9-yLyg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments