From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753983AbZICIqG (ORCPT ); Thu, 3 Sep 2009 04:46:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753586AbZICIqG (ORCPT ); Thu, 3 Sep 2009 04:46:06 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:60367 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753510AbZICIqE (ORCPT ); Thu, 3 Sep 2009 04:46:04 -0400 Date: Thu, 3 Sep 2009 10:45:43 +0200 From: Pavel Machek To: Zhang Rui Cc: "Rafael J. Wysocki" , Len Brown , Linux Kernel Mailing List , linux-acpi , Greg KH Subject: Re: [PATCH V6 1/2] introduce ALS sysfs class Message-ID: <20090903084543.GC3793@elf.ucw.cz> References: <1251789947.3483.215.camel@rzhang-dt> <200909022346.11475.rjw@sisk.pl> <20090902215148.GA3429@elf.ucw.cz> <200909030216.04896.rjw@sisk.pl> <1251945339.3483.260.camel@rzhang-dt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1251945339.3483.260.camel@rzhang-dt> X-Warning: Reading this can be dangerous to your mental health. User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2009-09-03 10:35:39, Zhang Rui wrote: > On Thu, 2009-09-03 at 08:16 +0800, Rafael J. Wysocki wrote: > > On Wednesday 02 September 2009, Pavel Machek wrote: > > > On Wed 2009-09-02 23:46:11, Rafael J. Wysocki wrote: > > > > On Wednesday 02 September 2009, Pavel Machek wrote: > > > > > On Wed 2009-09-02 23:12:58, Rafael J. Wysocki wrote: > > > > > > On Tuesday 01 September 2009, Pavel Machek wrote: > > > > > > > > > > > > > > > > > IMO, 0 and -1 are not errors. they just suggest that the Ambient Light > > > > > > > > > > illuminance is beyond the device support range, while the device is > > > > > > > > > > still working normally. > > > > > > > > > > what about exporting these values (0 and -1) to user space directly? > > > > > > > > > > > > > > > > > > Returning 0 for "below" range and 99999999 for "above" range would be > > > > > > > > > nice, yes. > > > > > > > > > > > > > > > > Why not 0 and "all ones" or 0 and -1. > > > > > > > > > > > > > > > > Is there anything wrong with -1 in particular? > > > > > > > > > > > > > > Normal people expect -1 to be less than 123, and output is in ascii. If > > > > > > > you make it ((unsigned) ~0) I guess that becomes acceptable. > > > > > > > > > > > > Well, "-1" is a perfectly valid alphanumerical representation of an int. > > > > > > I don't really see the problem with the "-", unless we're talking about some > > > > > > broken user space, that is. > > > > > > > > > > No. But if you see illumination value of -1 lumen, do you really > > > > > expect a *lot* of light? > > > > > > > > Not really. I'd rather intrepret it as "the number is not to be trusted", > > > > which is what it means. > > > > > > > > The problem with "all ones" is that it depends on the size of the underlying > > > > data type, which is not nice. Also, if you want that to be a "big number", > > > > there's no clear rule to tell what the number should actually be. > > > > > > > > Anyway, this really is a matter of definition. If we document the attribute > > > > to read as "-1" in specific circumstances, the user space will have to take > > > > that into account. > > > > > > Well, I'd prefer to specify -1 as "underflow" and 1000000000 as > > > "overflow". Any numbers should work, but ... lets make the interface > > > logical if we can. > > > > The interface is already defined, isn't it? And we're now considering whether > > or not to pass the values defined by the interface directly to the user space, > > which I think is the right thing to do, because we have no reason _whatsoever_ > > to change them to anything else. > > > I agree. > For environment illuminance, "-1" is surely an invalid value. > IMO, users would rather look for what it actually means than interpret > it to a value lower than 0. Yes, you'd have to look that up. With 1000000000 for overflow, you would not have to do any lookups... (Plus, if you use -1 for overflow... you need 0 for underflow, but 0 lumen is pretty valid value. Actually I'm thinking if this should maybe not on the log scale or something). Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html