Cosmetics

This commit is contained in:
Søren Schmidt 2005-04-25 07:57:04 +00:00
parent 6257850052
commit ecd6c15d6a
4 changed files with 26 additions and 38 deletions

View File

@ -69,22 +69,21 @@ ata_pccard_match(device_t dev)
u_int32_t fcn = PCCARD_FUNCTION_UNSPEC;
int error = 0;
error = pccard_get_function(dev, &fcn);
if (error != 0)
return (error);
if ((error = pccard_get_function(dev, &fcn)))
return error;
/* if it says its a disk we should register it */
if (fcn == PCCARD_FUNCTION_DISK)
return (0);
return 0;
/* match other devices here, primarily cdrom/dvd rom */
if ((pp = pccard_product_lookup(dev, ata_pccard_products,
sizeof(ata_pccard_products[0]), NULL))) {
if (pp->pp_name)
device_set_desc(dev, pp->pp_name);
return (0);
return 0;
}
return(ENXIO);
return ENXIO;
}
static int
@ -96,9 +95,8 @@ ata_pccard_probe(device_t dev)
/* allocate the io range to get start and length */
rid = ATA_IOADDR_RID;
io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_IOSIZE, RF_ACTIVE);
if (!io)
if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_IOSIZE, RF_ACTIVE)))
return ENXIO;
/* setup the resource vectors */
@ -118,9 +116,8 @@ ata_pccard_probe(device_t dev)
}
else {
rid = ATA_CTLADDR_RID;
ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_CTLIOSIZE, RF_ACTIVE);
if (!ctlio) {
if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_CTLIOSIZE, RF_ACTIVE))) {
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
for (i = ATA_DATA; i < ATA_MAX_RES; i++)
ch->r_io[i].res = NULL;

View File

@ -82,9 +82,8 @@ ata_cbus_probe(device_t dev)
/* allocate the ioport range */
rid = ATA_IOADDR_RID;
io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_PC98_IOSIZE, RF_ACTIVE);
if (!io)
if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_PC98_IOSIZE, RF_ACTIVE)))
return ENOMEM;
/* calculate & set the altport range */
@ -113,26 +112,23 @@ ata_cbus_attach(device_t dev)
/* allocate resources */
rid = ATA_IOADDR_RID;
ctlr->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_PC98_IOSIZE, RF_ACTIVE);
if (!ctlr->io)
if (!(ctlr->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_PC98_IOSIZE, RF_ACTIVE)))
return ENOMEM;
rid = ATA_PC98_CTLADDR_RID;
ctlr->ctlio =
bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
rman_get_start(ctlr->io) + ATA_PC98_CTLOFFSET, ~0,
ATA_CTLIOSIZE, RF_ACTIVE);
if (!ctlr->ctlio) {
if (!(ctlr->ctlio =
bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
rman_get_start(ctlr->io) + ATA_PC98_CTLOFFSET, ~0,
ATA_CTLIOSIZE, RF_ACTIVE))) {
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
return ENOMEM;
}
rid = ATA_PC98_BANKADDR_RID;
ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
ATA_PC98_BANK, ~0,
ATA_PC98_BANKIOSIZE, RF_ACTIVE);
if (!ctlr->bankio) {
if (!(ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
ATA_PC98_BANK, ~0,
ATA_PC98_BANKIOSIZE, RF_ACTIVE))) {
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io);
bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio);
return ENOMEM;

View File

@ -73,9 +73,8 @@ ata_isa_probe(device_t dev)
/* allocate the io port range */
rid = ATA_IOADDR_RID;
io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_IOSIZE, RF_ACTIVE);
if (!io)
if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_IOSIZE, RF_ACTIVE)))
return ENXIO;
/* set the altport range */
@ -86,9 +85,8 @@ ata_isa_probe(device_t dev)
/* allocate the altport range */
rid = ATA_CTLADDR_RID;
ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_CTLIOSIZE, RF_ACTIVE);
if (!ctlio) {
if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_CTLIOSIZE, RF_ACTIVE))) {
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
return ENXIO;
}

View File

@ -388,13 +388,11 @@ ata_pci_allocate(device_t dev)
int i, rid;
rid = ATA_IOADDR_RID;
io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
if (!io)
if (!(io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE)))
return ENXIO;
rid = ATA_CTLADDR_RID;
ctlio = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
if (!ctlio) {
if (!(ctlio = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,RF_ACTIVE))){
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
return ENXIO;
}
@ -415,7 +413,6 @@ ata_pci_allocate(device_t dev)
}
ata_generic_hw(ch);
return 0;
}