Initialize cinfo structure at compile time rather than run time since

they are now constant.
This commit is contained in:
Warner Losh 2001-05-19 06:17:37 +00:00
parent b012272796
commit 0eee936491
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=76841
2 changed files with 29 additions and 34 deletions

View File

@ -82,7 +82,22 @@ struct mecia_slot {
u_char last_reg1; /* Last value of change reg */
};
static struct slot_ctrl mecia_cinfo;
static struct slot_ctrl mecia_cinfo = {
mecia_mapirq,
mecia_memory,
mecia_io,
mecia_reset,
mecia_disable,
mecia_power,
mecia_ioctl,
mecia_resume,
1,
#if 0
1
#else
2 /* Fake for UE2212 LAN card */
#endif
};
static int validunits = 0;
@ -100,23 +115,6 @@ mecia_probe(device_t dev)
if (isa_get_logicalid(dev)) /* skip PnP probes */
return (ENXIO);
/*
* Initialise controller information structure.
*/
mecia_cinfo.ioctl = mecia_ioctl;
mecia_cinfo.mapmem = mecia_memory;
mecia_cinfo.mapio = mecia_io;
mecia_cinfo.power = mecia_power;
mecia_cinfo.mapirq = mecia_mapirq;
mecia_cinfo.reset = mecia_reset;
mecia_cinfo.disable = mecia_disable;
mecia_cinfo.resume = mecia_resume;
mecia_cinfo.maxmem = 1;
#if 0
mecia_cinfo.maxio = 1;
#else
mecia_cinfo.maxio = 2; /* fake for UE2212 LAN card */
#endif
if (inb(MECIA_REG0) != 0xff) {
validslots++;
/* XXX need to allocated the port resources */

View File

@ -66,7 +66,18 @@ static int pcic_io(struct slot *, int);
devclass_t pcic_devclass;
static struct slot_ctrl cinfo;
static struct slot_ctrl pcic_cinfo = {
pcic_mapirq,
pcic_memory,
pcic_io,
pcic_reset,
pcic_disable,
pcic_power,
pcic_ioctl,
pcic_resume,
PCIC_MEM_WIN,
PCIC_IO_WIN
};
/*
* Clear bit(s) of a register.
@ -240,20 +251,6 @@ pcic_attach(device_t dev)
struct pcic_slot *sp;
int stat;
/*
* Initialise controller information structure.
*/
cinfo.mapirq = pcic_mapirq;
cinfo.mapmem = pcic_memory;
cinfo.mapio = pcic_io;
cinfo.ioctl = pcic_ioctl;
cinfo.power = pcic_power;
cinfo.reset = pcic_reset;
cinfo.disable = pcic_disable;
cinfo.resume = pcic_resume;
cinfo.maxmem = PCIC_MEM_WIN;
cinfo.maxio = PCIC_IO_WIN;
sc = (struct pcic_softc *) device_get_softc(dev);
sp = &sc->slots[0];
for (i = 0; i < PCIC_CARD_SLOTS; i++, sp++) {
@ -266,7 +263,7 @@ pcic_attach(device_t dev)
return (ENXIO);
}
device_probe_and_attach(kid);
slt = pccard_init_slot(kid, &cinfo);
slt = pccard_init_slot(kid, &pcic_cinfo);
if (slt == 0) {
device_printf(dev, "Can't get pccard info slot %d", i);
return (ENXIO);