>> The isa drivers provide many bad examples. Most of them attached the >> devsw in a disgusting SYSINIT even if the device is disabled. I moved >> the devsw attach to the device attach function in some drivers that >> I worked on. This was necessary to support pcvt and syscons sharing a >> devsw entry. > >Firstly, the SYSINIT code was a stopgap. It will evolve with time.. The
Like most stogaps, it was there too long (3.5 years). It is mostly gone now. >... >I therefore put it to the group that the right place to do devsw[] >manipulation is neither in xxx-probe, or xxxx_attach, but in xxx_init(), >which is only called once, and IS called at teh right time. >It should also be noted that teh devsw[] extraction code should be run >from the init() code when it is run with the 'shutdown' argument. (but >only when the driver arees to allow itself to be unlinked). You're forgetting that devsw[] is another stopgap. The kernel should probably use something like devfs, where dev_t's only exist for devices that actually exist. xxx_init() is far too early to decide which hardware devices exist. Bruce To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-current" in the body of the message