Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177359326
D61301.1794193588.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D61301.1794193588.diff
View Options
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -480,7 +480,6 @@
{
struct asmc_softc *sc = device_get_softc(dev);
uint8_t buf[2];
- int i;
/*
* We are ready to receive interrupts from the SMS.
@@ -530,7 +529,7 @@
* Retry SMS initialization 1000 times
* (takes approx. 2 seconds in worst case)
*/
- for (i = 0; i < 1000; i++) {
+ for (int i = 0; i < 1000; i++) {
if (asmc_key_read(dev, ASMC_KEY_SMS, buf, 2) == 0 &&
(buf[0] == ASMC_SMS_INIT1 && buf[1] == ASMC_SMS_INIT2)) {
sc->sc_sms_intr_works = 1;
@@ -640,9 +639,7 @@
static bool
asmc_sensor_convert(const char *type, const uint8_t *buf, int *millivalue)
{
- int i;
-
- for (i = 0; asmc_sensor_types[i].divisor != 0; i++) {
+ for (int i = 0; asmc_sensor_types[i].divisor != 0; i++) {
if (strncmp(type, asmc_sensor_types[i].type, 4) != 0)
continue;
if (asmc_sensor_types[i].divisor == 1)
@@ -658,9 +655,7 @@
static bool
asmc_sensor_type_supported(const char *type)
{
- int i;
-
- for (i = 0; asmc_sensor_types[i].divisor != 0; i++)
+ for (int i = 0; asmc_sensor_types[i].divisor != 0; i++)
if (strncmp(type, asmc_sensor_types[i].type, 4) == 0)
return (true);
return (false);
diff --git a/sys/dev/asmc/asmcdebug.c b/sys/dev/asmc/asmcdebug.c
--- a/sys/dev/asmc/asmcdebug.c
+++ b/sys/dev/asmc/asmcdebug.c
@@ -65,7 +65,6 @@
asmc_dumpall(device_t dev)
{
struct asmc_softc *sc = device_get_softc(dev);
- int i;
if (sc->sc_nkeys == 0) {
device_printf(dev, "asmc_dumpall: key count not available\n");
@@ -73,7 +72,7 @@
}
device_printf(dev, "asmc_dumpall: dumping %d keys\n", sc->sc_nkeys);
- for (i = 0; i < sc->sc_nkeys; i++)
+ for (int i = 0; i < sc->sc_nkeys; i++)
asmc_key_dump(dev, i);
}
diff --git a/sys/dev/asmc/asmcmmio.c b/sys/dev/asmc/asmcmmio.c
--- a/sys/dev/asmc/asmcmmio.c
+++ b/sys/dev/asmc/asmcmmio.c
@@ -36,11 +36,10 @@
asmc_mmio_wait(device_t dev)
{
struct asmc_softc *sc = device_get_softc(dev);
- int i;
uint8_t status;
int delay_us = 10;
- for (i = 0; i < ASMC_MMIO_MAX_WAIT; i++) {
+ for (int i = 0; i < ASMC_MMIO_MAX_WAIT; i++) {
status = bus_read_1(sc->sc_iomem, ASMC_MMIO_STATUS);
if (status & ASMC_MMIO_STATUS_READY)
return (0);
diff --git a/sys/dev/asmc/asmcpio.c b/sys/dev/asmc/asmcpio.c
--- a/sys/dev/asmc/asmcpio.c
+++ b/sys/dev/asmc/asmcpio.c
@@ -39,11 +39,10 @@
asmc_wait_ack(device_t dev, uint8_t val, int amount)
{
struct asmc_softc *sc = device_get_softc(dev);
- u_int i;
val = val & ASMC_STATUS_MASK;
- for (i = 0; i < amount; i++) {
+ for (u_int i = 0; i < amount; i++) {
if ((ASMC_CMDPORT_READ(sc) & ASMC_STATUS_MASK) == val)
return (0);
DELAY(10);
@@ -82,10 +81,9 @@
static int
asmc_command(device_t dev, uint8_t command)
{
- int i;
struct asmc_softc *sc = device_get_softc(dev);
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
ASMC_CMDPORT_WRITE(sc, command);
if (asmc_wait_ack(dev, 0x0c, 100) == 0) {
return (0);
@@ -285,7 +283,7 @@
asmc_pio_key_write(device_t dev, const char *key, uint8_t *buf, uint8_t len)
{
struct asmc_softc *sc = device_get_softc(dev);
- int i, error = -1, try = 0;
+ int error = -1, try = 0;
mtx_lock_spin(&sc->sc_mtx);
@@ -303,7 +301,7 @@
ASMC_DATAPORT_WRITE(sc, len);
ASMC_DPRINTF(("data port: buffer\n"));
- for (i = 0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
if (asmc_wait(dev, ASMC_STATUS_AWAIT_DATA))
goto out;
ASMC_DATAPORT_WRITE(sc, buf[i]);
diff --git a/sys/dev/asmc/asmcsysctl.c b/sys/dev/asmc/asmcsysctl.c
--- a/sys/dev/asmc/asmcsysctl.c
+++ b/sys/dev/asmc/asmcsysctl.c
@@ -310,9 +310,7 @@
static const char *
asmc_temp_desc(const char *key)
{
- unsigned int i;
-
- for (i = 0; i < nitems(asmc_temp_descs); i++) {
+ for (unsigned int i = 0; i < nitems(asmc_temp_descs); i++) {
if (strcmp(asmc_temp_descs[i].key, key) == 0)
return (asmc_temp_descs[i].desc);
}
@@ -1022,9 +1020,7 @@
static const char *
asmc_cause_str(int8_t cause, bool is_sleep)
{
- size_t i;
-
- for (i = 0; i < nitems(asmc_cause_table); i++) {
+ for (size_t i = 0; i < nitems(asmc_cause_table); i++) {
if (asmc_cause_table[i].code != cause)
continue;
if (is_sleep && asmc_cause_table[i].sleep_desc != NULL)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 9, 3:06 AM (7 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41595911
Default Alt Text
D61301.1794193588.diff (4 KB)
Attached To
Mode
D61301: asmc: Use c99 initializers with for-loop counters to improve scoping
Attached
Detach File
Event Timeline