提交 025cd2f6 编写于 作者: J James Courtier-Dutton 提交者: Jaroslav Kysela

[ALSA] snd-ca0106, snd-emu10k1: Add symlink in the sys tree.

CA0106 driver,EMU10K1/EMU10K2 driver
A thread appeared on the LKML. This patch implements the fix.

Question:
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.

Answer:
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.
Signed-off-by: NJames Courtier-Dutton <James@superbug.co.uk>
上级 a5022b0d
...@@ -1390,6 +1390,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids); ...@@ -1390,6 +1390,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids);
// pci_driver definition // pci_driver definition
static struct pci_driver driver = { static struct pci_driver driver = {
.name = "CA0106", .name = "CA0106",
.owner = THIS_MODULE,
.id_table = snd_ca0106_ids, .id_table = snd_ca0106_ids,
.probe = snd_ca0106_probe, .probe = snd_ca0106_probe,
.remove = __devexit_p(snd_ca0106_remove), .remove = __devexit_p(snd_ca0106_remove),
......
...@@ -223,6 +223,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci) ...@@ -223,6 +223,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci)
static struct pci_driver driver = { static struct pci_driver driver = {
.name = "EMU10K1_Audigy", .name = "EMU10K1_Audigy",
.owner = THIS_MODULE,
.id_table = snd_emu10k1_ids, .id_table = snd_emu10k1_ids,
.probe = snd_card_emu10k1_probe, .probe = snd_card_emu10k1_probe,
.remove = __devexit_p(snd_card_emu10k1_remove), .remove = __devexit_p(snd_card_emu10k1_remove),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册