From patchwork Fri Jan 11 19:57:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 10760651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E01D91390 for ; Fri, 11 Jan 2019 19:57:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D11FC2A26D for ; Fri, 11 Jan 2019 19:57:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C57582A274; Fri, 11 Jan 2019 19:57:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 65BF82A26D for ; Fri, 11 Jan 2019 19:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729938AbfAKT52 (ORCPT ); Fri, 11 Jan 2019 14:57:28 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:42982 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732130AbfAKT5X (ORCPT ); Fri, 11 Jan 2019 14:57:23 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0BJvL3w117494; Fri, 11 Jan 2019 13:57:21 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547236641; bh=V0zif8M5Prr9GJZkntL1+MXxqIO4koRpaEMxGVE5C+Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FYW9W60gy/PdPXdQn2UkHcLwl9Qvf8sMPOYGE0vt7qF76HmJ03GPm3pRpzc8PYQzK +9Rp5xYE2oqyEVnGM0ZSbzmkmzhgoLRfitvlGLuGKy2fWfKaZsk7mJFe6ccFp720/s 2VcXCb+M/4ygHdGGfukZyAUvQFRVpkSOSLNGIQJA= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0BJvLLp107640 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 11 Jan 2019 13:57:21 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 11 Jan 2019 13:57:21 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Fri, 11 Jan 2019 13:57:21 -0600 Received: from legion.dal.desgin.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0BJvKnD031049; Fri, 11 Jan 2019 13:57:20 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.73.213]) by legion.dal.desgin.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id x0BJvKU18769; Fri, 11 Jan 2019 13:57:20 -0600 (CST) From: Dan Murphy To: CC: , , , Dan Murphy Subject: [PATCH v3 3/3] iio: ti-ads8688: Update buffer allocation for timestamps Date: Fri, 11 Jan 2019 13:57:07 -0600 Message-ID: <20190111195707.2086-3-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20190111195707.2086-1-dmurphy@ti.com> References: <20190111195707.2086-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 Per Jonathan Cameron, the buffer needs to allocate room for a 64 bit timestamp as well as the channels. Change the buffer to allocate this additional space. Fixes: 2a86487786b5c ("iio: adc: ti-ads8688: add trigger and buffer support") Signed-off-by: Dan Murphy --- v3 - Updated the buffer allocation definition I also dropped the device managed patch as I don't have time to invest in that code - https://lore.kernel.org/patchwork/patch/1023971/ v2 - New patch suggested change by maintainer - https://lore.kernel.org/patchwork/patch/1021048/ drivers/iio/adc/ti-ads8688.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index 184d686ebd99..8b4568edd5cb 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -41,6 +41,7 @@ #define ADS8688_VREF_MV 4096 #define ADS8688_REALBITS 16 +#define ADS8688_MAX_CHANNELS 8 /* * enum ads8688_range - ADS8688 reference voltage range @@ -385,7 +386,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) { struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; - u16 buffer[8]; + u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; int i, j = 0; for (i = 0; i < indio_dev->masklength; i++) {