Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1372554imu; Thu, 13 Dec 2018 14:03:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/X0iY7ExOKO2YilKirN0FzwYF+9oqwme971TNj5HW2OtNoTYlG/+vYWiD5JVH0yfCMyxisM X-Received: by 2002:a17:902:8a95:: with SMTP id p21mr488027plo.183.1544738597193; Thu, 13 Dec 2018 14:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544738597; cv=none; d=google.com; s=arc-20160816; b=UznE+RW3tem7iOZSr0dGKVIhw4W0i3zwej1DzqGEjy5v/kiFcjnUy82UVY1zEUI4t1 bDP9S3qUG751MiFKSPwsZoMoalf0nbJLUhX4PSEhrv6I+TOAlstqY9sElb3Vr846DSil +AMeDy21d139tfmvCwZBlfGL1znYee/ura3zMwmKYW2xUGOCh3K6MZ67LyzP6zAxhyrS E4rDQpAGUiAYYv3gleIB+4jTmL9wfi9UgocDPN702/FoDsMJrSWkAf3YdEClW3qZsjUm h1I7xbprcA2WWTkRbrwOBwBBze2iPYyAzKzmZ3zKp59KBnV4vZjdtV0oSAmUR5vKBanW MrFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ck5VNCk3zkFstAhB+usPuWzSRVaH44SPvmgAQ6M6EtQ=; b=xmT1gEogWXXcEAsUZSXBtpFU6UQxOwMiDjKmJ6uEVDOVmUGYKoViRJtN0n+mwSvYt3 FUt/ynWWb+07AIv5zePXLj2VZOH3lgoGhNAlxanDUIhTE1ShmuX4QjoUmTuPC1zBugSD rKkezk1wCGtDaU9Zm/vq6Am8FCvb+96igk9BSBKTuy9bYn7Ml3gbtY9Ynx0YO4mostK1 6hkvZ7hcuSuOsV3hvpOaofdar+qFvWWBkfOJ1v9SC6Sk47s1bYzBbOkiY3S1az/qwX3b dgCw9qPrWpJPcp20+DpaXhpTUx0JOSideoXKqRWrc6JKdHL/xXWDFOUSn2hUXCi+ayfw 3U0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OVWvrZuH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p185si2606303pfg.112.2018.12.13.14.02.54; Thu, 13 Dec 2018 14:03:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OVWvrZuH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727965AbeLMWBz (ORCPT + 99 others); Thu, 13 Dec 2018 17:01:55 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:45572 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbeLMWBy (ORCPT ); Thu, 13 Dec 2018 17:01:54 -0500 Received: by mail-io1-f65.google.com with SMTP id n3so2866946iog.12; Thu, 13 Dec 2018 14:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ck5VNCk3zkFstAhB+usPuWzSRVaH44SPvmgAQ6M6EtQ=; b=OVWvrZuH/ia9nIoXmzEXyez1ZSQstM3L2KvOZohCIHh0cfj8YNFVpSE7d1BF8g/1wZ xtvVNWjCmHzMMo0KPckWlAF3jzaNxHtOkIK96knYHyC8JqdmPTPHgj0rPtknb61p4Rue +zoqzWQQDhLLozWHj/T60SWaoy6IcTbrjPQaKYlrkMricZ1QffESSB8Rdq/NJYARqUFW we7OpFmpLn2VnTJSRcX24IBGuzjv9VzxypzCXQUi5tsAnnxjO4DiMOkPBFlzzgihifG0 oaoDOBiSXkNsch8repiN+0qb+Upr7Pp90nT/xt2KSL7vB/te624k2neQ1+aIAQ6+3Ilq j8Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ck5VNCk3zkFstAhB+usPuWzSRVaH44SPvmgAQ6M6EtQ=; b=KdOXT3tuIetdzymn7ts/jxIZ6GhZLlp5bbonhiykOtEnt2oA2Hg9iwxf3uDuFVjlXr /OFIkD5BGNTbDtg49o61FxuaD9QhU2sR/UG4MSdGQ5SPSsx3NYXizWyCkpl2nEAzIBA8 1y1lkbw9fucPpF6yMgL2WKAlE3eLE/pcsQHJKE9nrMS5sucIktzgtnsI5oLTVBPY4+Xt rZp/FcoSz7rtrJneIR59J+mor/rbN04GKXTsoYyvxliRTfcU8jfTvJ7Dz8lMJNtpH55w FMR4U095yr7DT3FU9wwq+ioNxWixGVoFD1Kour+0Ev70bHx5q11W+/kGybdvxsUOZqZo 1xwQ== X-Gm-Message-State: AA+aEWaH/ansfucpqsuKyB21dbrHdtNGDlPnilQd8EmWSjInati2fndY KLq+y8Q5I4cUe5wpzlUYh+U= X-Received: by 2002:a6b:6203:: with SMTP id f3mr553286iog.36.1544738513502; Thu, 13 Dec 2018 14:01:53 -0800 (PST) Received: from r2700x.localdomain (c-75-70-96-103.hsd1.co.comcast.net. [75.70.96.103]) by smtp.gmail.com with ESMTPSA id d192sm1430024iog.81.2018.12.13.14.01.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 14:01:52 -0800 (PST) Date: Thu, 13 Dec 2018 15:01:46 -0700 From: Jeremy Fertic To: Dan Carpenter Cc: Jonathan Cameron , devel@driverdev.osuosl.org, Lars-Peter Clausen , Michael Hennerich , linux-iio@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Peter Meerwald-Stadler , Hartmut Knaack Subject: Re: [PATCH 04/11] staging: iio: adt7316: fix handling of dac high resolution option Message-ID: <20181213220146.GA2496@r2700x.localdomain> References: <20181212005503.28054-1-jeremyfertic@gmail.com> <20181212005503.28054-5-jeremyfertic@gmail.com> <20181212082315.GI3116@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181212082315.GI3116@kadam> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 12, 2018 at 11:23:16AM +0300, Dan Carpenter wrote: > On Tue, Dec 11, 2018 at 05:54:56PM -0700, Jeremy Fertic wrote: > > @@ -651,10 +649,12 @@ static ssize_t adt7316_store_da_high_resolution(struct device *dev, > > u8 config3; > > int ret; > > > > + if (chip->id == ID_ADT7318 || chip->id == ID_ADT7519) > > + return -EPERM; > > return -EINVAL is more appropriate than -EPERM. > > regards, > dan carpenter > I chose -EPERM because the driver uses it quite a few times in similar circumstances. At least with this driver, -EINVAL is used when the user attempts to write data that would never be valid. -EPERM is used when either the current device settings prevent some functionality from being used, or the device never supports that functionality. This patch is the latter, that these two chip ids never support this function. I'll change to -EINVAL in a v2 series, but I wonder if I should hold off on a separate patch for other instances in this driver since it will be undergoing a substantial refactoring. Is there any rule of thumb about when -EPERM is appropriate for a driver, or is -EINVAL almost always the better option?