mfd: fusb302: correct the wrong pointer type used in regmap_read
authorzain wang <wzz@rock-chips.com>
Thu, 22 Sep 2016 12:18:55 +0000 (20:18 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 23 Sep 2016 09:13:41 +0000 (17:13 +0800)
used unsigned int pointer that regmap_read wanted instead of unsigned char
pointer

Change-Id: I89f838144a4d27a3bf695232acc4dbbe920863bf
Signed-off-by: zain wang <wzz@rock-chips.com>
drivers/mfd/fusb302.c

index 2defbdea20b3fe5ada58d708e32f8803bfc09c18..ca0eb20c0014f466e170f48e5b9f9ed48ff2ca46 100644 (file)
@@ -240,9 +240,9 @@ static void fusb302_flush_rx_fifo(struct fusb30x_chip *chip)
 
 static int tcpm_get_cc(struct fusb30x_chip *chip, int *CC1, int *CC2)
 {
-       u8 val;
+       u32 val;
        int *CC_MEASURE;
-       u8 store;
+       u32 store;
 
        *CC1 = TYPEC_CC_VOLT_OPEN;
        *CC2 = TYPEC_CC_VOLT_OPEN;
@@ -253,7 +253,7 @@ static int tcpm_get_cc(struct fusb30x_chip *chip, int *CC1, int *CC2)
                CC_MEASURE = CC2;
 
        if (chip->cc_state & 0x04) {
-               regmap_read(chip->regmap, FUSB_REG_SWITCHES0, (u32 *)(&store));
+               regmap_read(chip->regmap, FUSB_REG_SWITCHES0, &store);
 
                /* measure cc1 first */
                regmap_update_bits(chip->regmap, FUSB_REG_SWITCHES0,
@@ -264,7 +264,7 @@ static int tcpm_get_cc(struct fusb30x_chip *chip, int *CC1, int *CC2)
                                   SWITCHES0_MEAS_CC1);
                usleep_range(250, 300);
 
-               regmap_read(chip->regmap, FUSB_REG_STATUS0, (u32 *)(&val));
+               regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
                val &= STATUS0_BC_LVL;
                if (val)
                        *CC1 = val;
@@ -277,7 +277,7 @@ static int tcpm_get_cc(struct fusb30x_chip *chip, int *CC1, int *CC2)
                                   SWITCHES0_MEAS_CC2);
                usleep_range(250, 300);
 
-               regmap_read(chip->regmap, FUSB_REG_STATUS0, (u32 *)(&val));
+               regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
                val &= STATUS0_BC_LVL;
                if (val)
                        *CC2 = val;
@@ -311,7 +311,7 @@ static int tcpm_get_cc(struct fusb30x_chip *chip, int *CC1, int *CC2)
                regmap_write(chip->regmap, FUSB_REG_MEASURE, 0x26 << 2);
                usleep_range(250, 300);
 
-               regmap_read(chip->regmap, FUSB_REG_STATUS0, (u32 *)(&val));
+               regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
 
                if (val & STATUS0_COMP) {
                        *CC_MEASURE = TYPEC_CC_VOLT_OPEN;
@@ -319,8 +319,7 @@ static int tcpm_get_cc(struct fusb30x_chip *chip, int *CC1, int *CC2)
                        regmap_write(chip->regmap, FUSB_REG_MEASURE, 0x05 << 2);
                        usleep_range(250, 300);
 
-                       regmap_read(chip->regmap, FUSB_REG_STATUS0,
-                                   (u32 *)(&val));
+                       regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
 
                        if (val & STATUS0_COMP)
                                *CC_MEASURE = TYPEC_CC_VOLT_RA;
@@ -475,8 +474,10 @@ static void fusb302_pd_reset(struct fusb30x_chip *chip)
 static void tcpm_init(struct fusb30x_chip *chip)
 {
        u8 val;
+       u32 tmp;
 
-       regmap_read(chip->regmap, FUSB_REG_DEVICEID, (u32 *)(&chip->chip_id));
+       regmap_read(chip->regmap, FUSB_REG_DEVICEID, &tmp);
+       chip->chip_id = (u8)tmp;
        platform_set_vbus_lvl_enable(chip, 0, 0);
        chip->notify.is_cc_connected = 0;
        chip->cc_state = 0;
@@ -638,10 +639,10 @@ static void set_state_unattached(struct fusb30x_chip *chip)
 
 static int tcpm_check_vbus(struct fusb30x_chip *chip)
 {
-       u8 val;
+       u32 val;
 
        /* Read status register */
-       regmap_read(chip->regmap, FUSB_REG_STATUS0, (u32 *)&val);
+       regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
 
        return (val & STATUS0_VBUSOK) ? 1 : 0;
 }