Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4246651imm; Mon, 25 Jun 2018 12:12:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKOzpqAGedWnaL8xk1N4pDj9+rOlr7IA+y9anhyrMOXg9QTquP+hiGXdbCsflNtRDKbNOTo X-Received: by 2002:a17:902:262:: with SMTP id 89-v6mr13714515plc.252.1529953967852; Mon, 25 Jun 2018 12:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529953967; cv=none; d=google.com; s=arc-20160816; b=prOUfuV9tQbRxolmRcEcN0sg/5igbgWlKSIIW3dLkY5VLk+dKHI0D9bqQA3OR082ix DgS22KCLk+TkGkmzGi96Uc8twJiMbiENoxQQnfVguIFlkeLErlQDnkRM9WnOgF8xWKg6 s50034DFRcpJQ2SBFAIFWcyK9xVoYToTDVcueK9hsQjlmEt0gaL3gqIdVpDfZqWx2d5S F1KE556qYm+0BhiDtVVJJu7doqneGl+9fROYDgD60rJ4vYr21gwdnwLcpJFmStTV+/yQ 3ssC9dHXzZtlRVOv51pmxGSTuEg6igTboa0GsrGmKaplB2IIBNFXrqdOL3U3gCdlJRYX f0ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=kYPHcw0afZAbcT0enjQcBJ+BrJljLcIcai6woZCLfx8=; b=edrF2v+r74aiDUbphFa0FZrnQchROJBnod9IPD5HTg1DE4WfWmPJB6rMu/02wbHqDW pStRBXYz/39Ij6OZQ7X7+QeshMyHMKLUskYVIeO8G0imkdEptjvl9IDG2Uz0mceQLo94 b4GZu+fYNJjMz9daDoFOgupDWZ8jry0BHh8XHpxUknB3uS11Dw8r5T1/67eroeiI064F 3xYSQPFgfQ9It8ZiAsAqoM4WlQHP+A9Loj1quo3iLLVrvfmiZdHYkuK1+x2eWmxgMnHK jeZg7LsRTzprp0kYuM7EQTFZkwSr78TUjU/DW1AnmDOB18KCmWuumWLLV3RjFJnFBnxT jdPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iJQejwNY; 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 b2-v6si14880643plz.118.2018.06.25.12.12.22; Mon, 25 Jun 2018 12:12:47 -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=iJQejwNY; 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 S934943AbeFYTLd (ORCPT + 99 others); Mon, 25 Jun 2018 15:11:33 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:50693 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752718AbeFYTLc (ORCPT ); Mon, 25 Jun 2018 15:11:32 -0400 Received: by mail-wm0-f66.google.com with SMTP id e16-v6so10458764wmd.0; Mon, 25 Jun 2018 12:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=kYPHcw0afZAbcT0enjQcBJ+BrJljLcIcai6woZCLfx8=; b=iJQejwNYkbVlnc8563W3THuDO89LR+nJ+OhuDQt1s+rn0MWCrx35H/dfDh3lfG5NMh GHdJEZVaS0IcOhN3Qd2QTmgYfMhyg/jQdi74YTGUoIDc+80x7+z5YPgYlWCZDnKfKDir XFGmA0uKa0TWy9+yZ43QOjioBf0nki9e8EmLOOc5vh6OTe6VrFJwymLK3B0fMezmPnJS aIWWHi43W/pSYk9wZQqeW/TCOM411RxrQvBhfYYGcCT4iujj+wAlPc6ItvyEPzWJq8GY ReJtOCWdi+WvtNP0biT/FlyDQnxYicueQ87e5X0N9ArW9O7Q6ceOd9tCXI4ScW6PPnIu DnBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kYPHcw0afZAbcT0enjQcBJ+BrJljLcIcai6woZCLfx8=; b=Rc7F35M/hpcMpH0Dlp/euEy5cEJnDgTCAm63SKOsnOOmiShOYHpSiz6C4wNCtbV5wN 5RBgmxXhR6ZHlHNkq/OSXA3BCuEJP5AFCx0Y/D4tmfgQbZ1LxqhGBzBDQ68eaU2+56pb ATWGCJbyYeif5f0RGkJvZbqjdljNlWmwKC7P8od1apui3uebEogj1bpBflNytyCLiMR/ Kordwptp7mGEkzZU5OKLTk+iNiXs6p/MMZPfODaE7+qrseWw+e6GVjqgZeWbhRasRYNt 4BZHs2pJkFJT4kGNsVRMPra08poxIMPvJoy9/VsJ0iOKca6+hxwIiIlKy5ZW5UOHA4WS hw7A== X-Gm-Message-State: APt69E04rGCgSwlX+tkzcbghxm75JZ+T6g0xADvv/QtiIIB8URIQSOZ7 zhRWIQjTMDKxpncgeJ7wPAc= X-Received: by 2002:a1c:d287:: with SMTP id j129-v6mr1834635wmg.106.1529953890853; Mon, 25 Jun 2018 12:11:30 -0700 (PDT) Received: from localhost.localdomain ([156.218.198.157]) by smtp.gmail.com with ESMTPSA id h193-v6sm14826152wmd.25.2018.06.25.12.11.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 12:11:29 -0700 (PDT) From: Karim Eshapa To: lars@metafoo.de Cc: Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Karim Eshapa Subject: [PATCH v2] staging:iio:impedance-analyzer:ad5933: Macro replacement Cleanups. Date: Mon, 25 Jun 2018 21:11:23 +0200 Message-Id: <20180625191123.3685-1-karim.eshapa@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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) -- 2.17.1