From: Jonathan Cameron <jic23@cam.ac.uk>
To: linux-iio@vger.kernel.org
Cc: Device-drivers-devel@blackfin.uclinux.org,
manuel.stahl@iis.fraunhofer.de,
Jonathan Cameron <jic23@cam.ac.uk>
Subject: [PATCH 3/4] staging:iio:imu:adis16400: use strtobool for reset sysfs and don't assign unused tx members.
Date: Mon, 11 Jul 2011 16:58:06 +0100 [thread overview]
Message-ID: <1310399887-4049-4-git-send-email-jic23@cam.ac.uk> (raw)
In-Reply-To: <1310399887-4049-1-git-send-email-jic23@cam.ac.uk>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/imu/adis16400_core.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index f034330..75d4734 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -146,8 +146,6 @@ static int adis16400_spi_read_reg_16(struct iio_dev *indio_dev,
mutex_lock(&st->buf_lock);
st->tx[0] = ADIS16400_READ_REG(lower_reg_address);
st->tx[1] = 0;
- st->tx[2] = 0;
- st->tx[3] = 0;
spi_message_init(&msg);
spi_message_add_tail(&xfers[0], &msg);
@@ -236,17 +234,18 @@ static ssize_t adis16400_write_reset(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{
- struct iio_dev *indio_dev = dev_get_drvdata(dev);
+ bool val;
+ int ret;
- if (len < 1)
- return -1;
- switch (buf[0]) {
- case '1':
- case 'y':
- case 'Y':
- return adis16400_reset(indio_dev);
- }
- return -1;
+ ret = strtobool(buf, &val);
+ if (ret < 0)
+ return ret;
+ if (val)
+ ret = adis16400_reset(dev_get_drvdata(dev));
+ if (ret < 0)
+ return ret;
+
+ return len;
}
int adis16400_set_irq(struct iio_dev *indio_dev, bool enable)
--
1.7.3.4
next prev parent reply other threads:[~2011-07-11 15:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 15:58 [PATCH 0/4] ADIS16400 one big fix and some updates Jonathan Cameron
2011-07-11 15:58 ` [PATCH 1/4] staging:iio:imu fix missing register table index for some channels Jonathan Cameron
2011-07-13 11:03 ` Hennerich, Michael
2011-07-11 15:58 ` [PATCH 2/4] staging:iio:imu:adis16344 support Jonathan Cameron
2011-07-13 11:03 ` Hennerich, Michael
2011-09-23 14:45 ` Jonathan Cameron
2011-09-26 6:56 ` Hennerich, Michael
2011-07-11 15:58 ` Jonathan Cameron [this message]
2011-07-13 11:03 ` [PATCH 3/4] staging:iio:imu:adis16400: use strtobool for reset sysfs and don't assign unused tx members Hennerich, Michael
2011-07-11 15:58 ` [PATCH 4/4] staging:iio:imu:adis16400 remove now unused headers Jonathan Cameron
2011-07-13 11:04 ` Hennerich, Michael
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=1310399887-4049-4-git-send-email-jic23@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=Device-drivers-devel@blackfin.uclinux.org \
--cc=linux-iio@vger.kernel.org \
--cc=manuel.stahl@iis.fraunhofer.de \
/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).