All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Michail Georgios Etairidis <m.etairidis@beck-ipc.com>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Andy Duan <fugang.duan@nxp.com>
Subject: Re: [PATCH] i2c: i2c-imx: Use correct function to write to register
Date: Tue, 20 Jun 2017 11:23:10 +0200	[thread overview]
Message-ID: <20170620092310.GA2337@katana> (raw)
In-Reply-To: <20170620082835.melqahq7lwyb2hfl@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1240 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-06-20  9:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 13:28 [PATCH] i2c: i2c-imx: Use correct function to write to register Michail Georgios Etairidis
2017-06-19 14:46 ` Wolfram Sang
2017-06-20  8:20   ` AW: " Michail Georgios Etairidis
2017-06-20  8:28     ` Uwe Kleine-König
2017-06-20  9:23       ` Wolfram Sang [this message]
2017-06-22  8:54     ` Wolfram Sang
2017-06-19 18:54 ` Uwe Kleine-König
2017-06-20  1:50   ` Andy Duan
  -- strict thread matches above, loose matches on Subject: below --
2017-06-08 17:07 Michail Georgios Etairidis
     [not found] <681500CE65202E47A192754B01DAB4671B16747DB9@SDE12.beckipc.net>
2017-06-08 16:43 ` Lucas Stach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170620092310.GA2337@katana \
    --to=wsa@the-dreams.de \
    --cc=fugang.duan@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=m.etairidis@beck-ipc.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.