From patchwork Thu Sep 19 06:24:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zubair Lutfullah X-Patchwork-Id: 2909991 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A9FEABFF05 for ; Thu, 19 Sep 2013 06:25:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E616220425 for ; Thu, 19 Sep 2013 06:25:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E01FB20424 for ; Thu, 19 Sep 2013 06:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752880Ab3ISGZC (ORCPT ); Thu, 19 Sep 2013 02:25:02 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:47542 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752606Ab3ISGY4 (ORCPT ); Thu, 19 Sep 2013 02:24:56 -0400 Received: by mail-wi0-f173.google.com with SMTP id hq15so7450490wib.0 for ; Wed, 18 Sep 2013 23:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wD/frYsPrPkGuOkbPdjqILPPbrKCVONC4KiRQ1Hs+Jg=; b=ufCc3Hhcpznrz4GHfw7JZg8YXIEwS6zsCvBoP9L5Te6JPGghbCPTx+mGYv28OSkS8L sOnOVZt/Puthj/b4cc3P2MBVumpJ2IIWPJPQj3rL0bs6nnfLE5dS16XaNqfkvCMt8jFy Fs4xwP+/C6wZoRIYU9isGGSnb+42PWgru81hxOk38ZhD4yo7LoVDXMKice8+D2iXTg8E +wycwTBeETzFYT2l5B5tC3cu83F2DVTwL/fFB5BtEGWPwuu+/WWHu+6dP4CxhChHdgsY wIFif2cZpGEh4tvH45EAHrji1vxrKlD8TilwPm5V1xLqCkf+qvmDWwHyuwEV9OmTnAjL G2Aw== X-Received: by 10.180.101.164 with SMTP id fh4mr10309719wib.44.1379571894009; Wed, 18 Sep 2013 23:24:54 -0700 (PDT) Received: from localhost.localdomain ([182.185.82.209]) by mx.google.com with ESMTPSA id li9sm7104429wic.4.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 23:24:53 -0700 (PDT) From: Zubair Lutfullah To: jic23@cam.ac.uk, dmitry.torokhov@gmail.com Cc: linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, gregkh@linuxfoundation.org, zubair.lutfullah@gmail.com Subject: [PATCH 2/3] iio: ti_am335x_adc: optimize memory usage Date: Thu, 19 Sep 2013 11:24:34 +0500 Message-Id: <1379571876-12420-3-git-send-email-zubair.lutfullah@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379571876-12420-1-git-send-email-zubair.lutfullah@gmail.com> References: <1379571876-12420-1-git-send-email-zubair.lutfullah@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 12 bit ADC data is stored in 32 bits of storage. Change from u32 to u16 to reduce wasted memory. Signed-off-by: Zubair Lutfullah --- drivers/iio/adc/ti_am335x_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index a952538..ebe93eb 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -122,7 +122,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels) chan->datasheet_name = chan_name_ain[chan->channel]; chan->scan_type.sign = 'u'; chan->scan_type.realbits = 12; - chan->scan_type.storagebits = 32; + chan->scan_type.storagebits = 16; } indio_dev->channels = chan_array; @@ -186,7 +186,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, if (stepid == map_val) { read = read & FIFOREAD_DATA_MASK; found = true; - *val = read; + *val = (u16) read; } }