Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2443131imd; Sun, 28 Oct 2018 10:07:42 -0700 (PDT) X-Google-Smtp-Source: AJdET5cIBPSMm9mu6CMJa+lZQT+VDgV3YkajF7wW7P6dt3/1Wr4s/L6Y4i/rrG4GN0pfywji0tHr X-Received: by 2002:aa7:858b:: with SMTP id w11-v6mr12051817pfn.77.1540746462487; Sun, 28 Oct 2018 10:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540746462; cv=none; d=google.com; s=arc-20160816; b=OnpmO3KXJJiwgTJeQ47I4klQtE6JoKlVeW6zMETjBc4Jvx/d6rAHwIDxkEAQmiM+BH f0hjs3OvwGAGX2l7NO3Wgrk6eljtI1gi4RFkgxwTxmakkccPzCdppewPBzIErtPeZLOJ Jh1ejv+I9E4AEGiDctXj7Be8E/zdjEFcqQAEC1RUYNI316CexJQdvmbVQAgC7041xrIT sLED0DHAx9eIWYKIA6Fhg1sopxooBFyF7pNWvfqIS271m51tmb9eWp0O7oiX3eo7wMJu vnN+19ZdzG5r7tV5aw3E5UqCvO9kzYWK9YE6L+7aNHk4E1UhYuf3cn4LBClMDueWDtXT n3rQ== 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:date:from:dkim-signature; bh=0Ob1SxHjZHBVGMX0NNAPJL0siXAyvQsxoYjE1n3y6AU=; b=DbLl05gwyT0qXERgKlpit3qo1jHgG3T9ZJzBSLIg87xIcTQawy7T9MU3HZMgXtS89S 6QoqaQ9spFM1eEAoYN0+k6NzOpbvMDH+vknRUhCA0bGUKxG2849vFSpYQLGao9b+4BMF 5tIHtRpxtsdsSoBm5XGkkrcnDakpDDeYYyQ9KWoiDz7FYY5Bma0Cv8Z+stkZNedjJCCN CECvONoblusGkhEXehxNC8bcgpxhkc4FmsVyarAeLr12QeH8uZG6D2lp2OKZYjZD/GF7 Vf9OhJlqzb1712jn9bXfJ13HI76HN47X51OjYTRFL0UqAjIQxpvTjoXTyUecpHWB8zqc RV8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AJxIJVGp; 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 m6-v6si17383272pgg.265.2018.10.28.10.07.24; Sun, 28 Oct 2018 10:07:42 -0700 (PDT) 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=AJxIJVGp; 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 S1727986AbeJ2Bhs (ORCPT + 99 others); Sun, 28 Oct 2018 21:37:48 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:44041 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbeJ2Bhs (ORCPT ); Sun, 28 Oct 2018 21:37:48 -0400 Received: by mail-qk1-f196.google.com with SMTP id n12so3536046qkh.11; Sun, 28 Oct 2018 09:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0Ob1SxHjZHBVGMX0NNAPJL0siXAyvQsxoYjE1n3y6AU=; b=AJxIJVGpA3iA0CKfJUuVsYmRlXJ8pJaxO8tMmoriDig6TWitEdDw5iCqxumscmL4i6 SAovwbPzlVghggVVs9gD6PhAYC4S2YCfQHZqUu54UqpWZdAXjFcLbNDuMdjkdx+wrZ1W Lp+LA7CXW7DWJnrEnm29vTpnOE4V94UmjMOgSKTdbmxJUfl4LT28zmxZlotey2C5lR+N QElIgn2pBCQ+pzqs18EOeYUdKJ742CdzRjyCwIfOtwo+QmPBgOwPDZVBVlHqhMdb3c3m LKIEPmUTa06d2Nr5ZUnXGGsJ98Fsb7mbj4S9Ov8vTueoL5PmAKF/Dz9b6CCZqjZWsugy dU0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0Ob1SxHjZHBVGMX0NNAPJL0siXAyvQsxoYjE1n3y6AU=; b=N1aOyqWZWranVcARw9LTGxR38AD729D/xyo0POn8L0kViyg6B82T/frqg/OvBCo5Ye az000w692TgtHbgM8EnJycirZJP9WX7uuZm7wFc/J3I2zcNxNgrcNFdhlcXD4CvZOnfw gh/CNIRcsdFNRwiuWg4PztdOh1GTt/xlN3E5DDhEwgwS3m1yo4efJpboMfhJ6gD+9X6s Sdx7nR0oZQeYFav1LNPzSQy48zK7v+X7zaE1lbSEJtdfvRQeWt/Q9Ve8wWSfk7mBFo0y UAMRseFiEL7qYOHtriXn9N6V5CPuaMuM7kfOpcBrgNa5wT5DpRUM05JjJYkrwNMQv/NV 8pHw== X-Gm-Message-State: AGRZ1gLCOo9JHrm/+llQ2z2bYU4ucEXaSuxDemV8p6LuxKE4wudTiZ55 E3b212vzK4GZro/S7EQdQlQ= X-Received: by 2002:a37:62d3:: with SMTP id w202mr4641645qkb.357.1540745558129; Sun, 28 Oct 2018 09:52:38 -0700 (PDT) Received: from renatolg ([186.220.2.26]) by smtp.gmail.com with ESMTPSA id m188-v6sm4934000qkb.24.2018.10.28.09.52.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Oct 2018 09:52:37 -0700 (PDT) From: Renato Lui Geh X-Google-Original-From: Renato Lui Geh Date: Sun, 28 Oct 2018 13:52:32 -0300 To: Jonathan Cameron Cc: Renato Lui Geh , lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, alexandru.Ardelean@analog.com, stefan.popa@analog.com, giuliano.belinassi@usp.br, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: Re: [PATCH v2 1/2] staging: iio: ad7780: update voltage on read Message-ID: <20181028165231.2det3cq3u7r6qoxj@renatolg> References: <1f7b2c6ee0e18b1c43a8b27f482b08313c52d4e9.1540506298.git.renatogeh@gmail.com> <20181028155611.67abeafb@archlinux> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: <20181028155611.67abeafb@archlinux> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonathan, Thank you for the review. >> + voltage_uv = regulator_get_voltage(st->reg); >> + if (voltage_uv) >> + st->int_vref_mv = voltage_uv/1000; >> *val = st->int_vref_mv * st->gain; >Is there actually a reason (now) to have the stashed value >of int_vref_mv in the state structure? From probe: if (voltage_uv) st->int_vref_mv = voltage_uv / 1000; else dev_warn(&spi->dev, "Reference voltage unspecified\n"); So the idea was to, when voltage_uv = 0, return the previous voltage. Should I instead handle this as an error the same way as in probe? Thanks, Renato