diff mbox

Staging: tm6000: fix problem in alsa init

Message ID 20100617120653.GI5483@bicker (mailing list archive)
State Superseded
Headers show

Commit Message

Dan Carpenter June 17, 2010, 12:06 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index ce081cd..94c9f15 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -337,7 +337,7 @@  static int __devinit snd_tm6000_pcm(struct snd_tm6000_card *chip,
  * Alsa Constructor - Component probe
  */
 
-int tm6000_audio_init(struct tm6000_core *dev, int idx)
+static int tm6000_audio_init(struct tm6000_core *dev, int idx)
 {
 	struct snd_card         *card;
 	struct snd_tm6000_card  *chip;
@@ -411,12 +411,12 @@  error:
 	return rc;
 }
 
-static int tm6000_audio_fini(struct tm6000_core *dev)
+static int tm6000_audio_fini(struct tm6000_core *dev, int idx)
 {
 	return 0;
 }
 
-struct tm6000_ops audio_ops = {
+static struct tm6000_ops audio_ops = {
 	.id	= TM6000_AUDIO,
 	.name	= "TM6000 Audio Extension",
 	.init	= tm6000_audio_init,
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c
index 27f3f55..c71452c 100644
--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -661,13 +661,14 @@  static DEFINE_MUTEX(tm6000_extension_devlist_lock);
 int tm6000_register_extension(struct tm6000_ops *ops)
 {
 	struct tm6000_core *dev = NULL;
+	int idx = 0;
 
 	mutex_lock(&tm6000_devlist_mutex);
 	mutex_lock(&tm6000_extension_devlist_lock);
 	list_add_tail(&ops->next, &tm6000_extension_devlist);
 	list_for_each_entry(dev, &tm6000_devlist, devlist) {
-		if (dev)
-			ops->init(dev);
+		ops->init(dev, idx);
+		idx++;
 	}
 	printk(KERN_INFO "tm6000: Initialized (%s) extension\n", ops->name);
 	mutex_unlock(&tm6000_extension_devlist_lock);
@@ -679,11 +680,12 @@  EXPORT_SYMBOL(tm6000_register_extension);
 void tm6000_unregister_extension(struct tm6000_ops *ops)
 {
 	struct tm6000_core *dev = NULL;
+	int idx = 0;
 
 	mutex_lock(&tm6000_devlist_mutex);
 	list_for_each_entry(dev, &tm6000_devlist, devlist) {
-		if (dev)
-			ops->fini(dev);
+		ops->fini(dev, idx);
+		idx++;
 	}
 
 	mutex_lock(&tm6000_extension_devlist_lock);
@@ -697,12 +699,13 @@  EXPORT_SYMBOL(tm6000_unregister_extension);
 void tm6000_init_extension(struct tm6000_core *dev)
 {
 	struct tm6000_ops *ops = NULL;
+	int idx = 0;
 
 	mutex_lock(&tm6000_extension_devlist_lock);
 	if (!list_empty(&tm6000_extension_devlist)) {
 		list_for_each_entry(ops, &tm6000_extension_devlist, next) {
-			if (ops->init)
-				ops->init(dev);
+			ops->init(dev, idx);
+			idx++;
 		}
 	}
 	mutex_unlock(&tm6000_extension_devlist_lock);
@@ -711,12 +714,13 @@  void tm6000_init_extension(struct tm6000_core *dev)
 void tm6000_close_extension(struct tm6000_core *dev)
 {
 	struct tm6000_ops *ops = NULL;
+	int idx = 0;
 
 	mutex_lock(&tm6000_extension_devlist_lock);
 	if (!list_empty(&tm6000_extension_devlist)) {
 		list_for_each_entry(ops, &tm6000_extension_devlist, next) {
-			if (ops->fini)
-				ops->fini(dev);
+			ops->fini(dev, idx);
+			idx++;
 		}
 	}
 	mutex_unlock(&tm6000_extension_devlist_lock);
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index 7bbaf26..971a39a 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -213,8 +213,8 @@  struct tm6000_ops {
 	struct list_head	next;
 	char			*name;
 	int			id;
-	int (*init)(struct tm6000_core *);
-	int (*fini)(struct tm6000_core *);
+	int (*init)(struct tm6000_core *, int idx);
+	int (*fini)(struct tm6000_core *, int idx);
 };
 
 struct tm6000_fh {