All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@keyaccess.nl>
To: Greg KH <gregkh@suse.de>
Cc: dtor_core@ameritech.net, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, tiwai@suse.de,
	Andrew Morton <akpm@osdl.org>
Subject: Re: patch bus_add_device-losing-an-error-return-from-the-probe-method.patch added to gregkh-2.6 tree
Date: Wed, 05 Apr 2006 02:23:22 +0200	[thread overview]
Message-ID: <44330DFA.4080106@keyaccess.nl> (raw)
In-Reply-To: <4432EF58.1060502@keyaccess.nl>

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

Rene Herman wrote:

> As said before, if the behaviour makes sense for other busses, maybe 
> propagating errors up should be dependent on a flags value somewhere 
> that a platform-driver sets?
> 
> If platform_device_register_simple() never returns an IS_ERR() when the 
> device is not found that means it's not a useful interface for hardware 
> that needs to be probed for at the very least. ALSA would need to do 
> something like, just before returning a succesfull return from the 
> probe() method, set a global flag that the platform_device that is about 
> to be registered is actually representing something, and freeing all 
> platform_devices for which the flag is _not_ set again after this.
> 
> Which ofcourse means this is not at all useful. It's just working around 
> the driver model then...

Well, we could in fact hang an unregister off device->private_data as 
per attached example. Wouldn't be _excessively_ ugly. Still sucks 
though. Having a flag somewhere in struct device_driver that a 
platform_driver would set and which would tell the driver model to 
honour the driver probe() method return seems the cleanest approach for 
all hardware where only the driver can now if the device is really 
present or not.

Ofcourse, I'm also still fine with just propagating the error up always 
(and if can be doing something about the ignore of -ENODEV / -ENOXIO)...

Rene.

[-- Attachment #2: adlib-unregister.diff --]
[-- Type: text/plain, Size: 1033 bytes --]

Index: local/sound/isa/adlib.c
===================================================================
--- local.orig/sound/isa/adlib.c	2006-04-05 02:00:55.000000000 +0200
+++ local/sound/isa/adlib.c	2006-04-05 02:05:45.000000000 +0200
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(str
 	struct snd_card *card;
 	struct snd_opl3 *opl3;
 
-	int error;
-	int i = device->id;
+	int error, i = device->id;
 
 	if (port[i] == SNDRV_AUTO_PORT) {
 		snd_printk(KERN_ERR DRV_NAME ": please specify port\n");
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(str
 	return 0;
 
 out1:	snd_card_free(card);
- out0:	error = -EINVAL; /* FIXME: should be the original error code */
-	return error;
+out0:	return error;
 }
 
 static int __devexit snd_adlib_remove(struct platform_device *device)
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(v
 		if (IS_ERR(device))
 			continue;
 
+		if (!platform_get_drvdata(device)) {
+			platform_device_unregister(device);
+			continue;
+		}
+
 		devices[i] = device;
 		cards++;
 	}

  reply	other threads:[~2006-04-05  0:22 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-24  5:32 bus_add_device() losing an error return from the probe() method Rene Herman
2006-03-26  1:53 ` Andrew Morton
2006-03-26 22:30   ` Rene Herman
2006-03-26 22:30   ` Rene Herman
2006-03-26  1:53 ` Andrew Morton
2006-04-04 19:10 ` patch bus_add_device-losing-an-error-return-from-the-probe-method.patch added to gregkh-2.6 tree gregkh
2006-04-04 20:23   ` Dmitry Torokhov
2006-04-04 20:23   ` Dmitry Torokhov
2006-04-04 21:00     ` Greg KH
2006-04-04 21:00     ` Greg KH
2006-04-04 21:15       ` Greg KH
2006-04-04 21:15         ` Greg KH
2006-04-04 21:22         ` Andrew Morton
2006-04-04 21:22         ` Andrew Morton
2006-04-04 21:28       ` Dmitry Torokhov
2006-04-04 21:45         ` Greg KH
2006-04-04 21:45         ` Greg KH
2006-04-05  1:35           ` Dmitry Torokhov
2006-04-05  1:35             ` Dmitry Torokhov
2006-04-05  7:36             ` Russell King
2006-04-06  1:05               ` Greg KH
2006-04-06  1:05               ` Greg KH
2006-04-05  7:36             ` Russell King
2006-04-05  1:59           ` Dmitry Torokhov
2006-04-05  1:59           ` Dmitry Torokhov
2006-04-04 21:28       ` Dmitry Torokhov
2006-04-04 22:12       ` Rene Herman
2006-04-05  0:23         ` Rene Herman [this message]
2006-04-05  1:45           ` Dmitry Torokhov
2006-04-05  1:45             ` Dmitry Torokhov
2006-04-05 18:36             ` Rene Herman
2006-04-05 18:36             ` Rene Herman
2006-04-05 18:44               ` Dmitry Torokhov
2006-04-05 18:44               ` Dmitry Torokhov
2006-04-05  0:23         ` Rene Herman
2006-04-05  1:48         ` Dmitry Torokhov
2006-04-05 13:50           ` Rene Herman
2006-04-05 13:50           ` Rene Herman
2006-04-05 14:59             ` Dmitry Torokhov
2006-04-05 14:59             ` Dmitry Torokhov
2006-04-05 21:22               ` Rene Herman
2006-04-05 21:22               ` Rene Herman
2006-04-05 13:55           ` Rene Herman
2006-04-05 13:55           ` Rene Herman
2006-04-05  1:48         ` Dmitry Torokhov
2006-04-04 22:12       ` Rene Herman
2006-04-04 19:10 ` gregkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44330DFA.4080106@keyaccess.nl \
    --to=rene.herman@keyaccess.nl \
    --cc=akpm@osdl.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=dtor_core@ameritech.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.