linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org,
	device-drivers-devel@blackfin.uclinux.org, drivers@analog.com,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH v2 02/11] staging:iio:dac:ad5446: Remove duplicated write sample functions
Date: Tue, 24 Apr 2012 18:49:32 +0200	[thread overview]
Message-ID: <1335286181-20474-2-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1335286181-20474-1-git-send-email-lars@metafoo.de>

AD5620_LOAD and AD5446_LOAD are both 0, so all these three functions are
identical and we can replace them with only one.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/dac/ad5446.c |   34 ++++++++++++----------------------
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c
index de796c2..0da5c6c 100644
--- a/drivers/staging/iio/dac/ad5446.c
+++ b/drivers/staging/iio/dac/ad5446.c
@@ -26,19 +26,9 @@
 
 static void ad5446_store_sample(struct ad5446_state *st, unsigned val)
 {
-	st->data.d16 = cpu_to_be16(AD5446_LOAD | val);
-}
-
-static void ad5542_store_sample(struct ad5446_state *st, unsigned val)
-{
 	st->data.d16 = cpu_to_be16(val);
 }
 
-static void ad5620_store_sample(struct ad5446_state *st, unsigned val)
-{
-	st->data.d16 = cpu_to_be16(AD5620_LOAD | val);
-}
-
 static void ad5660_store_sample(struct ad5446_state *st, unsigned val)
 {
 	val |= AD5660_LOAD;
@@ -174,61 +164,61 @@ static const struct ad5446_chip_info ad5446_chip_info_tbl[] = {
 	},
 	[ID_AD5541A] = {
 		.channel = AD5446_CHANNEL(16, 16, 0),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 	},
 	[ID_AD5542A] = {
 		.channel = AD5446_CHANNEL(16, 16, 0),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 	},
 	[ID_AD5543] = {
 		.channel = AD5446_CHANNEL(16, 16, 0),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 	},
 	[ID_AD5512A] = {
 		.channel = AD5446_CHANNEL(12, 16, 4),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 	},
 	[ID_AD5553] = {
 		.channel = AD5446_CHANNEL(14, 16, 0),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 	},
 	[ID_AD5601] = {
 		.channel = AD5446_CHANNEL(8, 16, 6),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5611] = {
 		.channel = AD5446_CHANNEL(10, 16, 4),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5621] = {
 		.channel = AD5446_CHANNEL(12, 16, 2),
-		.store_sample = ad5542_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5620_2500] = {
 		.channel = AD5446_CHANNEL(12, 16, 2),
 		.int_vref_mv = 2500,
-		.store_sample = ad5620_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5620_1250] = {
 		.channel = AD5446_CHANNEL(12, 16, 2),
 		.int_vref_mv = 1250,
-		.store_sample = ad5620_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5640_2500] = {
 		.channel = AD5446_CHANNEL(14, 16, 0),
 		.int_vref_mv = 2500,
-		.store_sample = ad5620_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5640_1250] = {
 		.channel = AD5446_CHANNEL(14, 16, 0),
 		.int_vref_mv = 1250,
-		.store_sample = ad5620_store_sample,
+		.store_sample = ad5446_store_sample,
 		.store_pwr_down = ad5620_store_pwr_down,
 	},
 	[ID_AD5660_2500] = {
-- 
1.7.9.5

  reply	other threads:[~2012-04-24 16:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 16:49 [PATCH v2 01/11] staging:iio:dac:ad5446: Do not exit powerdown when writing a sample Lars-Peter Clausen
2012-04-24 16:49 ` Lars-Peter Clausen [this message]
2012-04-24 16:49 ` [PATCH v2 03/11] staging:iio:dac:ad5446: Fix 24bit transfers Lars-Peter Clausen
2012-04-24 16:55   ` Jonathan Cameron
2012-04-24 16:49 ` [PATCH v2 04/11] staging:iio:dac:ad5446: Remove unused struct field Lars-Peter Clausen
2012-04-24 16:49 ` [PATCH v2 05/11] staging:iio:dac:ad5446: Do not check for individual chip ids in probe Lars-Peter Clausen
2012-04-24 16:49 ` [PATCH v2 06/11] staging:iio:dac:ad5446: Remove duplicated chip_info entries Lars-Peter Clausen
2012-04-24 16:49 ` [PATCH v2 07/11] staging:iio:dac:ad5446: Convert to extended channel attributes Lars-Peter Clausen
2012-04-24 16:49 ` [PATCH v2 08/11] staging:iio:dac:ad5446: Consolidate store_sample and store_pwr_down functions Lars-Peter Clausen
2012-04-24 16:56   ` Jonathan Cameron
2012-04-24 16:49 ` [PATCH v2 09/11] staging:iio:dac:ad5446: Return cached value for 'raw' attribute Lars-Peter Clausen
2012-04-24 16:56   ` Jonathan Cameron
2012-04-24 16:49 ` [PATCH v2 10/11] staging:iio:dac:ad5446: Add support for the AD5662 Lars-Peter Clausen
2012-04-24 16:57   ` Jonathan Cameron
2012-04-24 16:49 ` [PATCH v2 11/11] staging:iio:dac:ad5446: Update Kconfig entry Lars-Peter Clausen
2012-04-24 16:58   ` Jonathan Cameron

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=1335286181-20474-2-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=drivers@analog.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).