diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-11 17:58:02 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-11 17:58:02 (GMT) |
commit | ad463ac42771a0bb8a706cf8a985788fe5f5c1c6 (patch) | |
tree | d8585ea49108c4d73af97b75b3ffdc0d094b68ee /drivers/staging/iio/meter/ade7758_core.c | |
parent | 5305d746054d1c73e7e9263b25189dedefb2dc01 (diff) | |
parent | 09a642b78523e9f4c5970c806ad218aa3de31551 (diff) | |
download | linux-fsl-qoriq-ad463ac42771a0bb8a706cf8a985788fe5f5c1c6.tar.xz |
Merge tag 'iio-for-3.9d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
"4th set of IIO new drivers cleanups and fixes for the 3.9 cycle
+ a new spi helper function.
1) Introduce spi_sync_transfer and use it within IIO. Originally
it was envisioned that this nice little boilerplate replacement
would go through the spi tree, but Grant Likely stated he'd
prefer we take it through IIO as the example usecases were all
in IIO (and are also in this pull request). Note that given
their may have been some unresolved elements related to the
coccinelle element of the patch, that has been stripped out
and will doubtlessly follow at a later date (along with
lots of other patches for drivers elsewhere in the tree).
2) New Invensense MPU6050 driver. This is stripped down to pretty
much the basics from the original submission with the intent
to build up all the fancy bits in an incremental (and hence
reviewable fashion). It's been through a good few revisions
so nice to finally merge this.
3) Change to iio_channel_get api to simplify device tree based
mappings. The actual mappings are currently under review.
4) Build fixes for !CONFIG_IIO_TRIGGER in the st_sensors driver.
This one snuck past during review and testing but got picked
up by Randy Dunlap in a randconfig build.
5) Some max1363 cleanups and enhancements.
6) Some comment fixes to make them coherent and comprehensible.
7) Trivial build warning fix in mxs-lradc"
Diffstat (limited to 'drivers/staging/iio/meter/ade7758_core.c')
-rw-r--r-- | drivers/staging/iio/meter/ade7758_core.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 3454e51..53c68dc 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -47,7 +47,6 @@ static int ade7758_spi_write_reg_16(struct device *dev, u16 value) { int ret; - struct spi_message msg; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7758_state *st = iio_priv(indio_dev); struct spi_transfer xfers[] = { @@ -63,9 +62,7 @@ static int ade7758_spi_write_reg_16(struct device *dev, st->tx[1] = (value >> 8) & 0xFF; st->tx[2] = value & 0xFF; - spi_message_init(&msg); - spi_message_add_tail(xfers, &msg); - ret = spi_sync(st->us, &msg); + ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); mutex_unlock(&st->buf_lock); return ret; @@ -76,7 +73,6 @@ static int ade7758_spi_write_reg_24(struct device *dev, u32 value) { int ret; - struct spi_message msg; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7758_state *st = iio_priv(indio_dev); struct spi_transfer xfers[] = { @@ -93,9 +89,7 @@ static int ade7758_spi_write_reg_24(struct device *dev, st->tx[2] = (value >> 8) & 0xFF; st->tx[3] = value & 0xFF; - spi_message_init(&msg); - spi_message_add_tail(xfers, &msg); - ret = spi_sync(st->us, &msg); + ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); mutex_unlock(&st->buf_lock); return ret; @@ -105,7 +99,6 @@ int ade7758_spi_read_reg_8(struct device *dev, u8 reg_address, u8 *val) { - struct spi_message msg; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7758_state *st = iio_priv(indio_dev); int ret; @@ -128,10 +121,7 @@ int ade7758_spi_read_reg_8(struct device *dev, st->tx[0] = ADE7758_READ_REG(reg_address); st->tx[1] = 0; - spi_message_init(&msg); - spi_message_add_tail(&xfers[0], &msg); - spi_message_add_tail(&xfers[1], &msg); - ret = spi_sync(st->us, &msg); + ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->us->dev, "problem when reading 8 bit register 0x%02X", reg_address); @@ -148,7 +138,6 @@ static int ade7758_spi_read_reg_16(struct device *dev, u8 reg_address, u16 *val) { - struct spi_message msg; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7758_state *st = iio_priv(indio_dev); int ret; @@ -173,10 +162,7 @@ static int ade7758_spi_read_reg_16(struct device *dev, st->tx[1] = 0; st->tx[2] = 0; - spi_message_init(&msg); - spi_message_add_tail(&xfers[0], &msg); - spi_message_add_tail(&xfers[1], &msg); - ret = spi_sync(st->us, &msg); + ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X", reg_address); @@ -194,7 +180,6 @@ static int ade7758_spi_read_reg_24(struct device *dev, u8 reg_address, u32 *val) { - struct spi_message msg; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7758_state *st = iio_priv(indio_dev); int ret; @@ -219,10 +204,7 @@ static int ade7758_spi_read_reg_24(struct device *dev, st->tx[2] = 0; st->tx[3] = 0; - spi_message_init(&msg); - spi_message_add_tail(&xfers[0], &msg); - spi_message_add_tail(&xfers[1], &msg); - ret = spi_sync(st->us, &msg); + ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->us->dev, "problem when reading 24 bit register 0x%02X", reg_address); |