public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* SysFS, module names and .name
@ 2005-09-01 20:28 iSteve
  2005-09-02 15:53 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: iSteve @ 2005-09-01 20:28 UTC (permalink / raw)
  To: linux-kernel

Greetings,
in sysfs, /sys/bus/*/drivers lists the driver names, with their exported 
.name (eg. '.name = "EMU10K1_Audigy"' in the module code, from now on 
'driver name'). In /sys/modules, the kernel modules are listed with 
their module name, eg. snd_emu10k1. However, it seems to me that in 
sysfs, there is no way in particular to tell, which module has which 
.name. That is, that snd_emu10k1 is EMU10K1_Audigy and vice versa.

I wonder whether it wouldn't be possible to add a symlink to the 
particular module from the driver, and/or from the module to the driver, 
so the list of devices handled by the module and the module name would 
be accessible. This way, I would know which driver name corresponds to 
which module name and vice versa.

Or am I just boldly missing something, and there is a way how to do this 
from userspace, preferably without reading /proc/kcore?

Thanks in advance for reply.

  - iSteve

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

* Re: SysFS, module names and .name
  2005-09-01 20:28 SysFS, module names and .name iSteve
@ 2005-09-02 15:53 ` Greg KH
  2005-09-02 22:17   ` iSteve
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2005-09-02 15:53 UTC (permalink / raw)
  To: iSteve; +Cc: linux-kernel

On Thu, Sep 01, 2005 at 10:28:56PM +0200, iSteve wrote:
> Greetings,
> in sysfs, /sys/bus/*/drivers lists the driver names, with their exported 
> .name (eg. '.name = "EMU10K1_Audigy"' in the module code, from now on 
> 'driver name'). In /sys/modules, the kernel modules are listed with 
> their module name, eg. snd_emu10k1. However, it seems to me that in 
> sysfs, there is no way in particular to tell, which module has which 
> .name. That is, that snd_emu10k1 is EMU10K1_Audigy and vice versa.
> 
> I wonder whether it wouldn't be possible to add a symlink to the 
> particular module from the driver, and/or from the module to the driver, 
> so the list of devices handled by the module and the module name would 
> be accessible. This way, I would know which driver name corresponds to 
> which module name and vice versa.

It's already automatically created for some bus drivers (like USB).  I
had a simple patch to enable this for PCI, but haven't gotten around to
changing every single pci driver to enable it.  If you want to do so,
it isn't tough at all.

thanks,

greg k-h

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

* Re: SysFS, module names and .name
  2005-09-02 15:53 ` Greg KH
@ 2005-09-02 22:17   ` iSteve
  2005-09-03  5:31     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: iSteve @ 2005-09-02 22:17 UTC (permalink / raw)
  To: Greg KH, linux-kernel

Yes, I am rather interested -- could you please provide details about 
this method?

Thanks in advance.

  - iSteve

Greg KH wrote:
> On Thu, Sep 01, 2005 at 10:28:56PM +0200, iSteve wrote:
> 
>>Greetings,
>>in sysfs, /sys/bus/*/drivers lists the driver names, with their exported 
>>.name (eg. '.name = "EMU10K1_Audigy"' in the module code, from now on 
>>'driver name'). In /sys/modules, the kernel modules are listed with 
>>their module name, eg. snd_emu10k1. However, it seems to me that in 
>>sysfs, there is no way in particular to tell, which module has which 
>>.name. That is, that snd_emu10k1 is EMU10K1_Audigy and vice versa.
>>
>>I wonder whether it wouldn't be possible to add a symlink to the 
>>particular module from the driver, and/or from the module to the driver, 
>>so the list of devices handled by the module and the module name would 
>>be accessible. This way, I would know which driver name corresponds to 
>>which module name and vice versa.
> 
> 
> It's already automatically created for some bus drivers (like USB).  I
> had a simple patch to enable this for PCI, but haven't gotten around to
> changing every single pci driver to enable it.  If you want to do so,
> it isn't tough at all.
> 
> thanks,
> 
> greg k-h

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

* Re: SysFS, module names and .name
  2005-09-02 22:17   ` iSteve
@ 2005-09-03  5:31     ` Greg KH
  2005-09-03 10:55       ` James Courtier-Dutton
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2005-09-03  5:31 UTC (permalink / raw)
  To: iSteve; +Cc: linux-kernel

On Sat, Sep 03, 2005 at 12:17:57AM +0200, iSteve wrote:
> Yes, I am rather interested -- could you please provide details about 
> this method?

For PCI drivers, just add the line:
	.owner = THIS_MODULE,

to their struct pci_driver definition and you will get the symlink
created for you.

USB drivers already do this.

Hope this helps,

greg k-h

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

* Re: SysFS, module names and .name
  2005-09-03  5:31     ` Greg KH
@ 2005-09-03 10:55       ` James Courtier-Dutton
  0 siblings, 0 replies; 5+ messages in thread
From: James Courtier-Dutton @ 2005-09-03 10:55 UTC (permalink / raw)
  To: Greg KH; +Cc: iSteve, linux-kernel

Greg KH wrote:
> On Sat, Sep 03, 2005 at 12:17:57AM +0200, iSteve wrote:
> 
>>Yes, I am rather interested -- could you please provide details about 
>>this method?
> 
> 
> For PCI drivers, just add the line:
> 	.owner = THIS_MODULE,
> 
> to their struct pci_driver definition and you will get the symlink
> created for you.
> 
> USB drivers already do this.
> 
> Hope this helps,
> 
> greg k-h
> -

I will add this to the alsa driver snd-emu10k1 and snd-ca0106.

James


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

end of thread, other threads:[~2005-09-03 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01 20:28 SysFS, module names and .name iSteve
2005-09-02 15:53 ` Greg KH
2005-09-02 22:17   ` iSteve
2005-09-03  5:31     ` Greg KH
2005-09-03 10:55       ` James Courtier-Dutton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox