Re: [PATCH] i2c: i2c-imx: Use correct function to write to register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 20, 2017 at 10:28:35AM +0200, Uwe Kleine-König wrote:
> Cc += Andy Duan
> 
> On Tue, Jun 20, 2017 at 10:20:42AM +0200, Michail Georgios Etairidis wrote:
> > 
> > The i2c-imx driver incorrectly uses readb()/writeb() to read and 
> > write to the appropriate registers when performing a repeated start. 
> > The appropriate imx_i2c_read_reg()/imx_i2c_write_reg() functions 
> > should be used instead. Performing a repeated start results in 
> > a kernel panic. The platform is imx.
> 
> I really wonder why this didn't pop up earlier, maybe repeated start
> just isn't that usual.

Quite the contrary, read a register or something from an EEPROM and you
should have the write (for the memory pointer) and the read (actual
data) connected with a repeated start.

The readb() calls are only accessed when a read message is not the last
message. Since most transfers look like what I described above, this is
not so super often. Add to that that not everyone reports such patches
back upstream, this might go unnoticed for a while.

So, thanks Michail for the patch and keeping at it!

Note: I found there is some code duplication in the driver. Both
'if (is_lastmsg)' blocks look like copied to me...

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux