Re: module-name-change breaks kobject ?

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

 



On Mon, May 16, 2005 at 03:34:41PM -0600, Jim Cromie wrote:
> Greg KH wrote:
> 
> >On Mon, May 16, 2005 at 01:50:02PM -0600, Jim Cromie wrote:
> > 
> >
> >>does kobject stuff rely on a strict name correspondence that makes
> >>this shortcut somehow invalid ?
> >>   
> >>
> >
> >The kernel will not let you register two drivers with the same name.
> >That is happening when you try to register the pci driver name.  That is
> >why this is failing.
> >
> >In short, don't do this, just unload your old driver and register a new
> >one.  It really isn't working the way you think it is (only the old one
> >gets bound to the device, not the new one.)
> >
> > 
> >
> I think I need to clarify (at some risk of repeating myself)
> pls forgive what may seem pedantic (it isnt meant to be)
> 
> the old drivers, scx200* are unloaded.
> the new ones are the old/existing code, built out of tree, and 
> customized some:
> 
> CUST?=scx200
> obj-m   += $(CUST).o
> obj-m   += $(CUST)_gpio.o
> 
> so they have different filenames.  the new filename is found by modprobe
> in extras, but only after I did a depmod. 
> 
> IOW, I misspoke about having them both loaded at once,
> rather theyre both available for modprobing, rmmoding.
> I did this CUST hack cuz there seemed to be naming interference
> like you described.

It's not just the module name that needs to be different, the internal,
driver name also needs to be different.

> my hacked version, foo.ko, has all the symbols that foo_gpio.ko needs,
> but theyre not renamed to get rid of the scx200_ prefix in the orginal 
> object.
> Is this why the scx200.ko module gets loaded if I dont preload foo.ko
> b4 foo_gpio.ko ? 
> 
> Or does it have to do with
>    static struct file_operations scx200_gpio_fops = {
>        .owner   = THIS_MODULE,
> or something else entirely ?

It has to do with a pci register function, which is not in the
drivers/char/scx200_gpio.c file that you are using as an example, right?

In the pci driver structure, there is a .name field.  That can not be
the same as any other pci driver that is currently loaded.  That is what
is failing in your reported log message.

Same thing goes for usb or i2c or whatever bus.

Hope this helps,

greg k-h

--
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