git: 87f55ab0b46a - main - ichiic: use bool for one-bit wide bit-fields

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 19 Apr 2023 20:26:07 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=87f55ab0b46ad72efee11d1b64ec8f839bb013da

commit 87f55ab0b46ad72efee11d1b64ec8f839bb013da
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-04-18 18:08:28 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-04-19 20:25:50 +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
---
 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 8f349b36f9dc..550763f90b0e 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 7353a6fae844..b557df26e9d9 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 2316e0cac1d0..242cf7e6ecec 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 608c925df38e..99c1b854514b 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: