Update of /cvsroot/alsa/alsa-kernel/pci/ac97
In directory sc8-pr-cvs1:/tmp/cvs-serv6295/pci/ac97
Modified Files:
ac97_codec.c ak4531_codec.c
Log Message:
[PATCH: proc-card-dev.dif]
- added snd_card_proc_new() to create a normal text proc file for
the card basis. it's handled as an ALSA device, so no explicit
destruction is necessary.
- snd_info_set_text_ops() to set the callback function for convenience.
- applied the new function to each source and clean-up.
Index: ac97_codec.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ac97/ac97_codec.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- ac97_codec.c 7 Jan 2003 10:17:29 -0000 1.52
+++ ac97_codec.c 7 Jan 2003 10:36:30 -0000 1.53
@@ -51,7 +51,6 @@
*/
static void snd_ac97_proc_init(snd_card_t * card, ac97_t * ac97);
-static void snd_ac97_proc_done(ac97_t * ac97);
typedef struct {
unsigned int id;
@@ -1107,7 +1106,6 @@
static int snd_ac97_free(ac97_t *ac97)
{
if (ac97) {
- snd_ac97_proc_done(ac97);
if (ac97->private_free)
ac97->private_free(ac97);
snd_magic_kfree(ac97);
@@ -2098,46 +2096,14 @@
sprintf(name, "ac97#%d-%d", ac97->addr, ac97->num);
else
sprintf(name, "ac97#%d", ac97->addr);
- if ((entry = snd_info_create_card_entry(card, name, card->proc_root)) != NULL)
{
- entry->content = SNDRV_INFO_CONTENT_TEXT;
- entry->private_data = ac97;
- entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
- entry->c.text.read_size = 512;
- entry->c.text.read = snd_ac97_proc_read;
- if (snd_info_register(entry) < 0) {
- snd_info_free_entry(entry);
- entry = NULL;
- }
- }
- ac97->proc_entry = entry;
+ if (! snd_card_proc_new(card, name, &entry))
+ snd_info_set_text_ops(entry, ac97, snd_ac97_proc_read);
if (ac97->num)
sprintf(name, "ac97#%d-%dregs", ac97->addr, ac97->num);
else
sprintf(name, "ac97#%dregs", ac97->addr);
- if ((entry = snd_info_create_card_entry(card, name, card->proc_root)) != NULL)
{
- entry->content = SNDRV_INFO_CONTENT_TEXT;
- entry->private_data = ac97;
- entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
- entry->c.text.read_size = 1024;
- entry->c.text.read = snd_ac97_proc_regs_read;
- if (snd_info_register(entry) < 0) {
- snd_info_free_entry(entry);
- entry = NULL;
- }
- }
- ac97->proc_regs_entry = entry;
-}
-
-static void snd_ac97_proc_done(ac97_t * ac97)
-{
- if (ac97->proc_regs_entry) {
- snd_info_unregister(ac97->proc_regs_entry);
- ac97->proc_regs_entry = NULL;
- }
- if (ac97->proc_entry) {
- snd_info_unregister(ac97->proc_entry);
- ac97->proc_entry = NULL;
- }
+ if (! snd_card_proc_new(card, name, &entry))
+ snd_info_set_text_ops(entry, ac97, snd_ac97_proc_regs_read);
}
/*
Index: ak4531_codec.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ac97/ak4531_codec.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ak4531_codec.c 15 Aug 2002 12:13:08 -0000 1.6
+++ ak4531_codec.c 7 Jan 2003 10:36:30 -0000 1.7
@@ -33,7 +33,6 @@
#define chip_t ak4531_t
static void snd_ak4531_proc_init(snd_card_t * card, ak4531_t * ak4531);
-static void snd_ak4531_proc_done(ak4531_t * ak4531);
/*
*
@@ -314,7 +313,6 @@
static int snd_ak4531_free(ak4531_t *ak4531)
{
if (ak4531) {
- snd_ak4531_proc_done(ak4531);
if (ak4531->private_free)
ak4531->private_free(ak4531);
snd_magic_kfree(ak4531);
@@ -425,26 +423,8 @@
{
snd_info_entry_t *entry;
- if ((entry = snd_info_create_card_entry(card, "ak4531", card->proc_root)) !=
NULL) {
- entry->content = SNDRV_INFO_CONTENT_TEXT;
- entry->private_data = ak4531;
- entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
- entry->c.text.read_size = 256;
- entry->c.text.read = snd_ak4531_proc_read;
- if (snd_info_register(entry) < 0) {
- snd_info_free_entry(entry);
- entry = NULL;
- }
- }
- ak4531->proc_entry = entry;
-}
-
-static void snd_ak4531_proc_done(ak4531_t * ak4531)
-{
- if (ak4531->proc_entry) {
- snd_info_unregister(ak4531->proc_entry);
- ak4531->proc_entry = NULL;
- }
+ if (! snd_card_proc_new(card, "ak4531", &entry))
+ snd_info_set_text_ops(entry, ak4531, snd_ak4531_proc_read);
}
EXPORT_SYMBOL(snd_ak4531_mixer);
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog