Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2079211imm; Sat, 30 Jun 2018 10:23:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeXNQ+Y7WANPNIAo9DQMTH94ytgeaLwo+sZZM3pyb2EIYgOSqFWIHb1WSF1zvQ/NZ6zM6rA X-Received: by 2002:a62:190d:: with SMTP id 13-v6mr6902211pfz.103.1530379420982; Sat, 30 Jun 2018 10:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530379420; cv=none; d=google.com; s=arc-20160816; b=rN+b/FOv3HtCqEre6l1+xwYTvbmY51D7v/9mwODpKOvuaB/GXBGGafAJVssSd9Dhqg Hb3yuhqrEdcZf+Q4H9rfeTXpl4s+SkqbsF7S9ZB9pPB0rrFWPAkm1KSHd4cIZ4oWqFPW Y9epJrZLhHvEN8UrFmnhl9ADC6MEujhDCajQDg9yXovt4CKXhFLKQ0Oqqw1dVadPUTJl Rt7FpU8Xp3CyPvf3f/bNbzZOUaBO+hbRkVNZPijutVB6Xo3opY6RfzEwE7JsBYnw7JeX priqH/+6jyZ/07HQ4xqE5z7f3RgJjsuhCaUCTqCWMR9EIUPNQ69MOiRwvUibwI/jhqKK Ysrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=8Xfjj9HYfC2Sb8WIArwWjuHUIOsYGH7qEmsqOygtmns=; b=1DcLm82T0ia/+ql0FG3MPkypPV/AtPZp2nVq7e7z28pNYubKZR7jL2QAmR/VZ2a0dQ UFXmm7QxbT71jk+kifI3yfPbIxEV7lXdtOD3kw9yv5etOj8SfCW44DfHunVQYeeO85yQ w7BWKcCYCpVO95eGN6LAUefmLp/U2PIs4BcWl/No/hcMN6Vni1qvNPi11t5wRzB6oNk9 zTB7UDcUL6kjDCn4wDniWZILqUbbFD6hCPDhk+Z512usLA3A9Yf2JkULBmIiZcXKkPQj jCjUK25Nvn8fkqWyc4UoV1t5DRTpW9wKlGC80bi7R+uDnNZrHWySqEiz2OD/ytCy1oXO +6gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HwJCcKft; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18-v6si8097201pgd.137.2018.06.30.10.23.26; Sat, 30 Jun 2018 10:23:40 -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=@kernel.org header.s=default header.b=HwJCcKft; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751504AbeF3RW0 (ORCPT + 99 others); Sat, 30 Jun 2018 13:22:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:47934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751252AbeF3RWY (ORCPT ); Sat, 30 Jun 2018 13:22:24 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6765D2561A; Sat, 30 Jun 2018 17:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530379344; bh=1SdkLzrB1bmhBKOmUSGb6n3IvNVAm3LQ5CCTRC6FETg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HwJCcKftbAsB0gyse6zY9BehkNaUsChmz8ELw37gabcrU9oMKhHR2UnDCwAmNWlvw /ZAioTPitrngxXJC0oGb4AJUHZDyXIYUPOpD39WjYwzYYGsiOdTadETH/uPHQC4enz ftKaqKr000d4VPRLQ795HNyoH1qDWmWbbuXeccn8= Date: Sat, 30 Jun 2018 18:22:19 +0100 From: Jonathan Cameron To: Karim Eshapa Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging:iio:impedance-analyzer:ad5933: Macro replacement Cleanups. Message-ID: <20180630182219.31c668d0@archlinux> In-Reply-To: <20180625191123.3685-1-karim.eshapa@gmail.com> References: <20180625191123.3685-1-karim.eshapa@gmail.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 25 Jun 2018 21:11:23 +0200 Karim Eshapa wrote: > Doing some macro replacement to start an array of structures > so it can be reused by manipulating it with different values. > > Signed-off-by: Karim Eshapa There are all sorts of issues with the ABI this driver is providing to userspace, but this isn't a bad bit of cleanup none the less. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > .../staging/iio/impedance-analyzer/ad5933.c | 57 +++++++------------ > 1 file changed, 19 insertions(+), 38 deletions(-) > > diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c > index 3bcf49466361..14df89510396 100644 > --- a/drivers/staging/iio/impedance-analyzer/ad5933.c > +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c > @@ -116,45 +116,26 @@ static struct ad5933_platform_data ad5933_default_pdata = { > .vref_mv = 3300, > }; > > +#define AD5933_CHANNEL(_type, _extend_name, _info_mask_separate, _address, \ > + _scan_index, _realbits) { \ > + .type = (_type), \ > + .extend_name = (_extend_name), \ > + .info_mask_separate = (_info_mask_separate), \ > + .address = (_address), \ > + .scan_index = (_scan_index), \ > + .scan_type = { \ > + .sign = 's', \ > + .realbits = (_realbits), \ > + .storagebits = 16, \ > + }, \ > +} > + > static const struct iio_chan_spec ad5933_channels[] = { > - { > - .type = IIO_TEMP, > - .indexed = 1, > - .channel = 0, > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | > - BIT(IIO_CHAN_INFO_SCALE), > - .address = AD5933_REG_TEMP_DATA, > - .scan_index = -1, > - .scan_type = { > - .sign = 's', > - .realbits = 14, > - .storagebits = 16, > - }, > - }, { /* Ring Channels */ > - .type = IIO_VOLTAGE, > - .indexed = 1, > - .channel = 0, > - .extend_name = "real", > - .address = AD5933_REG_REAL_DATA, > - .scan_index = 0, > - .scan_type = { > - .sign = 's', > - .realbits = 16, > - .storagebits = 16, > - }, > - }, { > - .type = IIO_VOLTAGE, > - .indexed = 1, > - .channel = 0, > - .extend_name = "imag", > - .address = AD5933_REG_IMAG_DATA, > - .scan_index = 1, > - .scan_type = { > - .sign = 's', > - .realbits = 16, > - .storagebits = 16, > - }, > - }, > + AD5933_CHANNEL(IIO_TEMP, NULL, BIT(IIO_CHAN_INFO_RAW) | > + BIT(IIO_CHAN_INFO_SCALE), AD5933_REG_TEMP_DATA, -1, 14), > + /* Ring Channels */ > + AD5933_CHANNEL(IIO_VOLTAGE, "real", 0, AD5933_REG_REAL_DATA, 0, 16), > + AD5933_CHANNEL(IIO_VOLTAGE, "imag", 0, AD5933_REG_IMAG_DATA, 1, 16), > }; > > static int ad5933_i2c_write(struct i2c_client *client, u8 reg, u8 len, u8 *data)