summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/mchp/i2c.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/chip/mchp/i2c.c b/chip/mchp/i2c.c
index 2a43ab4496..c75712bc37 100644
--- a/chip/mchp/i2c.c
+++ b/chip/mchp/i2c.c
@@ -148,9 +148,16 @@ static const uint16_t i2c_controller_pcr[MCHP_I2C_CTRL_MAX] = {
MCHP_PCR_I2C3
};
+static int chip_i2c_is_controller_valid(int controller)
+{
+ if ((controller < 0) || (controller >= MCHP_I2C_CTRL_MAX))
+ return 0;
+ return 1;
+}
+
static void i2c_ctrl_slp_en(int controller, int sleep_en)
{
- if ((controller < 0) || (controller > MCHP_I2C_CTRL_MAX))
+ if (!chip_i2c_is_controller_valid(controller))
return;
if (sleep_en)
MCHP_PCR_SLP_EN_DEV(i2c_controller_pcr[controller]);
@@ -158,13 +165,6 @@ static void i2c_ctrl_slp_en(int controller, int sleep_en)
MCHP_PCR_SLP_DIS_DEV(i2c_controller_pcr[controller]);
}
-static int chip_i2c_is_controller_valid(int controller)
-{
- if ((controller < 0) || (controller >= MCHP_I2C_CTRL_MAX))
- return 0;
- return 1;
-}
-
uint32_t chip_i2c_get_ctx_flags(int port)
{
int controller = i2c_port_to_controller(port);