Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
* can kernel platform driver name be different than module name?
@ 2020-03-22 16:26 Tomek The Messenger
  2020-03-22 16:34 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Tomek The Messenger @ 2020-03-22 16:26 UTC (permalink / raw)
  To: kernelnewbies

[-- Attachment #1.1: Type: text/plain, Size: 548 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 794 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: can kernel platform driver name be different than module name?
  2020-03-22 16:26 can kernel platform driver name be different than module name? Tomek The Messenger
@ 2020-03-22 16:34 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2020-03-22 16:34 UTC (permalink / raw)
  To: Tomek The Messenger; +Cc: kernelnewbies

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-22 16:26 can kernel platform driver name be different than module name? Tomek The Messenger
2020-03-22 16:34 ` Greg KH

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git