mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mark A. Greer" <mgreer@mvista.com>
To: Andrey Volkov <avolkov@varma-el.com>
Cc: "Mark A. Greer" <mgreer@mvista.com>,
	Jean Delvare <khali@linux-fr.org>,
	adi@hexapodia.org, lm-sensors@lm-sensors.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] i2c: Combined ST m41txx i2c rtc chip driver
Date: Wed, 21 Dec 2005 14:25:44 -0700	[thread overview]
Message-ID: <20051221212544.GA4958@mag.az.mvista.com> (raw)
In-Reply-To: <43A7D76E.5050008@varma-el.com>

Hi Andrey,

On Tue, Dec 20, 2005 at 01:05:34PM +0300, Andrey Volkov wrote:
> Hello Mark
> 
> Big Thanks, I check it on my board today-tomorrow.
> But check some comments below.
> 
> Mark A. Greer wrote:
> > On Tue, Nov 15, 2005 at 07:57:14PM -0700, Mark A. Greer wrote:
<snip>
> > +	down(&m41txx_mutex);
> > +	do {
> > +		retries = M41TXX_MAX_RETRIES;
> > +
> > +		do {
> > +			if (((sec = i2c_smbus_read_byte_data(save_client,
> > +						m41txx_chip->sec)) >= 0)
> > +				&& ((min = i2c_smbus_read_byte_data(save_client,
> > +						m41txx_chip->min)) >= 0)
> > +				&& ((hour= i2c_smbus_read_byte_data(save_client,
> > +						m41txx_chip->hour)) >= 0)
> > +				&& ((day = i2c_smbus_read_byte_data(save_client,
> > +						m41txx_chip->day)) >= 0)
> > +				&& ((mon = i2c_smbus_read_byte_data(save_client,
> > +						m41txx_chip->mon)) >= 0)
> > +				&& ((year= i2c_smbus_read_byte_data(save_client,
> > +						m41txx_chip->year)) >= 0))
> > +				break;
> > +		} while (--retries > 0);
> > +
> > +		if ((retries == 0) || ((sec == sec1) && (min == min1)
> > +				&& (hour == hour1) && (day == day1)
> > +				&& (mon == mon1) && (year == year1)))
> > +			break;
> 
> I think this code is overburdened (I forgot to point on it last time,
> sorry) and may be wrong for m41t8x, since when you send i2c stop
> condition (in read_byte_data), you release time registers of m41t8x,
> and as a consequence, in the worst case, you must compare/read it an
> undetermined number of times, but not 3 times (however, for m41t00 this
> code is correct).

The 3 tries isn't to make sure that the registers didn't change, its to
make sure we actually successfully read all of the registers.  There are
10 tries to make sure the registers didn't change.  I doubt it will ever
take more than 2 or 3 so I don't see a problem with a limit of 10.

I *think* I understand you point, though.  You would prefer I not use
the smbus calls, correct?  If so, I disagree.  I think its better to use
the smbus calls b/c they're the most generic (read: will work with the
most i2c host ctlr drivers).  Perhaps Jean or someone else can make an
executive decision on this.

> I think i2c_master_recv here and i2c_master_send above in m41txx_set
> will be more appropriate, since for m41t00 it will have no meaning when
> you send STOP (250ms stall), but for m41t8x you could drop this
> while-loop completely.

I understand but its an issue of being more generic.

<snip>

> Also, please, change _obsoleted_ BCD_TO_BIN to BCD2BIN
> (see include/linux/bcd.h)

I figured one of those was deprecated but didn't know which one.  I'll
change them.

Mark

  reply	other threads:[~2005-12-21 21:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-14 13:50 [PATCH 1/1] Added support of ST m41t85 rtc chip Andrey Volkov
2005-11-15  0:41 ` Andrew Morton
2005-11-15 21:24   ` Andrey Volkov
2005-11-15 20:52 ` Jean Delvare
2005-11-15 21:48   ` Andrey Volkov
2005-11-16  3:15     ` Mark A. Greer
2005-11-16 14:50       ` Andrey Volkov
2005-11-16 18:55       ` Andy Isaacson
2005-11-16 22:24         ` Mark A. Greer
2005-11-18 20:35           ` Mark A. Greer
2005-11-21 12:35             ` Andrey Volkov
2005-12-06 21:18               ` Mark A. Greer
2005-11-16  2:57   ` Mark A. Greer
2005-11-16 14:45     ` Andrey Volkov
2005-11-16 15:19       ` Jean Delvare
2005-11-16 16:43         ` Andrey Volkov
2005-11-16 21:36           ` Mark A. Greer
2005-11-17  9:20           ` Jean Delvare
2005-11-16 21:24         ` Mark A. Greer
2005-12-19 21:03     ` [RFC] i2c: Combined ST m41txx i2c rtc chip driver (was: [PATCH 1/1] Added support of ST m41t85 rtc chip) Mark A. Greer
2005-12-19 21:06       ` Mark A. Greer
2005-12-20 10:05       ` [RFC] i2c: Combined ST m41txx i2c rtc chip driver Andrey Volkov
2005-12-21 21:25         ` Mark A. Greer [this message]
     [not found]         ` <20060111000912.GA11471@mag.az.mvista.com>
     [not found]           ` <43C4D275.2070505@varma-el.com>
     [not found]             ` <20060111161954.GB6405@mag.az.mvista.com>
2006-01-11 19:03               ` Andrey Volkov
2006-01-18 22:06                 ` Mark A. Greer
2006-01-19  7:25                   ` Jean Delvare
2006-01-26  2:01                     ` Mark A. Greer
2006-01-26 20:50                       ` Mark A. Greer

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=20051221212544.GA4958@mag.az.mvista.com \
    --to=mgreer@mvista.com \
    --cc=adi@hexapodia.org \
    --cc=avolkov@varma-el.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.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

all inboxes | Powered by JetHome®