mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Daniel Baluta <daniel.baluta@intel.com>,
	Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
Cc: Constantin Musca <constantin.musca@intel.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v3] iio: accel: Add support for Freescale MMA7660FC
Date: Wed, 4 May 2016 10:28:19 +0100	[thread overview]
Message-ID: <98934844-092f-a0de-de29-f15510b86a0a@kernel.org> (raw)
In-Reply-To: <CAEnQRZAvp4qb1asPKwGDV-HAkDjU+ca-4kQR-QSFp=83SbO7gw@mail.gmail.com>

On 03/05/16 11:55, Daniel Baluta wrote:
> On Tue, May 3, 2016 at 1:43 PM, Jonathan Cameron
> <jic23@jic23.retrosnub.co.uk> wrote:
>>
>>
>> On 3 May 2016 09:29:26 CEST, Daniel Baluta <daniel.baluta@intel.com> wrote:
>>> On Sun, May 1, 2016 at 9:56 PM, Jonathan Cameron <jic23@kernel.org>
>>> wrote:
>>>> On 29/04/16 13:19, Constantin Musca wrote:
>>>>> Minimal implementation of an IIO driver for the Freescale
>>>>> MMA7660FC 3-axis accelerometer. Datasheet:
>>>>>
>>> http://www.freescale.com.cn/files/sensors/doc/data_sheet/MMA7660FC.pdf
>>>>>
>>>>> Includes:
>>>>> - ACPI support;
>>>>> - read_raw for x,y,z axes;
>>>>> - reading and setting the scale (range) parameter.
>>>>> - power management
>>>>>
>>>>> Signed-off-by: Constantin Musca <constantin.musca@intel.com>
>>>> Couple of trivial bits inline as well as that request to update the
>>> link above
>>>> if possible...
>>>>
>>>> Why the retries? (I'm on a train without internet access for quite a
>>> few
>>>> hours yet hence I can't dig into the datasheet!)
>>>
>>> I suggested the retries because it's quite unsafe to infinitely loop
>>> in the kernel
>>> on a hardware condition. We can lockup the kernel if there is some sort
>>> of
>>> hardware problem.
>> Agreed but why try more than once? Needs a comment...
>>>
>>>
>>>>
>>>> Anyhow, even if it's obvious from the datasheet, that sort of 'magic'
>>> needs
>>>> an explanation comment...
> 
> Agree we need a comment on that. As for the number of retries I can see
> drivers doing from 5 to 100 (re)tries:
Interacts with the delays in the relevant loops.
> 
> 
> humidity/si7005.c
> 44:     int tries = 50;
> 55:     while (tries-- > 0) {
This one has a 20msec delay so total time is 1 second.
It is polling for a status change as the reading completes (faking an 
interrupt).
> 
> temperature/tmp006.c
> 55:     int tries = 50;
> 57:     while (tries-- > 0) {
100msec sleep so 5 seconds (feels a bit long now you mention it.)

> 
> dac/mcp4725.c
> 76:     int tries = 20;
> 99:     while (tries--) {
> 111:    if (tries < 0) {
Curious overkill - comment says up to 50msecs then allows 20 x 20
 = 400 msecs.
> 
> pressure/mpl3115.c
> 49:     int ret, tries = 15;
> 57:     while (tries-- > 0) {
15x20msecs no comment on how long it might take but 300msecs seems fine.
> 
> light/ltr501.c
> 329:    int tries = 100;
> 332:    while (tries--) {
100x25mescs = 2.5secs (rather long) - no comment on what is reasonable...
> 
> proximity/pulsedlight-lidar-lite-v2.c
> 160:    int tries = 10;
polls rather quick 1-2msecs so max 10msecs.
> 
> accel/mma9551_core.c
> 75:#define MMA9551_I2C_READ_RETRIES     5
No real description at all for this one... I don't have the datasheet to hand
an no internet right now.

Definitely room for some improved commenting in some of these drivers
(I clearly wasn't as fussy in the past!)  If anyone wants to datasheet dive
and add missing justifications that would be great.

Jonathan
> 
> Daniel.
> 

      reply	other threads:[~2016-05-04 14:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 12:19 Constantin Musca
2016-04-29 13:08 ` Martin Kepplinger
2016-04-29 13:32   ` Constantin Musca
2016-05-01 18:20   ` Jonathan Cameron
2016-05-04  9:45     ` Jonathan Cameron
2016-05-01 18:56 ` Jonathan Cameron
2016-05-03  7:29   ` Daniel Baluta
2016-05-03 10:43     ` Jonathan Cameron
2016-05-03 10:55       ` Daniel Baluta
2016-05-04  9:28         ` Jonathan Cameron [this message]

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=98934844-092f-a0de-de29-f15510b86a0a@kernel.org \
    --to=jic23@kernel.org \
    --cc=constantin.musca@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@jic23.retrosnub.co.uk \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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®