public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [ALSA STABLE 3/3] a few more -- unregister platform device again if probe was unsuccessful
@ 2006-04-13  1:46 Rene Herman
  2006-04-13  9:26 ` Ingo Oeser
  0 siblings, 1 reply; 11+ messages in thread
From: Rene Herman @ 2006-04-13  1:46 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA devel, Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

Hi Takashi.

And finally, unregister on probe failure for sound/drivers,
sound/arm/sa11xx-uda1341.c and sound/ppc/powermac.c.

   sound/arm/sa11xx-uda1341.c    |   14 +++++++++-----
   sound/drivers/dummy.c         |    4 ++++
   sound/drivers/mpu401/mpu401.c |    4 ++++
   sound/drivers/mtpav.c         |   14 +++++++++-----
   sound/drivers/serial-u16550.c |    4 ++++
   sound/drivers/virmidi.c       |    4 ++++
   sound/ppc/powermac.c          |   14 +++++++++-----
   7 files changed, 43 insertions(+), 15 deletions(-)

Signed-off-by: Rene Herman <rene.herman@keyaccess.nl>


[-- Attachment #2: alsa_platform_unregister_remainder.diff --]
[-- Type: text/plain, Size: 4582 bytes --]

Index: local/sound/arm/sa11xx-uda1341.c
===================================================================
--- local.orig/sound/arm/sa11xx-uda1341.c	2006-03-20 06:53:29.000000000 +0100
+++ local/sound/arm/sa11xx-uda1341.c	2006-04-13 03:14:49.000000000 +0200
@@ -984,11 +984,15 @@ static int __init sa11xx_uda1341_init(vo
 	if ((err = platform_driver_register(&sa11xx_uda1341_driver)) < 0)
 		return err;
 	device = platform_device_register_simple(SA11XX_UDA1341_DRIVER, -1, NULL, 0);
-	if (IS_ERR(device)) {
-		platform_driver_unregister(&sa11xx_uda1341_driver);
-		return PTR_ERR(device);
-	}
-	return 0;
+	if (!IS_ERR(device)) {
+		if (platform_get_drvdata(device))
+			return 0;
+		platform_device_unregister(device);
+		err = -ENODEV
+	} else
+		err = PTR_ERR(device);
+	platform_driver_unregister(&sa11xx_uda1341_driver);
+	return err;
 }
 
 static void __exit sa11xx_uda1341_exit(void)
Index: local/sound/drivers/dummy.c
===================================================================
--- local.orig/sound/drivers/dummy.c	2006-04-13 03:11:35.000000000 +0200
+++ local/sound/drivers/dummy.c	2006-04-13 03:14:49.000000000 +0200
@@ -677,6 +677,10 @@ static int __init alsa_card_dummy_init(v
 							 i, NULL, 0);
 		if (IS_ERR(device))
 			continue;
+		if (!platform_get_drvdata(device)) {
+			platform_device_unregister(device);
+			continue;
+		}
 		devices[i] = device;
 		cards++;
 	}
Index: local/sound/drivers/mpu401/mpu401.c
===================================================================
--- local.orig/sound/drivers/mpu401/mpu401.c	2006-04-13 03:11:35.000000000 +0200
+++ local/sound/drivers/mpu401/mpu401.c	2006-04-13 03:14:49.000000000 +0200
@@ -252,6 +252,10 @@ static int __init alsa_card_mpu401_init(
 							 i, NULL, 0);
 		if (IS_ERR(device))
 			continue;
+		if (!platform_get_drvdata(device)) {
+			platform_device_unregister(device);
+			continue;
+		}
 		platform_devices[i] = device;
 		devices++;
 	}
Index: local/sound/drivers/mtpav.c
===================================================================
--- local.orig/sound/drivers/mtpav.c	2006-03-20 06:53:29.000000000 +0100
+++ local/sound/drivers/mtpav.c	2006-04-13 03:14:49.000000000 +0200
@@ -770,11 +770,15 @@ static int __init alsa_card_mtpav_init(v
 		return err;
 
 	device = platform_device_register_simple(SND_MTPAV_DRIVER, -1, NULL, 0);
-	if (IS_ERR(device)) {
-		platform_driver_unregister(&snd_mtpav_driver);
-		return PTR_ERR(device);
-	}
-	return 0;
+	if (!IS_ERR(device)) {
+		if (platform_get_drvdata(device))
+			return 0;
+		platform_device_unregister(device);
+		err = -ENODEV;
+	} else
+		err = PTR_ERR(device);
+	platform_driver_unregister(&snd_mtpav_driver);
+	return err;
 }
 
 static void __exit alsa_card_mtpav_exit(void)
Index: local/sound/drivers/serial-u16550.c
===================================================================
--- local.orig/sound/drivers/serial-u16550.c	2006-04-13 03:11:35.000000000 +0200
+++ local/sound/drivers/serial-u16550.c	2006-04-13 03:14:49.000000000 +0200
@@ -997,6 +997,10 @@ static int __init alsa_card_serial_init(
 							 i, NULL, 0);
 		if (IS_ERR(device))
 			continue;
+		if (!platform_get_drvdata(device)) {
+			platform_device_unregister(device);
+			continue;
+		}
 		devices[i] = device;
 		cards++;
 	}
Index: local/sound/drivers/virmidi.c
===================================================================
--- local.orig/sound/drivers/virmidi.c	2006-04-13 03:11:35.000000000 +0200
+++ local/sound/drivers/virmidi.c	2006-04-13 03:14:49.000000000 +0200
@@ -171,6 +171,10 @@ static int __init alsa_card_virmidi_init
 							 i, NULL, 0);
 		if (IS_ERR(device))
 			continue;
+		if (!platform_get_drvdata(device)) {
+			platform_device_unregister(device);
+			continue;
+		}
 		devices[i] = device;
 		cards++;
 	}
Index: local/sound/ppc/powermac.c
===================================================================
--- local.orig/sound/ppc/powermac.c	2006-03-20 06:53:29.000000000 +0100
+++ local/sound/ppc/powermac.c	2006-04-13 03:14:49.000000000 +0200
@@ -188,11 +188,15 @@ static int __init alsa_card_pmac_init(vo
 	if ((err = platform_driver_register(&snd_pmac_driver)) < 0)
 		return err;
 	device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0);
-	if (IS_ERR(device)) {
-		platform_driver_unregister(&snd_pmac_driver);
-		return PTR_ERR(device);
-	}
-	return 0;
+	if (!IS_ERR(device)) {
+		if (platform_get_drvdata(device))
+			return 0;
+		platform_device_unregister(device);
+		err = -ENODEV;
+	} else
+		err = PTR_ERR(device);
+	platform_driver_unregister(&snd_pmac_driver);
+	return err;
 
 }
 


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

end of thread, other threads:[~2006-04-15 13:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-13  1:46 [ALSA STABLE 3/3] a few more -- unregister platform device again if probe was unsuccessful Rene Herman
2006-04-13  9:26 ` Ingo Oeser
2006-04-13  9:31   ` Russell King
2006-04-13 14:05   ` Rene Herman
2006-04-13 14:57     ` Russell King
2006-04-13 16:17       ` Rene Herman
2006-04-13 17:05         ` Russell King
2006-04-13 18:47           ` Rene Herman
2006-04-13 22:02           ` Greg KH
2006-04-13 23:12             ` Rene Herman
2006-04-15 13:16               ` Takashi Iwai

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