diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2022-10-26 16:06:43 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2022-10-26 16:06:43 +0000 |
commit | da703ccd3bb741275afddc09bf6ccdd013890fe3 (patch) | |
tree | fb2afb14f7cdbf38cdd96c9ec43fac447153a05c /sys/dev | |
parent | af272d078d85debaca9fdf240e9c9e6d24e7c148 (diff) |
Constify battery check table
OK jcs
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/acpisbs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpisbs.c b/sys/dev/acpi/acpisbs.c index 7fd85860f79..159dd79d7cb 100644 --- a/sys/dev/acpi/acpisbs.c +++ b/sys/dev/acpi/acpisbs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpisbs.c,v 1.10 2020/06/10 22:26:40 jca Exp $ */ +/* $OpenBSD: acpisbs.c,v 1.11 2022/10/26 16:06:42 kn Exp $ */ /* * Smart Battery subsystem device driver * ACPI 5.0 spec section 10 @@ -58,7 +58,7 @@ (SMBUS_READ_##kind == SMBUS_READ_BLOCK ? SMBUS_DATA_SIZE : 2), \ #val, senst, sens } -struct acpisbs_battery_check { +const struct acpisbs_battery_check { uint8_t mode; uint8_t command; size_t offset; @@ -230,7 +230,8 @@ acpisbs_read(struct acpisbs_softc *sc) int i; for (i = 0; i < nitems(acpisbs_battery_checks); i++) { - struct acpisbs_battery_check check = acpisbs_battery_checks[i]; + const struct acpisbs_battery_check check = + acpisbs_battery_checks[i]; void *p = (void *)&sc->sc_battery + check.offset; acpi_smbus_read(sc, check.mode, check.command, check.len, p); @@ -273,7 +274,8 @@ acpisbs_setup_sensors(struct acpisbs_softc *sc) nitems(acpisbs_battery_checks), M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < nitems(acpisbs_battery_checks); i++) { - struct acpisbs_battery_check check = acpisbs_battery_checks[i]; + const struct acpisbs_battery_check check = + acpisbs_battery_checks[i]; if (check.sensor_type < 0) continue; @@ -301,7 +303,8 @@ acpisbs_refresh_sensors(struct acpisbs_softc *sc) int i; for (i = 0; i < nitems(acpisbs_battery_checks); i++) { - struct acpisbs_battery_check check = acpisbs_battery_checks[i]; + const struct acpisbs_battery_check check = + acpisbs_battery_checks[i]; void *p = (void *)&sc->sc_battery + check.offset; uint16_t *ival = (uint16_t *)p; |