浏览代码

i2c: sh_mobile: allow setup callback to return errno

The setup callback will be more generic and, thus, need to be able to
return error codes. Change the return type to 'int' for that.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Wolfram Sang 7 年之前
父节点
当前提交
12742b6ac1
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      drivers/i2c/busses/i2c-sh_mobile.c

+ 9 - 4
drivers/i2c/busses/i2c-sh_mobile.c

@@ -149,7 +149,7 @@ struct sh_mobile_i2c_data {
 
 
 struct sh_mobile_dt_config {
 struct sh_mobile_dt_config {
 	int clks_per_count;
 	int clks_per_count;
-	void (*setup)(struct sh_mobile_i2c_data *pd);
+	int (*setup)(struct sh_mobile_i2c_data *pd);
 };
 };
 
 
 #define IIC_FLAG_HAS_ICIC67	(1 << 0)
 #define IIC_FLAG_HAS_ICIC67	(1 << 0)
@@ -749,7 +749,7 @@ static const struct i2c_algorithm sh_mobile_i2c_algorithm = {
  * r8a7740 chip has lasting errata on I2C I/O pad reset.
  * r8a7740 chip has lasting errata on I2C I/O pad reset.
  * this is work-around for it.
  * this is work-around for it.
  */
  */
-static void sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
+static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
 {
 {
 	iic_set_clr(pd, ICCR, ICCR_ICE, 0);
 	iic_set_clr(pd, ICCR, ICCR_ICE, 0);
 	iic_rd(pd, ICCR); /* dummy read */
 	iic_rd(pd, ICCR); /* dummy read */
@@ -770,6 +770,8 @@ static void sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
 	udelay(10);
 	udelay(10);
 	iic_wr(pd, ICCR, ICCR_TRS);
 	iic_wr(pd, ICCR, ICCR_TRS);
 	udelay(10);
 	udelay(10);
+
+	return 0;
 }
 }
 
 
 static const struct sh_mobile_dt_config default_dt_config = {
 static const struct sh_mobile_dt_config default_dt_config = {
@@ -881,8 +883,11 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	if (config) {
 	if (config) {
 		pd->clks_per_count = config->clks_per_count;
 		pd->clks_per_count = config->clks_per_count;
 
 
-		if (config->setup)
-			config->setup(pd);
+		if (config->setup) {
+			ret = config->setup(pd);
+			if (ret)
+				return ret;
+		}
 	}
 	}
 
 
 	ret = sh_mobile_i2c_init(pd);
 	ret = sh_mobile_i2c_init(pd);