From owner-freebsd-hackers Thu Dec 6 1:46: 3 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id 8854B37B405 for ; Thu, 6 Dec 2001 01:46:00 -0800 (PST) Received: from sdn-ar-010casfrmp226.dialsprint.net ([158.252.241.228] helo=hh2146241) by albatross.prod.itd.earthlink.net with smtp (Exim 3.33 #1) id 16Bv6N-00023b-00; Thu, 06 Dec 2001 01:45:59 -0800 From: "Stephen Hulten" To: Cc: Subject: DRIVER_MODULE macro devclass_t argument used? Date: Thu, 6 Dec 2001 01:51:21 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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