From patchwork Fri Dec 22 15:07:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 10130657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DC0360318 for ; Fri, 22 Dec 2017 15:11:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F42D29FB5 for ; Fri, 22 Dec 2017 15:11:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 631A52A05A; Fri, 22 Dec 2017 15:11:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C13C29FB5 for ; Fri, 22 Dec 2017 15:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756554AbdLVPKZ (ORCPT ); Fri, 22 Dec 2017 10:10:25 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:56578 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954AbdLVPKV (ORCPT ); Fri, 22 Dec 2017 10:10:21 -0500 X-IronPort-AV: E=Sophos;i="5.45,441,1508828400"; d="scan'208";a="10402505" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Dec 2017 08:10:20 -0700 Received: from eh-station.mchp-main.com (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Fri, 22 Dec 2017 08:10:19 -0700 From: Eugen Hristev To: , , , , , , , , , CC: Eugen Hristev Subject: [PATCH 11/14] iio: adc: at91-sama5d2_adc: optimize scan index for diff channels Date: Fri, 22 Dec 2017 17:07:18 +0200 Message-ID: <1513955241-10985-12-git-send-email-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513955241-10985-1-git-send-email-eugen.hristev@microchip.com> References: <1513955241-10985-1-git-send-email-eugen.hristev@microchip.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Optimize the scan index for the differential channels. Before, it was single channel count + index of the first single channel number of the differential pair. (e.g. 11+0, +2, +4, etc.) Divide that number by two (since it's always even), and add it up as a scan index to have consecutive numbered channels in the index. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 7b9febc..9610393 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -209,7 +209,7 @@ .channel = num, \ .channel2 = num2, \ .address = addr, \ - .scan_index = num + AT91_SAMA5D2_SINGLE_CHAN_CNT, \ + .scan_index = (num >> 1) + AT91_SAMA5D2_SINGLE_CHAN_CNT,\ .scan_type = { \ .sign = 's', \ .realbits = 12, \