Deleted Added
full compact
28c28
< __FBSDID("$FreeBSD: head/sys/dev/uart/uart_core.c 250576 2013-05-12 16:43:26Z eadler $");
---
> __FBSDID("$FreeBSD: head/sys/dev/uart/uart_core.c 253161 2013-07-10 17:42:20Z marcel $");
251c251
< int flag = 0, ipend;
---
> int cnt, ipend;
253,254c253,258
< while (!sc->sc_leaving && (ipend = UART_IPEND(sc)) != 0) {
< flag = 1;
---
> if (sc->sc_leaving)
> return (FILTER_STRAY);
>
> cnt = 0;
> while (cnt < 20 && (ipend = UART_IPEND(sc)) != 0) {
> cnt++;
272c276,277
< return((flag)?FILTER_HANDLED:FILTER_STRAY);
---
> return ((cnt == 0) ? FILTER_STRAY :
> ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED));
393c398
< int error;
---
> int error, filt;
433,459d437
< sc->sc_irid = 0;
< sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid,
< RF_ACTIVE | RF_SHAREABLE);
< if (sc->sc_ires != NULL) {
< error = bus_setup_intr(dev,
< sc->sc_ires, INTR_TYPE_TTY,
< uart_intr, NULL, sc, &sc->sc_icookie);
< if (error)
< error = bus_setup_intr(dev,
< sc->sc_ires, INTR_TYPE_TTY | INTR_MPSAFE,
< NULL, (driver_intr_t *)uart_intr, sc, &sc->sc_icookie);
< else
< sc->sc_fastintr = 1;
<
< if (error) {
< device_printf(dev, "could not activate interrupt\n");
< bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid,
< sc->sc_ires);
< sc->sc_ires = NULL;
< }
< }
< if (sc->sc_ires == NULL) {
< /* No interrupt resource. Force polled mode. */
< sc->sc_polled = 1;
< callout_init(&sc->sc_timer, 1);
< }
<
490,503d467
< if (bootverbose && (sc->sc_fastintr || sc->sc_polled)) {
< sep = "";
< device_print_prettyname(dev);
< if (sc->sc_fastintr) {
< printf("%sfast interrupt", sep);
< sep = ", ";
< }
< if (sc->sc_polled) {
< printf("%spolled mode", sep);
< sep = ", ";
< }
< printf("\n");
< }
<
531a496,545
> sc->sc_leaving = 0;
> filt = uart_intr(sc);
>
> /*
> * Don't use interrupts if we couldn't clear any pending interrupt
> * conditions. We may have broken H/W and polling is probably the
> * safest thing to do.
> */
> if (filt != FILTER_SCHEDULE_THREAD) {
> sc->sc_irid = 0;
> sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ,
> &sc->sc_irid, RF_ACTIVE | RF_SHAREABLE);
> }
> if (sc->sc_ires != NULL) {
> error = bus_setup_intr(dev, sc->sc_ires, INTR_TYPE_TTY,
> uart_intr, NULL, sc, &sc->sc_icookie);
> sc->sc_fastintr = (error == 0) ? 1 : 0;
>
> if (!sc->sc_fastintr)
> error = bus_setup_intr(dev, sc->sc_ires,
> INTR_TYPE_TTY | INTR_MPSAFE, NULL,
> (driver_intr_t *)uart_intr, sc, &sc->sc_icookie);
>
> if (error) {
> device_printf(dev, "could not activate interrupt\n");
> bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid,
> sc->sc_ires);
> sc->sc_ires = NULL;
> }
> }
> if (sc->sc_ires == NULL) {
> /* No interrupt resource. Force polled mode. */
> sc->sc_polled = 1;
> callout_init(&sc->sc_timer, 1);
> }
>
> if (bootverbose && (sc->sc_fastintr || sc->sc_polled)) {
> sep = "";
> device_print_prettyname(dev);
> if (sc->sc_fastintr) {
> printf("%sfast interrupt", sep);
> sep = ", ";
> }
> if (sc->sc_polled) {
> printf("%spolled mode", sep);
> sep = ", ";
> }
> printf("\n");
> }
>
540,541d553
< sc->sc_leaving = 0;
< uart_intr(sc);