Linux I2C development
 help / color / mirror / Atom feed
From: "Sudhakar Rajashekhara" <sudhakar.raj-l0cyMroinI0@public.gmane.org>
To: 'Jon Povey' <jon.povey-Ean/AyPsLtfkYMGBc/C6ZA@public.gmane.org>,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
Cc: "'Jean Delvare (PC drivers,
	core)'" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	'Philby John' <pjohn-k0rHJ+Hhz/SB+jHODAdFcQ@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"'Ben Dooks (embedded platforms)'"
	<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: RE: [PATCH] i2c: davinci: Fix race when setting up for TX
Date: Tue, 22 Jun 2010 17:47:59 +0530	[thread overview]
Message-ID: <41914.2560022466$1277209387@news.gmane.org> (raw)
In-Reply-To: <1277191864-5024-1-git-send-email-jon.povey-Ean/AyPsLtfkYMGBc/C6ZA@public.gmane.org>

Hi,

On Tue, Jun 22, 2010 at 13:01:03, Jon Povey wrote:
> Move the interrupt enable after the first byte load for TX, as it
> was racing with the interrupt handler and corrupting dev->buf_len
> for messages > 1 byte.
> 
> Tested on DM355.
> 
> Signed-off-by: Jon Povey <jon.povey-Ean/AyPsLtfkYMGBc/C6ZA@public.gmane.org>
> ---
> The race seems to have been introduced by 869e6692d527983958216f13c3c8e095791909df
> 
> This fixes the problem for me, but someone from TI might want to comment
> on the validity of starting the transfer before enabling the RDY interrupts.
> Any possibility of losing interrupts?
> 

This fix can cause interrupts to be missed as there will be a race between
writing to DXR and setting of interrupts. I think you can decrement dev->buf_len
before writing to DXR register. This should resolve the original race condition
which you had encountered.

Regards,
Sudhakar

  parent reply	other threads:[~2010-06-22 12:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22  7:31 [PATCH] i2c: davinci: Fix race when setting up for TX Jon Povey
     [not found] ` <1277191864-5024-1-git-send-email-jon.povey-Ean/AyPsLtfkYMGBc/C6ZA@public.gmane.org>
2010-06-22 12:17   ` Sudhakar Rajashekhara [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-09-16 10:21 Jon Povey
     [not found] ` <1284632480-24035-1-git-send-email-jon.povey-Ean/AyPsLtfkYMGBc/C6ZA@public.gmane.org>
2010-09-16 17:37   ` Kevin Hilman
     [not found]     ` <87pqwda8ub.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-09-16 20:28       ` Troy Kisky

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='41914.2560022466$1277209387@news.gmane.org' \
    --to=sudhakar.raj-l0cymroini0@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
    --cc=jon.povey-Ean/AyPsLtfkYMGBc/C6ZA@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pjohn-k0rHJ+Hhz/SB+jHODAdFcQ@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox