Skip to contentSkip to conversation

i2c: tegra-bpmp: ignore DMA safe buffer flag

PATCH In review Mikko Perttunen 3 participants 5 messages Jan 11, 2021 – Jan 12, 2021

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

PATCH v2 1/1 i2c: tegra-bpmp: ignore DMA safe buffer flag

From: Muhammed Fazal <[email protected]>

Ignore I2C_M_DMA_SAFE flag as it does not make a difference for bpmp-i2c, but causes -EINVAL to be returned for valid transactions.

---
v2:
- Remove unnecessary check for if the bit is set

---
 drivers/i2c/busses/i2c-tegra-bpmp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-tegra-bpmp.c +2 -0
index ec7a7e917edd..aa6685cabde3 100644
@@ -80,6 +80,8 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
 		flags &= ~I2C_M_RECV_LEN;
 	}
 
+	flags &= ~I2C_M_DMA_SAFE;
+
 	return (flags != 0) ? -EINVAL : 0;
 }
 
Signature · 1 line
2.30.0
#1 lore raw
Quoted 5 lines · Mikko Perttunen

From: Muhammed Fazal <[email protected]>

Ignore I2C_M_DMA_SAFE flag as it does not make a difference for bpmp-i2c, but causes -EINVAL to be returned for valid transactions.

I wonder if bailing out on an unknown flag shouldn't be revisited in general? I mean this will happen again when a new I2C_M_* flag is introduced.

#2 lore raw
Quoted 11 lines · Wolfram Sang
Quoted 5 lines · Mikko Perttunen

From: Muhammed Fazal <[email protected]>

Ignore I2C_M_DMA_SAFE flag as it does not make a difference for bpmp-i2c, but causes -EINVAL to be returned for valid transactions.

I wonder if bailing out on an unknown flag shouldn't be revisited in general? I mean this will happen again when a new I2C_M_* flag is introduced.

If it's guaranteed that any new flags are optional to handle by the driver, than that is certainly better. I'll post a v3 with that approach.

thanks,
Mikko

#3 lore raw
Quoted 8 lines
Quoted 5 lines

I wonder if bailing out on an unknown flag shouldn't be revisited in general? I mean this will happen again when a new I2C_M_* flag is introduced.

If it's guaranteed that any new flags are optional to handle by the driver, than that is certainly better. I'll post a v3 with that approach.

If there will be a new flag, it is highly likely that it will handle some corner case which only gets applied when there is a I2C_FUNC_* flag guarding it. If the new flag turns out to be mandatory, the (poor) author needs to check with all existing drivers anyhow.

#4 lore raw
Quoted 6 lines · Wolfram Sang
Quoted 6 lines
Quoted 5 lines

I wonder if bailing out on an unknown flag shouldn't be revisited in general? I mean this will happen again when a new I2C_M_* flag is introduced.

Quoted 8 lines
Quoted 2 lines

If it's guaranteed that any new flags are optional to handle by the driver, than that is certainly better. I'll post a v3 with that approach.

If there will be a new flag, it is highly likely that it will handle some corner case which only gets applied when there is a I2C_FUNC_* flag guarding it. If the new flag turns out to be mandatory, the (poor) author needs to check with all existing drivers anyhow.

Yep, I suppose that is true :)

I just sent out the v3.

thanks!
Mikko