Subject: Improvements in loadable driver support
To: None <tech-kern@NetBSD.ORG>
From: Matthias Drochner <drochner@zelux6.zel.kfa-juelich.de>
List: tech-kern
Date: 01/22/1996 21:12:05
I just made a loadable driver for a (home-grown) PCI card.
In this process, 2 changes to the NetBSD autoconfiguration
code were necessary which I consider important for future
evolution of loadable driver support.

1. It should be possible to add and remove devices to the list
  of active devices ("alldevs" in sys/device.h) as needed.
  I'd like to see this list turned into a TAILQ (in terms of
  sys/queue.h).
2. The "struct cfdriver" should be extended by a function
  which frees the resources needed by the device.
  In my practice, a member
  int (*cd_detach) __P((struct device*));
  has proven useful. It takes the device softc struct as an argument
  and returns eg 1, if the device has been shut down, and 0,
  if the device is still needed by depentants (open pathes,
  subdevices).

Perhaps an individual with more experience in loadable drivers
(or whoever could be concerned by such changes) can contribute
to this topic.
Otherwise, I'll send-pr the according patches and hope that
they will be taken over eventually.

best regards
Matthas Drochner