From mboxrd@z Thu Jan 1 00:00:00 1970 From: Henrique de Moraes Holschuh Subject: Re: [PATCH 10/13] eeepc-laptop: compare proper return values in get_cpufv Date: Wed, 17 Sep 2014 07:34:47 -0300 Message-ID: <20140917103446.GA8594@khazad-dum.debian.net> References: <1410563212-31565-1-git-send-email-fransklaver@gmail.com> <1410563212-31565-11-git-send-email-fransklaver@gmail.com> <20140915214902.GB64909@vmdeb7> <20140915215125.GA21435@kroah.com> <20140915215527.GC7867@gmail.com> <20140916205247.GA6856@vmdeb7> <20140916212715.GB6856@vmdeb7> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34276 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564AbaIQKe7 (ORCPT ); Wed, 17 Sep 2014 06:34:59 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by gateway2.nyi.internal (Postfix) with ESMTP id D417920968 for ; Wed, 17 Sep 2014 06:34:58 -0400 (EDT) Content-Disposition: inline In-Reply-To: <20140916212715.GB6856@vmdeb7> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Darren Hart Cc: Frans Klaver , Greg Kroah-Hartman , Corentin Chary , Rafael Wysocki , acpi4asus-user , platform-driver-x86 , linux-kernel@vger.kernel.org, linux-acpi , "H. Peter Anvin" On Tue, 16 Sep 2014, Darren Hart wrote: > - When reading and writing sysfs device attribute files, avoid dependency > on specific error codes wherever possible. This minimizes coupling to > the error handling implemementation within the kernel. > > In general, failures to read or write sysfs device attributes shall > propogate errors wherever possible. Common errors include, but are not > limited to: > > -EIO: The read or store operation is not supported, typically returned by > the sysfs system itself if the read or store pointer is NULL. > > -ENXIO: The read or store operation failed from errno(3): EIO Input/output error (POSIX.1) ENXIO No such device or address (POSIX.1) It makes sense to retry EIO. ENXIO means there's nobody listening at the time, and isn't usually retried. The device-based interfaces get it right. A typical example is the cpu-based devices, where ENXIO means "no such processor", while EIO means "whatever you're trying to do failed", so a MSR read would return ENXIO if the processor core is offline/doesn't exist, and EIO if the processor core is there, but raised a #GP when the MSR read was attempted. -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh