module-name-change breaks kobject ?

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

 




Im hacking at the scx200 driver, so Ive copied a the files out of tree (for simpler/quicker compiles), written a simple makerfile, and built them.

the Makefile plays a name-change trick so I can have several versions of the same module loaded at once

[jimc@harpo scx-m2]$ more Makefile
REL?=2.6.12-rc4-mm1-soekris-myscx-v1

ifneq ($(KERNELRELEASE),)
# change mod-name to allow multiple installed variations
CUST?=scx200
obj-m   += $(CUST).o
obj-m   += $(CUST)_gpio.o
# but if change modname, adjust linkage
ifneq ($(CUST),scx200)
$(CUST)-objs            := scx200.o
$(CUST)_gpio-objs       := scx200_gpio.o
endif
...

They seem to build fine, and work correctly, (they install into extras)
but when built as
   make CUST=foo
the foo_gpio mdule throws an odd error on loading. (it works otherwize)

soekris:~# modprobe foo
soekris:~# modprobe foo_gpio
scx200: NatSemi SCx200 Driver
bus pci: add driver scx200
kobject_register failed for scx200 (-17)
[<c01f0c66>] kobject_register+0x36/0x50
[<c022b88e>] bus_add_driver+0x5e/0xa0
[<c022c0e6>] driver_register+0x26/0x30
[<c01fc909>] pci_register_driver+0x59/0x80
[<c883e014>] scx200_init+0x14/0x17 [scx200]
[<c01297e2>] sys_init_module+0x102/0x190
[<c0102919>] syscall_call+0x7/0xb
scx200_gpio: NatSemi SCx200 GPIO Driver
scx200_gpio: got dynamic major 254
soekris:~#
soekris:~# echo 0v > /dev/gpio-20
pin 20, bank 0 ioaddr 0x6100
scx200_gpio: GPIO-20: 0x00000003 OE PP PUD  EDGE LO
soekris:~#
soekris:~#

if I dont preload the 'foo' module, 'foo-gpio' loads scx200.ko, which would
be the module normally stacked underneath foo-gpio.
In this case it does not ive the 'kobject-register' error.

although the sample printout is from my modified/hacked driver,
it throws the same errors when using the original (unaltered) driver code in an out-of-tree
directory, along with the CUST= makefile.


does kobject stuff rely on a strict name correspondence that makes
this shortcut somehow invalid ?



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux