projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
iio: gyro: adis16130: Use devm_iio_device_register
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
iio
/
gyro
/
adis16130.c
diff --git
a/drivers/iio/gyro/adis16130.c
b/drivers/iio/gyro/adis16130.c
index ac66fc184042e4aa7e23545555321521a032df31..8d08c7ed1ea64d554f9414eb15c8ad41303c3381 100644
(file)
--- a/
drivers/iio/gyro/adis16130.c
+++ b/
drivers/iio/gyro/adis16130.c
@@
-47,7
+47,6
@@
static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val)
{
int ret;
struct adis16130_state *st = iio_priv(indio_dev);
{
int ret;
struct adis16130_state *st = iio_priv(indio_dev);
- struct spi_message msg;
struct spi_transfer xfer = {
.tx_buf = st->buf,
.rx_buf = st->buf,
struct spi_transfer xfer = {
.tx_buf = st->buf,
.rx_buf = st->buf,
@@
-59,10
+58,7
@@
static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val)
st->buf[0] = ADIS16130_CON_RD | reg_addr;
st->buf[1] = st->buf[2] = st->buf[3] = 0;
st->buf[0] = ADIS16130_CON_RD | reg_addr;
st->buf[1] = st->buf[2] = st->buf[3] = 0;
- spi_message_init(&msg);
- spi_message_add_tail(&xfer, &msg);
- ret = spi_sync(st->us, &msg);
-
+ ret = spi_sync_transfer(st->us, &xfer, 1);
if (ret == 0)
*val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3];
mutex_unlock(&st->buf_lock);
if (ret == 0)
*val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3];
mutex_unlock(&st->buf_lock);
@@
-103,7
+99,6
@@
static int adis16130_read_raw(struct iio_dev *indio_dev,
default:
return -EINVAL;
}
default:
return -EINVAL;
}
- break;
case IIO_CHAN_INFO_OFFSET:
switch (chan->type) {
case IIO_ANGL_VEL:
case IIO_CHAN_INFO_OFFSET:
switch (chan->type) {
case IIO_ANGL_VEL:
@@
-115,7
+110,6
@@
static int adis16130_read_raw(struct iio_dev *indio_dev,
default:
return -EINVAL;
}
default:
return -EINVAL;
}
- break;
}
return -EINVAL;
}
return -EINVAL;
@@
-167,13
+161,7
@@
static int adis16130_probe(struct spi_device *spi)
indio_dev->info = &adis16130_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &adis16130_info;
indio_dev->modes = INDIO_DIRECT_MODE;
- return iio_device_register(indio_dev);
-}
-
-static int adis16130_remove(struct spi_device *spi)
-{
- iio_device_unregister(spi_get_drvdata(spi));
- return 0;
+ return devm_iio_device_register(&spi->dev, indio_dev);
}
static struct spi_driver adis16130_driver = {
}
static struct spi_driver adis16130_driver = {
@@
-182,7
+170,6
@@
static struct spi_driver adis16130_driver = {
.owner = THIS_MODULE,
},
.probe = adis16130_probe,
.owner = THIS_MODULE,
},
.probe = adis16130_probe,
- .remove = adis16130_remove,
};
module_spi_driver(adis16130_driver);
};
module_spi_driver(adis16130_driver);