Add a device_private() to return the driver's private data (softc).
For now, this just returns the passed device_t (as a void *) because device softcs currently contain a "struct device" as the first member.
This commit is contained in:
parent
78ffd948be
commit
35947a37ad
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr_autoconf.c,v 1.109 2006/03/29 06:00:47 thorpej Exp $ */
|
||||
/* $NetBSD: subr_autoconf.c,v 1.110 2006/03/29 06:08:16 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2000 Christopher G. Demetriou
|
||||
|
@ -77,7 +77,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.109 2006/03/29 06:00:47 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.110 2006/03/29 06:08:16 thorpej Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
|
@ -1621,6 +1621,17 @@ device_locator(device_t dev, int locnum)
|
|||
return (dev->dv_locators[locnum]);
|
||||
}
|
||||
|
||||
void *
|
||||
device_private(device_t dev)
|
||||
{
|
||||
|
||||
/*
|
||||
* For now, at least, "struct device" is the first thing in
|
||||
* the driver's private data. So, we just return ourselves.
|
||||
*/
|
||||
return (dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* device_is_a:
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: device.h,v 1.88 2006/03/29 06:00:47 thorpej Exp $ */
|
||||
/* $NetBSD: device.h,v 1.89 2006/03/29 06:08:16 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2000 Christopher G. Demetriou
|
||||
|
@ -370,6 +370,7 @@ const char *device_xname(device_t);
|
|||
device_t device_parent(device_t);
|
||||
boolean_t device_is_active(device_t);
|
||||
int device_locator(device_t, u_int);
|
||||
void *device_private(device_t);
|
||||
|
||||
boolean_t device_is_a(device_t, const char *);
|
||||
|
||||
|
|
Loading…
Reference in New Issue