can kernel platform driver name be different than module name?

Greg KH greg at kroah.com
Sun Mar 22 12:34:32 EDT 2020


On Sun, Mar 22, 2020 at 05:26:09PM +0100, Tomek The Messenger wrote:
> I suppose the response is yes but I would like to make sure:
> Is below acceptable:
> some_module_name.c:
> #define DRIVER_NAME          "some-driver-name"
> ...
> static struct platform_driver some_driver = {
>     .driver = {
>         .name = DRIVER_NAME,
>         .of_match_table = of_match_ptr(some_of_match),
>     },
> 
> vs
> 
> Makefile:
> SRC := $(shell pwd)
> obj-m += some_module_name.o
> some_module_name-m := directoryInWhichThereIsUsFile/ some_module_name.o
> all:
> $(MAKE) -C $(KERNEL_SRC) M=$(SRC)
> modules_install:
> $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install

Sure, name it what ever you want, driver names only have to be unique to
the type of driver registered, while module names have to be unique to
all kernel module names.

hope this helps,

greg k-h



More information about the Kernelnewbies mailing list