mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Small style fixes:
- Avoid side-effect assignments in if statements when possible. - Don't use ! to check for NULL pointers, explicitly check against NULL. - Explicitly check error return values against 0. - Don't use INTR_MPSAFE for interrupt handlers with only filters as it is meaningless. - Remove unneeded function casts.
This commit is contained in:
parent
4ef75f147a
commit
686b1e6bc0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216490
@ -558,16 +558,15 @@ hpet_attach(device_t dev)
|
||||
}
|
||||
if (t->irq >= 0) {
|
||||
t->intr_rid = hpet_find_irq_rid(dev, t->irq, t->irq);
|
||||
if (!(t->intr_res =
|
||||
bus_alloc_resource(dev, SYS_RES_IRQ, &t->intr_rid,
|
||||
t->irq, t->irq, 1, RF_ACTIVE))) {
|
||||
t->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&t->intr_rid, t->irq, t->irq, 1, RF_ACTIVE);
|
||||
if (t->intr_res == NULL) {
|
||||
t->irq = -1;
|
||||
device_printf(dev,
|
||||
"Can't map interrupt for t%d.\n", i);
|
||||
} else if ((bus_setup_intr(dev, t->intr_res,
|
||||
INTR_MPSAFE | INTR_TYPE_CLK,
|
||||
(driver_filter_t *)hpet_intr_single, NULL,
|
||||
t, &t->intr_handle))) {
|
||||
} else if (bus_setup_intr(dev, t->intr_res,
|
||||
INTR_TYPE_CLK, hpet_intr_single, NULL, t,
|
||||
&t->intr_handle) != 0) {
|
||||
t->irq = -1;
|
||||
device_printf(dev,
|
||||
"Can't setup interrupt for t%d.\n", i);
|
||||
@ -614,13 +613,12 @@ hpet_attach(device_t dev)
|
||||
while (j > 0 && (cvectors & (1 << (j - 1))) != 0)
|
||||
j--;
|
||||
sc->intr_rid = hpet_find_irq_rid(dev, j, i);
|
||||
if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&sc->intr_rid, j, i, 1, RF_SHAREABLE | RF_ACTIVE)))
|
||||
device_printf(dev,"Can't map interrupt.\n");
|
||||
else if ((bus_setup_intr(dev, sc->intr_res,
|
||||
INTR_MPSAFE | INTR_TYPE_CLK,
|
||||
(driver_filter_t *)hpet_intr, NULL,
|
||||
sc, &sc->intr_handle))) {
|
||||
sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&sc->intr_rid, j, i, 1, RF_SHAREABLE | RF_ACTIVE);
|
||||
if (sc->intr_res == NULL)
|
||||
device_printf(dev, "Can't map interrupt.\n");
|
||||
else if (bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK,
|
||||
hpet_intr, NULL, sc, &sc->intr_handle) != 0) {
|
||||
device_printf(dev, "Can't setup interrupt.\n");
|
||||
} else {
|
||||
sc->irq = rman_get_start(sc->intr_res);
|
||||
|
@ -245,9 +245,10 @@ atrtc_attach(device_t dev)
|
||||
int i;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
||||
&sc->port_rid, IO_RTC, IO_RTC + 1, 2, RF_ACTIVE)))
|
||||
device_printf(dev,"Warning: Couldn't map I/O.\n");
|
||||
sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid,
|
||||
IO_RTC, IO_RTC + 1, 2, RF_ACTIVE);
|
||||
if (sc->port_res == NULL)
|
||||
device_printf(dev, "Warning: Couldn't map I/O.\n");
|
||||
atrtc_start();
|
||||
clock_register(dev, 1000000);
|
||||
bzero(&sc->et, sizeof(struct eventtimer));
|
||||
@ -258,14 +259,13 @@ atrtc_attach(device_t dev)
|
||||
while (bus_get_resource(dev, SYS_RES_IRQ, sc->intr_rid,
|
||||
&s, NULL) == 0 && s != 8)
|
||||
sc->intr_rid++;
|
||||
if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&sc->intr_rid, 8, 8, 1, RF_ACTIVE))) {
|
||||
device_printf(dev,"Can't map interrupt.\n");
|
||||
sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&sc->intr_rid, 8, 8, 1, RF_ACTIVE);
|
||||
if (sc->intr_res == NULL) {
|
||||
device_printf(dev, "Can't map interrupt.\n");
|
||||
return (0);
|
||||
} else if ((bus_setup_intr(dev, sc->intr_res,
|
||||
INTR_MPSAFE | INTR_TYPE_CLK,
|
||||
(driver_filter_t *)rtc_intr, NULL,
|
||||
sc, &sc->intr_handler))) {
|
||||
} else if ((bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK,
|
||||
rtc_intr, NULL, sc, &sc->intr_handler))) {
|
||||
device_printf(dev, "Can't setup interrupt.\n");
|
||||
return (0);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user