mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Éric Piel" <eric.piel@tremplin-utc.net>
To: Takashi Iwai <tiwai@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lis3lv02d: Avoid zero-division
Date: Fri, 11 Nov 2011 19:11:06 +0100	[thread overview]
Message-ID: <4EBD653A.8060701@tremplin-utc.net> (raw)
In-Reply-To: <s5hr51jm8zc.wl%tiwai@suse.de>

Op 08-11-11 07:19, Takashi Iwai schreef:
> At Tue, 08 Nov 2011 04:57:42 +0100,
> Éric Piel wrote:
>>
>> Op 03-11-11 13:09, Takashi Iwai schreef:
>>> In some weird situation, HP DriveGuard chip can't read ODR value
>>> correctly, and it results in a zero-division Oops in lis3lv02d driver.
>>> This patch fixes the Oops by checking the value appopriately, and skips
>>> if any weird value is read.
>> Hi Takashi,
>> Actually, a similar patch already just landed in linus' tree:
>> 1510dd5954 (lis3lv02d: avoid divide by zero due to unchecked)
>>
>> However, in the patch applied, the device is disabled (until next
>> reboot) while in yours, the sleep is just skipped. Does it work again
>> after the read of odr fails? If so, maybe I could improve the current
>> version by, after the odr read fails, sleeping a long and safe time and
>> then trying to read the odr again. Then if it fails again, we give up,
>> otherwise the device can be used again.
>
> I guess it's possible to use the device afterward.  The possible
> reason is either the chip is set to an invalid mode or ACPI isn't set
> up properly.  But this path usually means that ACPI does work more or
> less since you could read WHOAMI.
>
>> Do you have such a device yourself? Could you let me know if after a
>> failing read of the odr, the device keeps working?
>
> I have a machine but I'm not quite sure how to reproduce this error.
> It happened casually during the installation of a new system, so it's
> not so trivial to switch the module during it...
Dear Takashi,

I've looked more at the error. Now it seems to me that the fact that 
get_odr() returns 0 is not because there is a problem with the device 
but just because it is powered off: for the "3dc" device, this reflects 
in rate of 0. We assume that the ACPI code does turn the device on, but 
it might not do it, or the device might still need more time to fully 
initialize. So, just turning the device on and waiting a bit long should 
work fine.

However, looking for the spec document of lis3dc (or hp3dc), I couldn't 
find any reference to such device. I've found documents for lis3dh, with 
apparently same registers and WHOAMI value. However, contrarily to what 
is currently expected, it's a 16-bit device, not 8-bit. So my main 
question is: are you sure the device you have is 8-bit? Isn't your 
device a 16-bit lis3dh? Do you have the spec of lis3dc/hp3dc?

If it's indeed a 16-bit device, I'll update the support for this device 
to obtain a better precision.

Éric

  reply	other threads:[~2011-11-11 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 12:09 Takashi Iwai
2011-11-08  3:57 ` Éric Piel
2011-11-08  6:19   ` Takashi Iwai
2011-11-11 18:11     ` Éric Piel [this message]
2011-11-14 14:59       ` Takashi Iwai

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=4EBD653A.8060701@tremplin-utc.net \
    --to=eric.piel@tremplin-utc.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.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 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®