Re: help in address issues with a new driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 10, 2022 at 10:58:25PM +0000, Czerwacki, Eial wrote:
> Greetings, 
> 
> I'm working on a driver intended to be sent to staging soon and I've encountered two issue I'd like to get help with.
> the driver's hierarchy is one module file shared by other two modules.

So 1 .c file that needs to be built into 2 different .ko files?

Don't do that, it's a mess and is not worth it.  Please restructure your
code.


> when I try to select both all three drivers as modules, I the following these two errors:
> ~/workspace/linux-staging.git$ make modules -j 9
> scripts/kconfig/conf  --syncconfig Kconfig
>   DESCEND  objtool
>   CALL    scripts/atomic/check-atomics.sh
>   CALL    scripts/checksyscalls.sh
>   CHK     include/generated/compile.h
>   CHK     kernel/kheaders_data.tar.xz
>   GEN     kernel/kheaders_data.tar.xz
>   CC [M]  kernel/kheaders.o
>   MODPOST Module.symvers
> WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/vsmp-guest-driver/common/vsmp_version.o
> ERROR: modpost: "vsmp_release_op" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "vsmp_deregister_sysfs_group" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "vsmp_register_sysfs_group" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "vsmp_init_op" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "vsmp_read_buff_from_bar" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "vsmp_generic_buff_read" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "vsmp_read_reg_from_cfg" [drivers/staging/vsmp-guest-driver/common/vsmp_version.ko] undefined!
> ERROR: modpost: "sysfs_deregister_version_cb" [drivers/staging/vsmp-guest-driver/common/vsmp_common.ko] undefined!
> ERROR: modpost: "sysfs_register_version_cb" [drivers/staging/vsmp-guest-driver/common/vsmp_common.ko] undefined!
> make[1]: *** [scripts/Makefile.modpost:111: Module.symvers] Error 1
> make[1]: *** Deleting file 'Module.symvers'
> make: *** [Makefile:1370: modules] Error 2
> 
> vsmp_version.o is one file out of two in one module named common, the other one is the main entry point for the module, is it logical I need to define MODULE_LICENSE in both files?

MODULE_LICENSE has to end up once only in the resultant .ko file.  How
you make that happen is up to you.

> prior to the common module, the api module should be build but it isn't for some reason, the makefile looks like this:
> # SPDX-License-Identifier: GPL-2.0
> 
> ccflags-y += -I $(srctree)/drivers/staging/vsmp-guest-driver/include
> 
> obj-$(CONFIG_VSMP_GUEST_DRIVER) := api/vsmp_api.o
> obj-$(CONFIG_VSMP_GUEST_DRIVER_COMMON) := common/vsmp_common.o
> obj-$(CONFIG_VSMP_GUEST_DRIVER_COMMON) += common/vsmp_version.o
> obj-$(CONFIG_VSMP_GUEST_DRIVER_LOG) := vsmp_logs_handler.o
> 
> any ideas what I did wrong with the configuration?

Try not to use a subdir for files like this, it's not a good practice
and can be difficult as well.

Try to simplify all of this, it should not be complex.

But of course, without actually seeing the code, it's hard to tell
exactly what to do instead, sorry.

thanks,

greg k-h




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux