Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2001 01:51:21 -0800
From:      "Stephen Hulten" <sgerardh@earthlink.net>
To:        <freebsd-hackers@freebsd.org>
Cc:        <sgh@silvannetworks.com>
Subject:   DRIVER_MODULE macro devclass_t argument used?
Message-ID:  <NCBBLOLLILBEBEEFIGDAKEANDAAA.sgerardh@earthlink.net>

next in thread | raw e-mail | index | archive | help
I've been ramping up to write a device driver using the newbus
architecture and so have been reading example drivers and looking at the
kernel sources. All the example drivers define a static method table, a
static driver_t structure and a static devclass_t structure. These are
then all linked together via the DRIVER_MODULE macro which then adds an
entry to the "linker set" via the SYSINIT macro.

My question is whether the static devclass_t structure is really ever
used. At system startup it looks like the routine
driver_module_handler(module_t mod, int what, void * arg)
(kern/subr_bus.c) is called with what==MOD_LOAD and arg set to a ptr to
the static driver_module_data structure defined internally via
DRIVER_MODULE The driver_module_data structure contains the reference
to the static devclasss_t structure that was declared in the driver.
But the devclass_t ptr is overwritten by the statement

*dmd->dmd_devclass = devclass_find_internal(dmd->dmd_drivers[0]->name,TRUE)

This makes me believe the devclass_t structure defined in a driver is
never used. Is there another code path I'm missing?

Thanks
-Steve

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NCBBLOLLILBEBEEFIGDAKEANDAAA.sgerardh>