Re: [ALSA STABLE 3/3] a few more -- unregister platform device againif probe was unsuccessful

From: Rene Herman
Date: Thu Apr 13 2006 - 19:14:22 EST


Greg KH wrote:

I still really don't understand why these ALSA drivers are so unlike
any of the zillion other drivers we have in the kernel that work just
fine today.

It's nothing to do with ALSA, only with ISA -- ALSA is just one of the few remaining serious ISA users. Have said this a number of times now, so apologies to anyone who _is_ following this. I promise it's going to be the last time. The issue:

Historically, ALSA ISA drivers failed to load upon not finding their hardware at load time, same as most ISA drivers. When 2.6.16 switched them to use of the platform driver interface this behaviour was inadvertently changed due to the platform driver interface not passing up the probe() return. Things such as the "alsaconf" configuration script actualy rely on the non-load behaviour and current submissions to -stable simply use drvdata() being !NULL as a private success flag to restore that behaviour. This is okay.

Longer term (than -stable) it could ofcourse be better to follow the model from saner busses such as PCI more closely -- we could just load whether or not a device was bound to. The difference though is that a PCI device has a life all by itself by virtue of its _bus_ knowing that it's present (it has an entry in /sys/devices/pci*, without any device specific driver loaded) while these old ISA devices only exist in the driver model by virtue of a driver creating them as a platform device because it might want to drive them. If we keep them registered even after failing a probe, then /sys/devices/platform turns into an enumeration of the drivers we loaded, not a view of what's present in the system.

(and there is no point in keeping the driver loaded when we don't keep the devices registered as well -- you couldn't do anything with that driver, it would just be sitting there taking up memory)

Problem therefore: /sys/devices pollution. Note that ALSA supports some 20 (non-pnp-only) ISA drivers and imagine loading them all, with all of them creating one or more devices in /sys/devices/platform, with none of the actual hardware present. I consider this not nice, not from the view of ALSA, but because I've been told that one of the reasons for /sys was this nice view of "what's in this system" that /sys/devices would provide.

The answer needed -- if you _do_ think it's okay to just have those devices present in /sys/devices/platform without the hardware existing, then I do not have a problem. I'll just suggest to keep them registered and be done with it (*).

If on the other hand you agree it's not nice, I'll try and look into what a seperate isa_bus could provide.

Rene.

(*) Note by the way I do not necesarily qualify as an ALSA person. I only ran into this when I submitted a new ALSA ISA driver for 2.6.16+. Takashi Iwai is being CCed on all these messages though, and he hasn't yet protested anything I've been saying, so I assume he's okay with my worries at least...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/