Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi - Make the case that width < 8 behave as the sa...



details:   https://anonhg.NetBSD.org/src/rev/9aab17731a72
branches:  trunk
changeset: 964520:9aab17731a72
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Aug 06 01:53:47 2019 +0000

description:
- Make the case that width < 8 behave as the same as before. Pointed out by
  Joerg.
- Change "switch" to "if" for simplify.

diffstat:

 sys/dev/acpi/acpi_ec.c |  19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diffs (44 lines):

diff -r 4bad6c1168c5 -r 9aab17731a72 sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c    Tue Aug 06 01:44:24 2019 +0000
+++ b/sys/dev/acpi/acpi_ec.c    Tue Aug 06 01:53:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_ec.c,v 1.76 2019/08/05 10:12:04 msaitoh Exp $     */
+/*     $NetBSD: acpi_ec.c,v 1.77 2019/08/06 01:53:47 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.76 2019/08/05 10:12:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.77 2019/08/06 01:53:47 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -679,20 +679,15 @@
        if (func == ACPI_READ)
                *value = 0;
 
-       do {
-               switch (func) {
-               case ACPI_READ:
+       for (addr = paddr; addr < (paddr + width / 8); addr++, reg++) {
+               if (func == ACPI_READ)
                        rv = acpiec_read(dv, addr, reg);
-                       break;
-               case ACPI_WRITE:
+               else
                        rv = acpiec_write(dv, addr, *reg);
-                       break;
-               }
+
                if (rv != AE_OK)
                        break;
-               addr++;
-               reg++;
-       } while (addr < (paddr + width / 8));
+       }
 
        return rv;
 }



Home | Main Index | Thread Index | Old Index