Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1882617imm; Thu, 18 Oct 2018 05:57:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Ba9Pk4bVjCiHZ93bpwt5RrLBbq9BwEm/FRc29ejB3AkGMXWtZYhSXThbKeEsTT6mHLAbA X-Received: by 2002:a62:b209:: with SMTP id x9-v6mr31154657pfe.148.1539867466605; Thu, 18 Oct 2018 05:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539867466; cv=none; d=google.com; s=arc-20160816; b=aLQVhig93Ym5huGv7/W1Cm5ME6FcqbJzSENWHD7tnSQX1atij0AAnfmICU5QfHtsP5 uRcvE8nKlM65o8vNNHwvIlueAK5svQLAwzM/azKb4q/Yk0+Yzo4VwAOSeESg1TK1v7d0 GCtUMyShxmVn3CNswGWbQS3nXDBTvrIaOL8VaUJ5AhRDsv0IA5sHNhJ6OXaQV0WEfqm9 3yFR67LlvLuJTIUPZcrycnOxZH0HuXbTE0KQmf+RAfQo907Q8kEj2TWzobzebB2TIqEv eX0npcnJ+GQchzt2tk2bcZItkhmLNNFIaOjvsDnvhS0FW1OxYg1ujd7VMWjp+MIHk9U2 bB7Q== 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=mpTSJSTZy2SgXDLU7XtscBMs1joiE6esQLCrfW63jfo=; b=opGpAr+7cdKUhIHePPre8iXxVu0ThIjFUuR8z4CqfTZNR89lG40t6k8jhraX+poS0S xvsMB6ZiDthOkWCv+g7iXn0T/Krju1YhW01akzIMwmNRnXBCfqmwDfM+hx75euZboqxH OM6SNAPcf6hQU5Ti9vGfyAhB2DiL7Sj7p6QhDHP6eYQvf0idESB1HTXkW4mJSNLtD+It eOwZvZHo9iUkYhMOGJfOwpQi579EOBkCoi5nLUOvhZfRYsLeoWMjKm6FGXfJiPzpcJ3d GuEXqvrzP9GKJwV1GONjCWuxtOmYCuVaO5XwiQL4sEWnCinzQ9YkHEntb3vgrsYPq9DG pUbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=EAenmawy; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si21620697plh.124.2018.10.18.05.57.31; Thu, 18 Oct 2018 05:57:46 -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=@oracle.com header.s=corp-2018-07-02 header.b=EAenmawy; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727262AbeJRU4i (ORCPT + 99 others); Thu, 18 Oct 2018 16:56:38 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:53842 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbeJRU4i (ORCPT ); Thu, 18 Oct 2018 16:56:38 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9ICrs9q020945; Thu, 18 Oct 2018 12:55:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=mpTSJSTZy2SgXDLU7XtscBMs1joiE6esQLCrfW63jfo=; b=EAenmawyMMsxii0gqtwFJf9xGs6rQ/ySXrgjcKtNo4zIAtUqH1HNG0zFOPHyQ/z6e/0n FZyCvAPMpHUw8q1bITOrTcbAdHLauHeA9K+zOUD53QRA9AsL7871autPT8toHBcCKDAh RpSQYMSNfz8ObvGbg3fvuNn7xHhFAE5ldxeVI3NgyhNCktpRGlw6FOZ0ZRxfgDP4lH+G ZmW1f2LkMuePR1ZCCWWbYqFQcvkohm8cDlErVbuyu6h0m12MMupuIM/Nw/YPGFxpau+v 58mPjObtAuVcJK4cste90Ga864rxqL9ztOja0IpB+eWzx6S0yYtgLfW7iETLLLfxIFZL IA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2n384uefmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Oct 2018 12:55:16 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9ICtBsG026915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Oct 2018 12:55:11 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9ICtAHt019565; Thu, 18 Oct 2018 12:55:10 GMT Received: from mwanda (/129.205.6.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 18 Oct 2018 05:55:09 -0700 Date: Thu, 18 Oct 2018 15:55:02 +0300 From: Dan Carpenter To: Stefan Popa Cc: jic23@kernel.org, devel@driverdev.osuosl.org, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, pmeerw@pmeerw.net, knaack.h@gmx.de Subject: Re: [PATCH 1/2] staging: iio: ad7606: Move out of staging Message-ID: <20181018125502.2hnp3s45lk6dggqt@mwanda> References: <1539853832-26534-1-git-send-email-stefan.popa@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1539853832-26534-1-git-send-email-stefan.popa@analog.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9049 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=821 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810180116 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 18, 2018 at 12:10:32PM +0300, Stefan Popa wrote: > +static int ad7606_read_samples(struct ad7606_state *st) > +{ > + unsigned int num = st->chip_info->num_channels; > + u16 *data = st->data; > + int ret; > + > + /* > + * The frstdata signal is set to high while and after reading the sample > + * of the first channel and low for all other channels. This can be used > + * to check that the incoming data is correctly aligned. During normal > + * operation the data should never become unaligned, but some glitch or > + * electrostatic discharge might cause an extra read or clock cycle. > + * Monitoring the frstdata signal allows to recover from such failure > + * situations. > + */ > + > + if (st->gpio_frstdata) { > + ret = st->bops->read_block(st->dev, 1, data); > + if (ret) > + return ret; > + > + if (!gpiod_get_value(st->gpio_frstdata)) { This check should maybe be: if (gpiod_get_value(st->gpio_frstdata) <= 0) { (Or possibly not, I don't know the code very well). > + ad7606_reset(st); > + return -EIO; > + } > + > + data++; > + num--; > + } > + > + return st->bops->read_block(st->dev, num, data); > +} regards, dan carpenter