All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zubair Lutfullah <zubair.lutfullah@gmail.com>
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	[thread overview]
Message-ID: <1379571876-12420-3-git-send-email-zubair.lutfullah@gmail.com> (raw)
In-Reply-To: <1379571876-12420-1-git-send-email-zubair.lutfullah@gmail.com>

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 <zubair.lutfullah@gmail.com>
---
 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;
 		}
 	}
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-09-19  6:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19  6:24 [PATCH V11 0/3] iio: input: ti_am335x_adc: Add continuous sampling support Zubair Lutfullah
2013-09-19  6:24 ` [PATCH 1/3] input: ti_am335x_tsc: Enable shared IRQ for TSC Zubair Lutfullah
2013-09-19  6:24 ` Zubair Lutfullah [this message]
2013-09-19  6:24 ` [PATCH 3/3] iio: ti_am335x_adc: Add continuous sampling support Zubair Lutfullah
2013-09-21 18:28   ` Jonathan Cameron
2013-09-22  4:46     ` Zubair Lutfullah :
2013-09-22  4:46       ` Zubair Lutfullah :
2013-09-21 10:52 ` [PATCH V11 0/3] iio: input: " Jonathan Cameron
2013-09-22  4:42   ` Zubair Lutfullah :
2013-09-22  4:42     ` Zubair Lutfullah :

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379571876-12420-3-git-send-email-zubair.lutfullah@gmail.com \
    --to=zubair.lutfullah@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.