git: 9f9b65a0933a - stable/13 - ichiic: use bool for one-bit wide bit-fields
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 22 Apr 2023 09:00:54 UTC
The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=9f9b65a0933a9b6fdde611210b29bd670c932a44 commit 9f9b65a0933a9b6fdde611210b29bd670c932a44 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2023-04-18 18:08:28 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2023-04-22 08:59:44 +0000 ichiic: use bool for one-bit wide bit-fields A one-bit wide bit-field can take only the values 0 and -1. Clang 16 introduced a warning that "implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1". Fix by using c99 bool. Reported by: Clang Reviewed by: emaste, wulf MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D39665 (cherry picked from commit 87f55ab0b46ad72efee11d1b64ec8f839bb013da) --- sys/dev/ichiic/ig4_acpi.c | 4 ++-- sys/dev/ichiic/ig4_iic.c | 8 ++++---- sys/dev/ichiic/ig4_pci.c | 4 ++-- sys/dev/ichiic/ig4_var.h | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/dev/ichiic/ig4_acpi.c b/sys/dev/ichiic/ig4_acpi.c index b23d6324cff7..06aecc31090f 100644 --- a/sys/dev/ichiic/ig4_acpi.c +++ b/sys/dev/ichiic/ig4_acpi.c @@ -108,7 +108,7 @@ ig4iic_acpi_attach(device_t dev) ig4iic_acpi_detach(dev); return (ENXIO); } - sc->platform_attached = 1; + sc->platform_attached = true; error = ig4iic_attach(sc); if (error) @@ -127,7 +127,7 @@ ig4iic_acpi_detach(device_t dev) error = ig4iic_detach(sc); if (error) return (error); - sc->platform_attached = 0; + sc->platform_attached = false; } if (sc->intr_res) { diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c index f24b26f53366..b4ef235bcf38 100644 --- a/sys/dev/ichiic/ig4_iic.c +++ b/sys/dev/ichiic/ig4_iic.c @@ -337,9 +337,9 @@ set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) { uint32_t tar; uint32_t ctl; - int use_10bit; + bool use_10bit; - use_10bit = 0; + use_10bit = false; if (sc->slave_valid && sc->last_slave == slave && sc->use_10bit == use_10bit) { return; @@ -364,7 +364,7 @@ set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) reg_write(sc, IG4_REG_CTL, ctl); reg_write(sc, IG4_REG_TAR_ADD, tar); set_controller(sc, IG4_I2C_ENABLE); - sc->slave_valid = 1; + sc->slave_valid = true; sc->last_slave = slave; } @@ -1009,7 +1009,7 @@ ig4iic_set_config(ig4iic_softc_t *sc, bool reset) (sc->cfg.bus_speed & IG4_CTL_SPEED_MASK)); /* Force setting of the target address on the next transfer */ - sc->slave_valid = 0; + sc->slave_valid = false; return (0); } diff --git a/sys/dev/ichiic/ig4_pci.c b/sys/dev/ichiic/ig4_pci.c index 71b95c3d95fb..d6906aa80e1a 100644 --- a/sys/dev/ichiic/ig4_pci.c +++ b/sys/dev/ichiic/ig4_pci.c @@ -316,7 +316,7 @@ ig4iic_pci_attach(device_t dev) ig4iic_pci_detach(dev); return (ENXIO); } - sc->platform_attached = 1; + sc->platform_attached = true; error = ig4iic_attach(sc); if (error) @@ -335,7 +335,7 @@ ig4iic_pci_detach(device_t dev) error = ig4iic_detach(sc); if (error) return (error); - sc->platform_attached = 0; + sc->platform_attached = false; } if (sc->intr_res) { diff --git a/sys/dev/ichiic/ig4_var.h b/sys/dev/ichiic/ig4_var.h index da81980039f1..3cad69cf57e3 100644 --- a/sys/dev/ichiic/ig4_var.h +++ b/sys/dev/ichiic/ig4_var.h @@ -91,10 +91,10 @@ struct ig4iic_softc { struct ig4_cfg cfg; uint32_t intr_mask; uint8_t last_slave; - int platform_attached : 1; - int use_10bit : 1; - int slave_valid : 1; - int poll: 1; + bool platform_attached : 1; + bool use_10bit : 1; + bool slave_valid : 1; + bool poll: 1; /* * Locking semantics: