summaryrefslogtreecommitdiffstats
path: root/sys/dev/speaker
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2002-10-28 02:00:09 +0000
committermdodd <mdodd@FreeBSD.org>2002-10-28 02:00:09 +0000
commit9c8acae4f7ca027b2b3315410db2952d7662dafd (patch)
tree9cef31e1794e2ba07a05237e71d6ee724c9e5bcd /sys/dev/speaker
parenta7c01a175148fb913c153c7be981d7ce319fe855 (diff)
downloadFreeBSD-src-9c8acae4f7ca027b2b3315410db2952d7662dafd.zip
FreeBSD-src-9c8acae4f7ca027b2b3315410db2952d7662dafd.tar.gz
Handle hints for the atspeaker device.
Document same.
Diffstat (limited to 'sys/dev/speaker')
-rw-r--r--sys/dev/speaker/spkr.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 522e6c6..e560fe6 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -602,12 +602,36 @@ static dev_t atspeaker_dev;
static int
atspeaker_probe(device_t dev)
{
- return(ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids));
+ int error;
+
+ error = ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids);
+
+ /* PnP match */
+ if (error == 0)
+ return (0);
+
+ /* No match */
+ if (error == ENXIO)
+ return (ENXIO);
+
+ /* Not configured by hints. */
+ if (strncmp(device_get_name(dev), "atspeaker", 9))
+ return (ENXIO);
+
+ device_set_desc(dev, "AT speaker");
+
+ return (0);
}
static int
atspeaker_attach(device_t dev)
{
+
+ if (atspeaker_dev) {
+ device_printf(dev, "Already attached!\n");
+ return (ENXIO);
+ }
+
atspeaker_dev = make_dev(&spkr_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
"speaker");
return (0);
OpenPOWER on IntegriCloud