Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3168524imm; Sun, 24 Jun 2018 13:17:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJY0Bi8QYOuecD8VZWHA4w7NzyYWqmcRbVMnVmu3FYqIgZKub0cUTYTdiU/2X2NPKJrquc+ X-Received: by 2002:a65:6186:: with SMTP id c6-v6mr8262336pgv.360.1529871420914; Sun, 24 Jun 2018 13:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529871420; cv=none; d=google.com; s=arc-20160816; b=U2XFijax8qZVjaTO5fpGcRxhbKVIdNYzEhocLtir5WdlGOZ0YlVNABSOXTudBlsvA4 OCzGseKG1mTyBVYk36BqAJCCfIlQKc0A1fyBePc7KavR2MgGLsPXGXH2ZHtewMuS/agV pxQ5MU/Q457uDZI0fzDTZsk2op6WYHQQzhvoNtZhi6AxzdkttRD8diLE0+jsiASaAsnT HjA1iuawsYjbwWvtuoDcBUF0UA4WATxS//JhYjfD1IfeackVXVK61vKsxs5cyYnfIse+ 8siajGahlOQZIC6iM6y0MDay1e2YDH9YSG8erg+YA8QX06fob7vDoYLXZ5N3yTc4pX6H lPHQ== 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=0aTDchLjVg7pdQa6ERXyM7zLrCMt6i74RkYisNWuAj0=; b=Hp44HTa9NkHxmR2Ts2U3fnE2qKfYecT6YKX6vEGXdGxqHZe3igl+pbzX6qwcBvkAvg xsluepysaurq0EA5npB8Hhg+dvIEzeZRljeIBm80cIIlfRqE8ZcsPgrkBPNEZWwaqVGl dfB/DI6vvCB0/lXkBXuau/YRRBmT7n4lLQ0KuCvtAMc9Kf0KDn3MvBDVY+VaG7KwXkdF w+2/kX3tgvjPDwN4mYFsnzdhgPjvF//uFzoGxU5jIkGYasmREI2Se9dmQRQrFRWfy2R/ pNltokaZzYRThYvc7FPOyLCfjkMhtUIzYNdB2QLtezQp7wmejs2OfrCFybX02ddXjoX8 O4Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Or2HkYbo; 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 b3-v6si10133756pgq.387.2018.06.24.13.16.46; Sun, 24 Jun 2018 13:17:00 -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=Or2HkYbo; 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 S1751859AbeFXUPW (ORCPT + 99 others); Sun, 24 Jun 2018 16:15:22 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55505 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbeFXUPU (ORCPT ); Sun, 24 Jun 2018 16:15:20 -0400 Received: by mail-wm0-f66.google.com with SMTP id v16-v6so6996953wmh.5; Sun, 24 Jun 2018 13:15:19 -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=0aTDchLjVg7pdQa6ERXyM7zLrCMt6i74RkYisNWuAj0=; b=Or2HkYbonNx1Acj9VhA4WCK0jF/Abjk44MpFxZ8WbOPY2PkInCc9bvRG/cJdgimapA FcnQ7GG5daNEr3c7XTa8tV7Z5SJauUs/MqcSpkjkWwMHwgMcdnm5Hq3IhwrjbRjGqTck NjSZyDJ4zxXT1VSbze33Gp16P9AnQjCMcjk1hblYh7hDKhlfZexfOQ/6GJ+26ZCwgrxx 1NyRmRp5LC9OdQ38mT3ecpJq+nQG3Fygzzxqb+7qWbeOwf+k6CY/Nm0XrdnkYtymjLKk aCkZ1lgp+Tm02T7nhzW21CK3jbJNvRnXZK/EsV2Aj+qx2KLLpIVTv/pG2nd8wtxuXrCf v/Sw== 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=0aTDchLjVg7pdQa6ERXyM7zLrCMt6i74RkYisNWuAj0=; b=X3jC6JGuzG5SVIhX4oikHjh/J5r+j7sg8w4N82opC4Ua6k1cZ2xrS4AJwHTdvABhaX 3SZehJuZLyQ1HvyktVltCezxRFmrnwYfprKI5ZBOYEBF6CKbaG06QmSRbmj9ttqEqaM3 +fuL1t+diqvf1GLopqoFB01RZL9hDbJbO5RLggeGr4q9PlxKjKf1AkatOIn1Ow1XXf5a E6zntOS9fL5lSc1pgxFSiLVnSz7+K4rJ4r84RlnADIZWwV2x93fdJEFONWhvLc8qDRFc sG6/f18EChhnQ2NQjIeWpHv1lXtAPEVUi6CCsGMCUccrR6JJGQI7Mi9/AwjFkClyxJ1z HH2w== X-Gm-Message-State: APt69E39Fxja+nr/unhMuu2mEAaT7IJnVvuvb7UVsKMFqM4NGDCHBquC DKP/jYR8UJZSWF3onYeGWZk= X-Received: by 2002:a1c:3544:: with SMTP id c65-v6mr3971278wma.32.1529871318910; Sun, 24 Jun 2018 13:15:18 -0700 (PDT) Received: from localhost.localdomain ([197.54.176.252]) by smtp.gmail.com with ESMTPSA id v138-v6sm13649019wmd.47.2018.06.24.13.15.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Jun 2018 13:15:17 -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] staging:iio:impedance-analyzer:ad5933: Macro replacment Cleanups. Date: Sun, 24 Jun 2018 22:15:11 +0200 Message-Id: <20180624201511.10597-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 replacment 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