NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-mac68k/60718: mac68k: ascaudio(4) module block does not compile, and could not attach if it did
>Number: 60718
>Category: port-mac68k
>Synopsis: mac68k: ascaudio(4) module block does not compile, and could not attach if it did
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-mac68k-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Sep 11 23:20:00 +0000 2026
>Originator: Ray Tran
>Release: 11.0
>Organization:
Diamond Creek Digital
>Environment:
Hardware: Apple Macintosh Centris 650
Kernel: NetBSD 11.0 and CURRENT
>Description:
The _MODULE section at the end of sys/arch/mac68k/obio/ascaudio.c has
three problems, in increasing order of size.
1. It does not compile. It declares
static const struct cfiattrdata * const ascaudio_attrs[] = ...
extern struct cfattach ascaudio_ca;
and then uses ascaud_attrs in CFDRIVER_DECL() and ascaud_ca in the
four config_cfattach_attach/detach calls in ascaudio_modcmd().
Compiling the file with -D_MODULE gives
ascaudio.c:1024:34: error: 'ascaud_attrs' undeclared here
(not in a function); did you mean 'ascaudio_attrs'?
ascaudio.c:1054:70: error: 'ascaud_ca' undeclared (first use in
this function); did you mean 'ascaudio_ca'?
2. Once it compiled, loading it would panic. ascaudio_modcmd() brings
the device up with config_attach_pseudo(), which passes a NULL aux
to the attach function. ascaudioattach() casts aux to struct
obio_attach_args and reads oa_addr and oa_tag from it on its first
lines. ascaudiomatch() is not consulted at all on that path, so
nothing checks the machine either.
3. The way a modular obio driver should come up, by attaching at obio
after autoconfiguration, was not available when this was written:
obio had no rescan callback, and a driver loaded with modload(8) was
never probed. port-mac68k/60694 adds the rescan. With it in, the
block's job is a config_init_component() against the driver's
ioconf and a rescan of obio0, and the pseudo-device attach and the
hand-rolled cfdata can go.
There is no sys/modules/ascaudio, so there's no way to builds this block
currently and the kernel is unaffected. It is still wrong code in the tree, and
the first person to add a module Makefile hits all three in turn.
>How-To-Repeat:
>From a built tree, compile ascaudio.c with -D_MODULE added to the
kernel's flags. For the second problem, read ascaudio_modcmd() against
ascaudioattach().
>Fix:
This patch corrects the two identifiers so that the
block at least compiles as written. That is the smallest honest
change, and it does not make the module usable. What would, is either
removing the block until someone needs it, or rewriting it on top of
port-mac68k/60694 to attach through obio the way the rest of the port's
modular drivers do. Which of those is the author's call, and this
report is filed so the choice is made knowingly rather than by the
next person to try the block.
The rename is verified with -fsyntax-only -D_MODULE against the NetBSD
11.0 sources with the m68k cross compiler, and the kernel build with
the change is unaffected. It is independent of port-mac68k/60701 and
60702, which change other parts of the file. The same patch applies
to -current.
Applies with "patch -p1" from the top of usr/src; verified with -F0
(no fuzz) against NetBSD-current 11.99.8 (20260830003849Z) and 11.0.
--- a/sys/arch/mac68k/obio/ascaudio.c
+++ b/sys/arch/mac68k/obio/ascaudio.c
@@ -1052,7 +1052,7 @@
&audiobuscf_iattrdata, NULL
};
-CFDRIVER_DECL(ascaudio, DV_DULL, ascaud_attrs);
+CFDRIVER_DECL(ascaudio, DV_DULL, ascaudio_attrs);
extern struct cfattach ascaudio_ca;
static int ascaudioloc[] = { -1, -1 };
@@ -1082,7 +1082,7 @@
return error;
}
- error = config_cfattach_attach(ascaudio_cd.cd_name, &ascaud_ca);
+ error = config_cfattach_attach(ascaudio_cd.cd_name, &ascaudio_ca);
if (error) {
config_cfdriver_detach(&ascaudio_cd);
aprint_error("%s: unable to register cfattach\n",
@@ -1093,7 +1093,7 @@
error = config_cfdata_attach(ascaudio_cfdata, 1);
if (error) {
- config_cfattach_detach(ascaudio_cd.cd_name, &ascaud_ca);
+ config_cfattach_detach(ascaudio_cd.cd_name, &ascaudio_ca);
config_cfdriver_detach(&ascaudio_cd);
aprint_error("%s: unable to register cfdata\n",
ascaudio_cd.cd_name);
@@ -1108,7 +1108,7 @@
if (error) {
return error;
}
- config_cfattach_detach(ascaudio_cd.cd_name, &ascaud_ca);
+ config_cfattach_detach(ascaudio_cd.cd_name, &ascaudio_ca);
config_cfdriver_detach(&ascaudio_cd);
aprint_error("%s: unable to register devsw\n",
ascaudio_cd.cd_name);
@@ -1125,7 +1125,7 @@
return error;
}
- config_cfattach_detach(ascaudio_cd.cd_name, &ascaud_ca);
+ config_cfattach_detach(ascaudio_cd.cd_name, &ascaudio_ca);
config_cfdriver_detach(&ascaudio_cd);
devsw_detach(NULL, &ascaudio_cdevsw);
Home |
Main Index |
Thread Index |
Old Index