Skip to contentSkip to conversation

i2c: stm32f7: remove noisy and imprecise log messages

PATCH In review Wolfram Sang 2 participants 5 messages Nov 30, 2021 – Dec 1, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: stm32f7: remove noisy and imprecise log messages

The log messages talk about 'bus recovery' while it is not a bus recovery with 9 pulses but merely a controller reset. Controller resets are not worth log messages. The 'bus busy' message should be emitted by upper layers, a busy bus may be expectected in some cases.

---

Alain, do you agree? Only compile tested.

 drivers/i2c/busses/i2c-stm32f7.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +1 -7
index b9b19a2a2ffa..e0e7d0001cbc 100644
@@ -832,8 +832,6 @@ static int stm32f7_i2c_release_bus(struct i2c_adapter *i2c_adap)
 {
 	struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
 
-	dev_info(i2c_dev->dev, "Trying to recover bus\n");
-
 	stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
 			     STM32F7_I2C_CR1_PE);
 
@@ -854,13 +852,9 @@ static int stm32f7_i2c_wait_free_bus(struct stm32f7_i2c_dev *i2c_dev)
 	if (!ret)
 		return 0;
 
-	dev_info(i2c_dev->dev, "bus busy\n");
-
 	ret = stm32f7_i2c_release_bus(&i2c_dev->adap);
-	if (ret) {
-		dev_err(i2c_dev->dev, "Failed to recover the bus (%d)\n", ret);
+	if (ret)
 		return ret;
-	}
 
 	return -EBUSY;
 }
Signature · 1 line
2.30.2
maintainer
#1 lore raw

Hi Wolfram,

Quoted 9 lines · Wolfram Sang

The log messages talk about 'bus recovery' while it is not a bus recovery with 9 pulses but merely a controller reset. Controller resets are not worth log messages. The 'bus busy' message should be emitted by upper layers, a busy bus may be expectected in some cases.

---

Alain, do you agree? Only compile tested.

Yes I fully agree with that, thanks for doing that.
2 minor points:
- s/expectected/expected, within the commit log
- looking at this area of code again, it appears that the function stm32f7_i2c_release_bus is ALWAYS returning 0. So it should actually be a void function. I thus
propose, if you agree with that, that I propose, and apply a patch PRIOR to your/this patch to change that and remove the error checking of the stm32f7_i2c_release_bus function since it is useless. Is that fine for you ?

Alain

Quoted 35 lines
 drivers/i2c/busses/i2c-stm32f7.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +1 -7
index b9b19a2a2ffa..e0e7d0001cbc 100644
@@ -832,8 +832,6 @@ static int stm32f7_i2c_release_bus(struct i2c_adapter *i2c_adap)
 {
 	struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
 
-	dev_info(i2c_dev->dev, "Trying to recover bus\n");
-
 	stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
 			     STM32F7_I2C_CR1_PE);
 
@@ -854,13 +852,9 @@ static int stm32f7_i2c_wait_free_bus(struct stm32f7_i2c_dev *i2c_dev)
 	if (!ret)
 		return 0;
 
-	dev_info(i2c_dev->dev, "bus busy\n");
-
 	ret = stm32f7_i2c_release_bus(&i2c_dev->adap);
-	if (ret) {
-		dev_err(i2c_dev->dev, "Failed to recover the bus (%d)\n", ret);
+	if (ret)
 		return ret;
-	}
 
 	return -EBUSY;
 }
Signature · 1 line
2.30.2
#2 lore raw
Quoted 6 lines

- looking at this area of code again, it appears that the function stm32f7_i2c_release_bus is ALWAYS returning 0. So it should actually be a void function. I thus
propose, if you agree with that, that I propose, and apply a patch PRIOR to your/this patch to change that and remove the error checking of the stm32f7_i2c_release_bus function since it is useless. Is that fine for you ?

Well, I'd think we can also apply this patch first and then make the function void, but I don't really care about the order. But we should do both, I agree.

maintainer
#3 lore raw
Quoted 11 lines · Wolfram Sang
Quoted 6 lines

- looking at this area of code again, it appears that the function stm32f7_i2c_release_bus is ALWAYS returning 0. So it should actually be a void function. I thus
propose, if you agree with that, that I propose, and apply a patch PRIOR to your/this patch to change that and remove the error checking of the stm32f7_i2c_release_bus function since it is useless. Is that fine for you ?

Well, I'd think we can also apply this patch first and then make the function void, but I don't really care about the order. But we should do both, I agree.

Ok, I thus send a 2 patches serie with mine and yours reworked on top of mine together. Hope you don't mind.

#4 lore raw
Quoted 3 lines

Ok, I thus send a 2 patches serie with mine and yours reworked on top of mine together. Hope you don't mind.

Please do.