From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Dimitris Papastamos <dp@opensource.wolfsonmicro.com>,
Michael Hennerich <michael.hennerich@analog.com>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org, drivers@analog.com
Subject: Re: [PATCH 7/7] staging:iio:dac: Add AD5380 driver
Date: Fri, 18 Nov 2011 10:08:40 +0100 [thread overview]
Message-ID: <4EC62098.9030406@metafoo.de> (raw)
In-Reply-To: <4EC56D7B.9080700@kernel.org>
On 11/17/2011 09:24 PM, Jonathan Cameron wrote:
> On 11/16/2011 03:28 PM, Lars-Peter Clausen wrote:
>> This patch adds support for the Analog Devices D5380, AD5381,
>> AD5382, AD5383, AD5384, AD5390, AD5391, AD5392 multi-channel
>> Digital to Analog Converters.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>>
>> ---
>> There should be no compile time dependencies to the regmap patches earlier in
>> this series, so this patch can be merged independently of it.
> Should probably have been a separate series! Doesn't matter for review
> though and I guess you justified some of the other patches with it.
>> ---
>> drivers/staging/iio/dac/Kconfig | 11 +
>> drivers/staging/iio/dac/Makefile | 1 +
>> drivers/staging/iio/dac/ad5380.c | 669 ++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 681 insertions(+), 0 deletions(-)
>> create mode 100644 drivers/staging/iio/dac/ad5380.c
>>[...]
>> +
>> +static ssize_t ad5380_write_powerdown_mode(struct device *dev,
>> + struct device_attribute *attr, const char *buf, size_t len)
>> +{
>> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
>> + struct ad5380_state *st = iio_priv(indio_dev);
>> + unsigned int i;
>> + int ret;
>> +
> Excess brackets for that for loop I think
I prefer to have them since the loop contains a multiple lines.
>> + for (i = 0; i < ARRAY_SIZE(ad5380_powerdown_modes); ++i) {
>> + if (sysfs_streq(buf, ad5380_powerdown_modes[i]))
>> + break;
>> + }
>> +
>> + if (i == ARRAY_SIZE(ad5380_powerdown_modes))
>> + return -EINVAL;
>> +
>> + ret = regmap_update_bits(st->regmap, AD5380_REG_SF_CTRL,
>> + 1 << AD5380_CTRL_PWR_DOWN_MODE_OFFSET,
>> + i << AD5380_CTRL_PWR_DOWN_MODE_OFFSET);
> Obviously both of these will be cleaner with it as a bit.
When writing this using BIT it would be i ? AD5380_CTRL_PWR_DOWN_MODE_BIT :
0... And also this is about semantics. The other bits are bits in the sense
of true/false. While this is an enumeration which just happens to have only
one bit. But I can change it, if you prefer using BIT here.
>> +
>> + return ret ? ret : len;
>> +}
>> +
> Not a comment on this driver, but we need to have a think about
> whether these will ever want to be controlled via in kernel
> interfaces and if so how the heck we are going to do it!
Yes, definitely. But I think it is best to discuss this in a separate thread.
>> +static IIO_DEVICE_ATTR(out_voltage_powerdown_mode,
>> + S_IRUGO | S_IWUSR,
>> + ad5380_read_powerdown_mode,
>> + ad5380_write_powerdown_mode, 0);
>> +
>> +static IIO_CONST_ATTR(out_voltage_powerdown_mode_available,
>> + "100kohm_to_gnd three_state");
>> +
>> +static struct attribute *ad5380_attributes[] = {
>> + &iio_dev_attr_out_voltage_powerdown.dev_attr.attr,
>> + &iio_dev_attr_out_voltage_powerdown_mode.dev_attr.attr,
>> + &iio_const_attr_out_voltage_powerdown_mode_available.dev_attr.attr,
>> + NULL,
>> +};
> [...]
>> +static const struct i2c_device_id ad5380_i2c_ids[] = {
>> + { "ad5380-3", ID_AD5380_3 },
>> + { "ad5380-5", ID_AD5380_5 },
>> + { "ad5381-3", ID_AD5381_3 },
>> + { "ad5381-5", ID_AD5381_5 },
>> + { "ad5382-3", ID_AD5382_3 },
>> + { "ad5382-5", ID_AD5382_5 },
>> + { "ad5383-3", ID_AD5383_3 },
>> + { "ad5383-5", ID_AD5383_5 },
>> + { "ad5390-3", ID_AD5380_3 },
>> + { "ad5390-5", ID_AD5380_5 },
>> + { "ad5391-3", ID_AD5381_3 },
>> + { "ad5391-5", ID_AD5381_5 },
>> + { "ad5392-3", ID_AD5382_3 },
>> + { "ad5392-5", ID_AD5382_5 },
> I'm guessing you defined the ID_AD5392 etc for a reason?
Ooops, yes. Good catch.
Thanks for the review.
next prev parent reply other threads:[~2011-11-18 9:08 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 15:28 [PATCH 1/7] regmap: Move initialization of regcache related fields to regcache_init Lars-Peter Clausen
2011-11-16 15:28 ` [PATCH 2/7] regmap: Make reg_config reg_defaults const Lars-Peter Clausen
2011-11-16 16:13 ` Mark Brown
2011-11-16 16:23 ` Lars-Peter Clausen
2011-11-16 16:24 ` Mark Brown
2011-11-16 16:36 ` Lars-Peter Clausen
2011-11-16 16:39 ` Mark Brown
2011-11-16 16:50 ` Lars-Peter Clausen
2011-11-16 16:51 ` Mark Brown
2011-11-16 17:01 ` Lars-Peter Clausen
2011-11-16 17:09 ` Mark Brown
2011-11-16 17:20 ` Lars-Peter Clausen
2011-11-16 17:26 ` Mark Brown
2011-11-16 17:35 ` Mark Brown
2011-11-16 15:28 ` [PATCH 3/7] regmap: Properly round cache_word_size Lars-Peter Clausen
2011-11-16 16:14 ` Mark Brown
2011-11-16 16:25 ` Lars-Peter Clausen
2011-11-16 15:28 ` [PATCH 4/7] regmap: Try cached read before checking if a hardware read is possible Lars-Peter Clausen
2011-11-16 17:35 ` Mark Brown
2011-11-16 15:28 ` [PATCH 5/7] regmap: Check if a register is writable instead of readable in regcache_read Lars-Peter Clausen
2011-11-16 16:16 ` Mark Brown
2011-11-16 16:34 ` Lars-Peter Clausen
2011-11-16 16:38 ` Mark Brown
2011-11-16 16:52 ` Lars-Peter Clausen
2011-11-16 16:56 ` Mark Brown
2011-11-16 17:09 ` Lars-Peter Clausen
2011-11-16 17:12 ` Mark Brown
2011-11-16 17:15 ` Lars-Peter Clausen
2011-11-16 17:22 ` Mark Brown
2011-11-16 15:28 ` [PATCH 6/7] regmap: Add support for 10/14 register formating Lars-Peter Clausen
2011-11-16 17:37 ` Mark Brown
2011-11-16 15:28 ` [PATCH 7/7] staging:iio:dac: Add AD5380 driver Lars-Peter Clausen
2011-11-16 16:56 ` Lars-Peter Clausen
2011-11-17 20:24 ` Jonathan Cameron
2011-11-18 9:08 ` Lars-Peter Clausen [this message]
2011-11-18 9:51 ` J.I. Cameron
2011-11-16 17:35 ` [PATCH 1/7] regmap: Move initialization of regcache related fields to regcache_init Mark Brown
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=4EC62098.9030406@metafoo.de \
--to=lars@metafoo.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=dp@opensource.wolfsonmicro.com \
--cc=drivers@analog.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
/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).