Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp15358imu; Fri, 14 Dec 2018 13:31:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/UTLK2N37yqzFMn+/KILA1bq0PekEt/KqQwXYO1cN0Aw4CqzOsVHqWVG9m1obDiUiFkEBxN X-Received: by 2002:a17:902:6848:: with SMTP id f8mr4228860pln.300.1544823061076; Fri, 14 Dec 2018 13:31:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544823061; cv=none; d=google.com; s=arc-20160816; b=aYRL+H9/gPNHbeStVHwtDzYUdXRagyD23onqzIeFWKtBQNLNQPdcRCJ+pJnI7BcGxT azZBrdmIN1mio6BHvZcfZi4OuhEoez/CPFK+ukl1IbPLXsoHgiJCq+hSMzt7czfe5SR4 7R4nrmUBy/ltkdBs0uTTPACpkxDDyGPjoGgbkRD/VRUt1zT/PSnGLGID84qR+37q+Esx qKNOyMis1Wghee1DUahJsY1U/NwnGZGme3k01zG7Hu+3fizeHEsgQnL1nAlr4iRIfgc0 lk1CKImbWm2h+tpreH73UYkDpkWvk4SL9RH4k66goiS85HgHv8CWemT+iyDRaiQ1AoHk NXag== 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=XPPxeyKFREoS2GcW2/S4Arhax4A1QyvIVUlnPDl3qyM=; b=Sav4J5sHP9DUUX7IK0pkECW1mtJtdQ+lfl/JUX6zbgpkFe6tENz6hDAGbpgGEhjzdj E3/9zDsLAJ5nD51Hph3wL4kRkdHwPft1vFoAWjgnuYJex1PSofj3Aha8IYaoPSV+QvGq +dQZC96M3aJu6pUKD5Lt6ep/fYlrT5lW015sUfXfl1WhbwE/TzN3ZyXzfPEmbKHFMQ6D pqs1kO6Q8gkSnkGKWpAmG+Dvg+x+PbldASYY4zfYoAlWqo8hivbj4/1tEPm1BKOLxUS5 KVwtWGjmtaWtJsrpoplBNHHmbxpCTc/x4dWQ8tlIecmXpav+UZhXc7UNeIrHizwGWG7L 34oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IkSUEX2Z; 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 t13si4943907pgm.175.2018.12.14.13.30.45; Fri, 14 Dec 2018 13:31:01 -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=IkSUEX2Z; 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 S1730972AbeLNV3x (ORCPT + 99 others); Fri, 14 Dec 2018 16:29:53 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:38275 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730878AbeLNV3w (ORCPT ); Fri, 14 Dec 2018 16:29:52 -0500 Received: by mail-it1-f195.google.com with SMTP id h65so11643171ith.3; Fri, 14 Dec 2018 13:29:51 -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=XPPxeyKFREoS2GcW2/S4Arhax4A1QyvIVUlnPDl3qyM=; b=IkSUEX2ZG2+OXmGjasoWEA8H5Qt7SavwQcnYY4EzUCgPK6b/q+KtgSwMksPo6m/Hqs zt5ny3D4v1LoUcbxvPo1dror9OWO0Npvlnk7in+Dl/etbWf2IHlHfiIFxetvy5BK0Ijn tuRGw6xTh2kTJJT2AwMS65n/yplh8PJaagjIqK5ZR8W9n5W3ztGoLpEp819ya9r+PZGJ oh5egrmNqbU6Lm3MyvcU6F/prCs6C5PorYtIJL1ILCy6NIOYHTDRzRLQeF6NiAUO+Gz4 omC3ynnLiw6Qq1ukLbfR5U5dkLchXtJvNxPWIuy3EKHCCTR/8zTrfu0fNuGY2vLt1Hk9 4Vyg== 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=XPPxeyKFREoS2GcW2/S4Arhax4A1QyvIVUlnPDl3qyM=; b=gpMEmhVwJY4CogExiHDy4LG14PSXrObtHtBh+RcdINoDP8zx960b9j1DEsPiGA934x 9xkgVR1DyILDLBD3x3rxr0If3GhiDmMxanMsdaGVbdw5ahe/90T6HbBDGzY2nFtUXwMw JhaTfmapWWXR7tkzUINnjJVfqUd8HSYQXR7pk5UtQqHhGzxJJ5mBW4vqA+90nqSHFI90 q2FIvrVgYno0VlYd04P+pRK7Wsras8BLKIj4+ZUXljT4/L3vfntElfqSPrRwLbvq6pxy YFtkQes653xuL2fZL6dTOc67uFsyYDQRULzrzQdGcGqLjOaQ6tArwtSBqy6mJdr/ShfD L41A== X-Gm-Message-State: AA+aEWaQULluR7DmJGYuJebwDwhj1Wrl8abZjxvgk7fdRfIo8qX972e0 kG8C+c0KEAUFG2H03tgUipE= X-Received: by 2002:a24:d30c:: with SMTP id n12mr4984203itg.50.1544822991358; Fri, 14 Dec 2018 13:29:51 -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 b192sm3084256itb.12.2018.12.14.13.29.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 13:29:50 -0800 (PST) Date: Fri, 14 Dec 2018 14:29:44 -0700 From: Jeremy Fertic To: Dan Carpenter Cc: 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 , Jonathan Cameron Subject: Re: [PATCH 04/11] staging: iio: adt7316: fix handling of dac high resolution option Message-ID: <20181214212944.GA2400@r2700x.localdomain> References: <20181212005503.28054-1-jeremyfertic@gmail.com> <20181212005503.28054-5-jeremyfertic@gmail.com> <20181212082315.GI3116@kadam> <20181213220146.GA2496@r2700x.localdomain> <20181214062618.GW3116@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181214062618.GW3116@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 Fri, Dec 14, 2018 at 09:26:18AM +0300, Dan Carpenter wrote: > On Thu, Dec 13, 2018 at 03:01:46PM -0700, Jeremy Fertic wrote: > > 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. > > Yeah. I saw that when I reviewed the later patches in this series. > > It's really not doing it right. -EPERM means permission checks like > access_ok() failed so it's not appropriate. -EINVAL is sort of general > purpose for invalid commands so it's probably the correct thing. > > > 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. > > Generally, you should prefer kernel standards over driver standards and > especially for staging. But it doesn't matter. When I reviewed this > patch, I hadn't seen that the driver was doing it like this but now I > know so it's fine. We can clean it all at once later if you want. > > regards, > dan carpenter > I'll wait to deal with these error values since some of them might go away with all the changes necessary to get the driver out of staging. Thanks for clarifying things for me.