This commit is contained in:
cinap_lenrek 2017-03-26 16:46:58 +02:00
commit 2b323158bd
2 changed files with 8 additions and 7 deletions

View file

@ -579,7 +579,7 @@ vioenable(SDev *sd)
snprint(name, sizeof(name), "%s (%s)", sd->name, sd->ifc->name);
intrenable(vd->pci->intl, viointerrupt, vd, vd->pci->tbdf, name);
outb(vd->port+Status, inb(vd->port+Status) | DriverOk);
return 0;
return 1;
}
static int
@ -591,7 +591,7 @@ viodisable(SDev *sd)
vd = sd->ctlr;
snprint(name, sizeof(name), "%s (%s)", sd->name, sd->ifc->name);
intrdisable(vd->pci->intl, viointerrupt, vd, vd->pci->tbdf, name);
return 0;
return 1;
}
static SDev*

View file

@ -293,30 +293,31 @@ sdgetunit(SDev* sdev, int subno)
qunlock(&sdev->unitlock);
return nil;
}
if((unit = malloc(sizeof(SDunit))) == nil){
qunlock(&sdev->unitlock);
return nil;
}
sdev->unitflg[subno] = 1;
snprint(buf, sizeof buf, "%s%x", sdev->name, subno);
kstrdup(&unit->name, buf);
kstrdup(&unit->user, eve);
unit->perm = 0555;
unit->subno = subno;
unit->dev = sdev;
if(sdev->enabled == 0 && sdev->ifc->enable)
sdev->ifc->enable(sdev);
sdev->enabled = 1;
sdev->enabled = sdev->ifc->enable(sdev);
/*
* No need to lock anything here as this is only
* called before the unit is made available in the
* sdunit[] array.
*/
if(unit->dev->ifc->verify(unit) == 0){
if(sdev->enabled == 0 || unit->dev->ifc->verify(unit) == 0){
qunlock(&sdev->unitlock);
free(unit->name);
free(unit->user);
free(unit);
return nil;
}