summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2003-10-16 09:18:35 +0000
committerdfr <dfr@FreeBSD.org>2003-10-16 09:18:35 +0000
commit72e3738dce4fcae6cd5c000ef84c0a11ad0594e2 (patch)
tree982aef1b3039cdedd6b75918e23e24b1aeaa2411 /sys/i386/isa
parent3dac505582c8dd13ac06b6571c0fab5ff2ab8a02 (diff)
downloadFreeBSD-src-72e3738dce4fcae6cd5c000ef84c0a11ad0594e2.zip
FreeBSD-src-72e3738dce4fcae6cd5c000ef84c0a11ad0594e2.tar.gz
Add a workaround for the fact that the priv field was removed from
struct driver. We were the last user of that field (and we are scheduled for demolition) so there wasn't much point in keeping it.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r--sys/i386/isa/isa_compat.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/i386/isa/isa_compat.c b/sys/i386/isa/isa_compat.c
index ab0389f..571eccb 100644
--- a/sys/i386/isa/isa_compat.c
+++ b/sys/i386/isa/isa_compat.c
@@ -48,6 +48,17 @@ __FBSDID("$FreeBSD$");
#include <isa/isavar.h>
#include <i386/isa/isa_device.h>
+/*
+ * The 'priv' field has been removed from 'struct driver' since the
+ * only remaining user of that field was this compatibility layer. We
+ * use this field to map from the newbus driver stub to the underlying
+ * old-style isa driver.
+ */
+struct isa_compat_driver {
+ KOBJ_CLASS_FIELDS;
+ void *priv;
+};
+
struct isa_compat_resources {
struct resource *ports;
struct resource *memory;
@@ -137,6 +148,7 @@ isa_compat_release_resources(device_t dev, struct isa_compat_resources *res)
static int
isa_compat_probe(device_t dev)
{
+ struct isa_compat_driver *drv;
struct isa_device *dvp = device_get_softc(dev);
struct isa_compat_resources res;
u_long start, count;
@@ -149,7 +161,8 @@ isa_compat_probe(device_t dev)
/*
* Fill in the isa_device fields.
*/
- dvp->id_driver = device_get_driver(dev)->priv;
+ drv = (struct isa_compat_driver *) device_get_driver(dev);
+ dvp->id_driver = drv->priv;
if (bus_get_resource(dev, SYS_RES_IOPORT, 0,
&start, &count) == 0)
dvp->id_iobase = start;
@@ -267,12 +280,13 @@ int
compat_isa_handler(module_t mod, int type, void *data)
{
struct isa_driver *id = (struct isa_driver *)data;
- driver_t *driver;
+ struct isa_compat_driver *driver;
devclass_t isa_devclass = devclass_find("isa");
switch (type) {
case MOD_LOAD:
- driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT | M_ZERO);
+ driver = malloc(sizeof(struct isa_compat_driver),
+ M_DEVBUF, M_NOWAIT | M_ZERO);
if (!driver)
return ENOMEM;
driver->name = id->name;
@@ -287,7 +301,7 @@ compat_isa_handler(module_t mod, int type, void *data)
driver->name);
#endif
}
- devclass_add_driver(isa_devclass, driver);
+ devclass_add_driver(isa_devclass, (kobj_class_t) driver);
break;
case MOD_UNLOAD:
printf("%s: module unload not supported!\n", id->name);
OpenPOWER on IntegriCloud