Hi Jarkko,I think for now bit 11 gets masked since tmp variable is assigned to u8 variables when calling i2c_dw_recv_len() and writing to *buf pointer but your proposal indeed makes code more robust both your patch point of view or any other future change. So separate patch makes sense in my opinion.
Before pushing the v2 patch, I have one more question to ask.
The commit f53f15ba5a85 ("i2c: designware: Get right data length"), you mentioned,
does not handle bit 11 set (on a HW where it's supported) correctly.
"tmp" was not marked with DW_IC_DATA_CMD_DAT when passing to i2c_dw_recv_len function.
So I plan to update it in the v2 patch by adding this
regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
tmp &= DW_IC_DATA_CMD_DAT;
My question is: does it need a separate patch for this change?