Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp730842ima; Wed, 6 Feb 2019 07:28:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IbCB/WXYmyHc7B8L9FH30FKu01pF44x+o3zCcoU70YwVhFYlraRi5Fums0itsk0SomALFMV X-Received: by 2002:a65:64d6:: with SMTP id t22mr10182177pgv.52.1549466905017; Wed, 06 Feb 2019 07:28:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549466905; cv=none; d=google.com; s=arc-20160816; b=0Wu+piWs0TQkmFDMg09ils40yQZFzE1+XYhQYKBKvN2DCfAwYGViH+n9FT4zPqh0qx rMd/0MogxJkwmsadMrv8WR50lCc1V3zbZcAbgYhfI777iPC1mbOfo7jSfJ1fCqRkpcfk Ugm7/Cn/uvBGfrCseeg3mz5SGMOTHaijCcoljtoCdhjCiKUIK08rU98nYGScAb1HMIPJ olUyzq9bGp9+O+VgNri6pVRTRL7Sb5+lyGeP5H3A2zY6A6OlbUbLZexdRQYx0J1UIfyv lz/BiJm8jyNl2qAu60P9DjmebewdQcNmGlW0l4QcLmh0Sszrwujb78+aRznSSQWvfNOQ Mz4Q== 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=1sT5PE6KsS9qOEFE1dkFfDpGU9Dm73ua+QSmea/cg1w=; b=f1727BLXAGZ0WBW4954c1SqfHLRLXsHTrlh8wiuXpf/4HNwTaM6C7rqbMgQjSBszhP yk/V7N6/nS52yODu6aO6zXX0SzXSHEYI1vm9uEcXxywvjfxOMFqTbei6x7v+nR/2ei22 w9CSZZjb/3FBybSOs3s02e2cT+Y5drwKOqca1IG3wTPkMJprU5Rd3wPjJJdqt0AYQ41p 4CilmuirRHhBtOTTdT61xE6vwy2wWhCYsr4DUp3mi6jdvL6mT4vMDywyrnLTjsH8J4Qb mVZWHka2KvKp91piJnO6bLbbzqvkA0+kzASYAmy1FjVb/PWpzMak1kkQoMne1Ofvuep9 9/WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=xtnmB8Mj; 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 b63si6401876pfa.250.2019.02.06.07.28.08; Wed, 06 Feb 2019 07:28:24 -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=@oracle.com header.s=corp-2018-07-02 header.b=xtnmB8Mj; 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 S1729831AbfBFPAJ (ORCPT + 99 others); Wed, 6 Feb 2019 10:00:09 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:52640 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfBFPAI (ORCPT ); Wed, 6 Feb 2019 10:00:08 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x16EwpP0044451; Wed, 6 Feb 2019 14:59:33 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=1sT5PE6KsS9qOEFE1dkFfDpGU9Dm73ua+QSmea/cg1w=; b=xtnmB8Mj7az9FfYg4phKiZdkt24EEgze9QoyuLHe+NZbuKvbydclL2rekLBZ1T8UX21H TDovaM6+mnoreHDYe2n/U463jh12BBLueVVRjJTOdGPYAM1LynDOZ1s8WMEpa6szvT+1 2nyQhDuzbB8syqw1uAMcZEV6e6VoGcbvylP1MB785HuIgx4Go8EG3KmFKI7L4QBk7McH umjmibKUNHBYe++rJqKF8JPmpvDNzUa+r9KJz+rBFJV6fshxxoaaohyhBw9CGynNHBMb +3HCYMohs79JWsyYineULJa/0qBnCt/zmtGqxc4Pzr3PQI5/qkr/yvNkcfNtK8rySOhG RA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2qd97f1fbd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Feb 2019 14:59:33 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x16ExWB9016319 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 Feb 2019 14:59:32 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x16ExU0c018913; Wed, 6 Feb 2019 14:59:30 GMT Received: from kadam (/41.202.241.45) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 06 Feb 2019 14:59:29 +0000 Date: Wed, 6 Feb 2019 17:59:19 +0300 From: Dan Carpenter To: Beniamin Bia 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, Beniamin Bia Subject: Re: [PATCH 1/2] staging: iio: frequency: ad9834: Move frequency to standard iio types Message-ID: <20190206145919.GA1978@kadam> References: <20190206120542.16617-1-biabeniamin@outlook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206120542.16617-1-biabeniamin@outlook.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9158 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902060118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 02:05:41PM +0200, Beniamin Bia wrote: > Frequency attribute is added with a standard type from iio framework > instead of custom attribute. This is a small step towards removing any > unnecessary custom attribute. > > Signed-off-by: Beniamin Bia This doesn't match your email. You should probably add a From: to give your @analog.com address authorship credit. > --- > drivers/staging/iio/frequency/ad9834.c | 97 +++++++++++++++++++++----- > 1 file changed, 80 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c > index f036f75d1f22..370e8263899e 100644 > --- a/drivers/staging/iio/frequency/ad9834.c > +++ b/drivers/staging/iio/frequency/ad9834.c > @@ -29,8 +29,7 @@ > /* Registers */ > > #define AD9834_REG_CMD 0 > -#define AD9834_REG_FREQ0 BIT(14) > -#define AD9834_REG_FREQ1 BIT(15) > +#define AD9834_REG_FREQ(chann) (BIT(14) << (chann)) Only one 'n' in "chan", please. But we actually pass the address not the channel here so that was unexpected to me. I think the channel is always the same as the address? So maybe it doesn't matter. > #define AD9834_REG_PHASE0 (BIT(15) | BIT(14)) > #define AD9834_REG_PHASE1 (BIT(15) | BIT(14) | BIT(13)) > > @@ -81,6 +80,9 @@ struct ad9834_state { > struct spi_message freq_msg; > struct mutex lock; /* protect sensor state */ > > + unsigned long frequency0; > + unsigned long frequency1; I don't understand why we have two frequencies when we only ever use one. > + > /* > * DMA (thus cache coherency maintenance) requires the > * transfer buffers to live in their own cache lines. > @@ -100,6 +102,25 @@ enum ad9834_supported_device_ids { > ID_AD9838, > }; > > +#define AD9833_CHANNEL(_chan) { \ No need for the underscore. (I think?) > + .type = IIO_ALTVOLTAGE, \ > + .indexed = 1, \ > + .output = 1, \ > + .address = (_chan), \ > + .channel = (_chan), \ > + .info_mask_separate = BIT(IIO_CHAN_INFO_FREQUENCY) \ > +} regards, dan carpenter