Get the pointer to the driver name early, rather than constantly

deferencing the cfdriver pointer.
This commit is contained in:
thorpej 2002-09-26 20:18:24 +00:00
parent 88b0700853
commit 3280b330bb
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.16 2001/06/13 14:36:34 soda Exp $ */
/* $NetBSD: autoconf.c,v 1.17 2002/09/26 20:18:24 thorpej Exp $ */
/* $OpenBSD: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $ */
/*
@ -216,7 +216,7 @@ device_register(dev, aux)
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
struct cfdriver *cd = cf->cf_driver;
const char *name = cf->cf_driver->cd_name;
static int found = 0, initted = 0, scsiboot = 0;
static struct device *scsibusdev = NULL;
@ -232,7 +232,7 @@ device_register(dev, aux)
initted = 1;
}
if (scsiboot && strcmp(cd->cd_name, "scsibus") == 0) {
if (scsiboot && strcmp(name, "scsibus") == 0) {
if (dev->dv_unit == b->bus) {
scsibusdev = dev;
#if 0
@ -242,10 +242,10 @@ device_register(dev, aux)
return;
}
if (strcmp(b->dev_type, cd->cd_name) != 0)
if (strcmp(b->dev_type, name) != 0)
return;
if (strcmp(cd->cd_name, "sd") == 0) {
if (strcmp(name, "sd") == 0) {
struct scsipibus_attach_args *sa = aux;
if (scsiboot && scsibusdev && parent == scsibusdev &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.2 2002/09/11 08:30:48 simonb Exp $ */
/* $NetBSD: autoconf.c,v 1.3 2002/09/26 20:21:14 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -81,7 +81,7 @@ void
device_register(struct device *dev, void *aux)
{
struct cfdata *cf = dev->dv_cfdata;
struct cfdriver *cd = cf->cf_driver;
const char *name = cf->cf_driver->cd_name;
struct aubus_attach_args *aa = aux;
/*
@ -90,7 +90,7 @@ device_register(struct device *dev, void *aux)
*/
/* Fetch the MAC addresses from YAMON. */
if (strcmp(cd->cd_name, "aumac") == 0) {
if (strcmp(name, "aumac") == 0) {
uint8_t ethaddr[ETHER_ADDR_LEN];
char prop_name[sizeof("0xffffffff:mac-addr") + 1];
const char *cp;