From 53aa2bccde6af8e26fe3ede1b4c6da9d1a15bd4f Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:02:13 +0300 Subject: [PATCH 1/5] Fix: ISO C90 forbids mixed declarations --- drivers/usb/typec/tcpm/fusb302.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index e6f0dbf76..95131abcf 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -1620,6 +1620,10 @@ static irqreturn_t fusb302_irq_intn(int irq, void *dev_id) static void fusb302_print_state(struct fusb302_chip *chip) { u8 ctl0, ctl2, measure, status0, status1a, sw0, mask; + unsigned vbusok, activity, comp, wake, mdac, togss; + const char* host_cur; + const char* bc_lvl; + const char* togss_s; int ret; ret = fusb302_i2c_read(chip, FUSB_REG_CONTROL0, &ctl0); @@ -1646,7 +1650,7 @@ static void fusb302_print_state(struct fusb302_chip *chip) //FUSB_REG(FUSB_REG_POWER) // power control - const char* host_cur = "?"; + host_cur = "?"; switch ((ctl0 >> 2) & 3) { case 0: host_cur = "none"; break; case 1: host_cur = "80uA"; break; @@ -1654,7 +1658,7 @@ static void fusb302_print_state(struct fusb302_chip *chip) case 3: host_cur = "330uA"; break; } - const char* bc_lvl = "?"; + bc_lvl = "?"; switch (status0 & 3) { case 0: bc_lvl = "0-200mV"; break; case 1: bc_lvl = "200-660mV"; break; @@ -1663,17 +1667,17 @@ static void fusb302_print_state(struct fusb302_chip *chip) } // status0 - unsigned vbusok = !!(status0 & BIT(7)); - unsigned activity = !!(status0 & BIT(6)); - unsigned comp = !!(status0 & BIT(5)); - unsigned wake = !!(status0 & BIT(2)); + vbusok = !!(status0 & BIT(7)); + activity = !!(status0 & BIT(6)); + comp = !!(status0 & BIT(5)); + wake = !!(status0 & BIT(2)); // measure - unsigned mdac = ((measure & 0x3f) + 1) * 42 * (measure & BIT(6) ? 10 : 1); + mdac = ((measure & 0x3f) + 1) * 42 * (measure & BIT(6) ? 10 : 1); // status1a - unsigned togss = (status1a >> 3) & 7; - const char* togss_s = "?"; + togss = (status1a >> 3) & 7; + togss_s = "?"; switch (togss) { case 0: togss_s = "running"; break; case 1: togss_s = "src1"; break; -- 2.35.3