Skip to contentSkip to conversation

create driver symlink in snd-aoa

PATCH In review Olaf Hering 2 participants 4 messages Dec 2, 2006 – Dec 4, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 create driver symlink in snd-aoa

create sysfs driver symlink for snd-aoa in /sys/bus/aoa-soundbus/devices/*/

---
 sound/aoa/fabrics/snd-aoa-fabric-layout.c |    3 +++
 1 file changed, 3 insertions(+)
sound/aoa/fabrics/snd-aoa-fabric-layout.c +3 -0
Index: linux-2.6/sound/aoa/fabrics/snd-aoa-fabric-layout.c
===================================================================
@@ -1107,6 +1107,9 @@ static struct soundbus_driver aoa_soundb
 	.suspend = aoa_fabric_layout_suspend,
 	.resume = aoa_fabric_layout_resume,
 #endif
+	.driver = {
+		.owner = THIS_MODULE,
+	}
 };
 
 static int __init aoa_fabric_layout_init(void)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#1 lore raw

PATCH 1/1 create device symlink in snd-aoa

create sysfs device symlinks for snd-aoa in /sys/class/sound/controlC0 This allows hald to recognize the device as sound device. Furthermore it allows the desktop user to actually access the sound device nodes. hald and related packages will modify the acl attributes.

Fixes https://bugzilla.novell.com/show_bug.cgi?id=106294

---
 sound/aoa/aoa.h                           |    2 +-
 sound/aoa/core/snd-aoa-alsa.c             |    3 ++-
 sound/aoa/core/snd-aoa-alsa.h             |    2 +-
 sound/aoa/core/snd-aoa-core.c             |    4 ++--
 sound/aoa/fabrics/snd-aoa-fabric-layout.c |    2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)
sound/aoa/aoa.h +1 -1
Index: linux-2.6/sound/aoa/aoa.h
===================================================================
@@ -99,7 +99,7 @@ struct aoa_fabric {
  * that are not assigned yet are passed to the fabric
  * again for reconsideration. */
 extern int
-aoa_fabric_register(struct aoa_fabric *fabric);
+aoa_fabric_register(struct aoa_fabric *fabric, struct device *dev);
 
 /* it is vital to call this when the fabric exits!
  * When calling, the remove_codec will be called
sound/aoa/fabrics/snd-aoa-fabric-layout.c +1 -1
Index: linux-2.6/sound/aoa/fabrics/snd-aoa-fabric-layout.c
===================================================================
@@ -1014,7 +1014,7 @@ static int aoa_fabric_layout_probe(struc
 
 	ldev->gpio.methods->init(&ldev->gpio);
 
-	err = aoa_fabric_register(&layout_fabric);
+	err = aoa_fabric_register(&layout_fabric, &sdev->ofdev.dev);
 	if (err && err != -EALREADY) {
 		printk(KERN_INFO "snd-aoa-fabric-layout: can't use,"
 				 " another fabric is active!\n");
sound/aoa/core/snd-aoa-alsa.c +2 -1
Index: linux-2.6/sound/aoa/core/snd-aoa-alsa.c
===================================================================
@@ -14,7 +14,7 @@ MODULE_PARM_DESC(index, "index for AOA s
 
 static struct aoa_card *aoa_card;
 
-int aoa_alsa_init(char *name, struct module *mod)
+int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
 {
 	struct snd_card *alsa_card;
 	int err;
@@ -28,6 +28,7 @@ int aoa_alsa_init(char *name, struct mod
 		return -ENOMEM;
 	aoa_card = alsa_card->private_data;
 	aoa_card->alsa_card = alsa_card;
+	alsa_card->dev = dev;
 	strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
 	strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
 	strlcpy(alsa_card->longname, name, sizeof(alsa_card->longname));
sound/aoa/core/snd-aoa-alsa.h +1 -1
Index: linux-2.6/sound/aoa/core/snd-aoa-alsa.h
===================================================================
@@ -10,7 +10,7 @@
 #define __SND_AOA_ALSA_H
 #include "../aoa.h"
 
-extern int aoa_alsa_init(char *name, struct module *mod);
+extern int aoa_alsa_init(char *name, struct module *mod, struct device *dev);
 extern void aoa_alsa_cleanup(void);
 
 #endif /* __SND_AOA_ALSA_H */
sound/aoa/core/snd-aoa-core.c +2 -2
Index: linux-2.6/sound/aoa/core/snd-aoa-core.c
===================================================================
@@ -82,7 +82,7 @@ void aoa_codec_unregister(struct aoa_cod
 }
 EXPORT_SYMBOL_GPL(aoa_codec_unregister);
 
-int aoa_fabric_register(struct aoa_fabric *new_fabric)
+int aoa_fabric_register(struct aoa_fabric *new_fabric, struct device *dev)
 {
 	struct aoa_codec *c;
 	int err;
@@ -98,7 +98,7 @@ int aoa_fabric_register(struct aoa_fabri
 	if (!new_fabric)
 		return -EINVAL;
 
-	err = aoa_alsa_init(new_fabric->name, new_fabric->owner);
+	err = aoa_alsa_init(new_fabric->name, new_fabric->owner, dev);
 	if (err)
 		return err;
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

maintainer Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] create device symlink in snd-aoa

Quoted 6 lines · Olaf Hering

create sysfs device symlinks for snd-aoa in /sys/class/sound/controlC0 This allows hald to recognize the device as sound device. Furthermore it allows the desktop user to actually access the sound device nodes. hald and related packages will modify the acl attributes.

Fixes https://bugzilla.novell.com/show_bug.cgi?id=106294

This is probably the best solution we can come up now. I've been pondering doing this for a while and wasn't really sure which of the devices to use, this simply uses the i2s bus device.

Technically, this isn't really correct because the actual control is with the i2c codec chip, but there may be multiple so this is probably as good as we can do right now.

Quoted 85 lines
---
 sound/aoa/aoa.h                           |    2 +-
 sound/aoa/core/snd-aoa-alsa.c             |    3 ++-
 sound/aoa/core/snd-aoa-alsa.h             |    2 +-
 sound/aoa/core/snd-aoa-core.c             |    4 ++--
 sound/aoa/fabrics/snd-aoa-fabric-layout.c |    2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

Index: linux-2.6/sound/aoa/aoa.h
===================================================================

sound/aoa/aoa.h +1 -1
@@ -99,7 +99,7 @@ struct aoa_fabric {
  * that are not assigned yet are passed to the fabric
  * again for reconsideration. */
 extern int
-aoa_fabric_register(struct aoa_fabric *fabric);
+aoa_fabric_register(struct aoa_fabric *fabric, struct device *dev);
 
 /* it is vital to call this when the fabric exits!
  * When calling, the remove_codec will be called

Index: linux-2.6/sound/aoa/fabrics/snd-aoa-fabric-layout.c
===================================================================

sound/aoa/fabrics/snd-aoa-fabric-layout.c +1 -1
@@ -1014,7 +1014,7 @@ static int aoa_fabric_layout_probe(struc
 
 	ldev->gpio.methods->init(&ldev->gpio);
 
-	err = aoa_fabric_register(&layout_fabric);
+	err = aoa_fabric_register(&layout_fabric, &sdev->ofdev.dev);
 	if (err && err != -EALREADY) {
 		printk(KERN_INFO "snd-aoa-fabric-layout: can't use,"
 				 " another fabric is active!\n");

Index: linux-2.6/sound/aoa/core/snd-aoa-alsa.c
===================================================================

sound/aoa/core/snd-aoa-alsa.c +2 -1
@@ -14,7 +14,7 @@ MODULE_PARM_DESC(index, "index for AOA s
 
 static struct aoa_card *aoa_card;
 
-int aoa_alsa_init(char *name, struct module *mod)
+int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
 {
 	struct snd_card *alsa_card;
 	int err;
@@ -28,6 +28,7 @@ int aoa_alsa_init(char *name, struct mod
 		return -ENOMEM;
 	aoa_card = alsa_card->private_data;
 	aoa_card->alsa_card = alsa_card;
+	alsa_card->dev = dev;
 	strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
 	strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
 	strlcpy(alsa_card->longname, name, sizeof(alsa_card->longname));

Index: linux-2.6/sound/aoa/core/snd-aoa-alsa.h
===================================================================

sound/aoa/core/snd-aoa-alsa.h +1 -1
@@ -10,7 +10,7 @@
 #define __SND_AOA_ALSA_H
 #include "../aoa.h"
 
-extern int aoa_alsa_init(char *name, struct module *mod);
+extern int aoa_alsa_init(char *name, struct module *mod, struct device *dev);
 extern void aoa_alsa_cleanup(void);
 
 #endif /* __SND_AOA_ALSA_H */

Index: linux-2.6/sound/aoa/core/snd-aoa-core.c
===================================================================

sound/aoa/core/snd-aoa-core.c +1 -1
@@ -82,7 +82,7 @@ void aoa_codec_unregister(struct aoa_cod
 }
 EXPORT_SYMBOL_GPL(aoa_codec_unregister);
 
-int aoa_fabric_register(struct aoa_fabric *new_fabric)
+int aoa_fabric_register(struct aoa_fabric *new_fabric, struct device *dev)
 {
 	struct aoa_codec *c;
 	int err;

sound/aoa/core/snd-aoa-core.c int aoa_fabric_register(struct aoa_fabri · line 104

Quoted 8 lines
sound/aoa/core/snd-aoa-core.c +1 -1
@@ -98,7 +98,7 @@ int aoa_fabric_register(struct aoa_fabri
 	if (!new_fabric)
 		return -EINVAL;
 
-	err = aoa_alsa_init(new_fabric->name, new_fabric->owner);
+	err = aoa_alsa_init(new_fabric->name, new_fabric->owner, dev);
 	if (err)
 		return err;
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Olaf Hering
Quoted 1 line · Olaf Hering

create sysfs driver symlink for snd-aoa in /sys/bus/aoa-soundbus/devices/*/

Looks good to me.

Quoted 12 lines
---
 sound/aoa/fabrics/snd-aoa-fabric-layout.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/sound/aoa/fabrics/snd-aoa-fabric-layout.c
===================================================================

sound/aoa/fabrics/snd-aoa-fabric-layout.c static struct soundbus_driver aoa_soundb · line 1115

Quoted 9 lines
sound/aoa/fabrics/snd-aoa-fabric-layout.c +3 -0
@@ -1107,6 +1107,9 @@ static struct soundbus_driver aoa_soundb
 	.suspend = aoa_fabric_layout_suspend,
 	.resume = aoa_fabric_layout_resume,
 #endif
+	.driver = {
+		.owner = THIS_MODULE,
+	}
 };
 
 static int __init aoa_fabric_layout_init(void)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel