summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-08-31 12:08:08 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-09-03 19:40:59 +0100
commit700e63dadacdb7eee04650b6e8c66824d585aaf3 (patch)
tree1874159b7530ed0d94191d322e6dc08190db6cdf /drivers
parent938d1b3873fc2ceee4569042852e54d9deeb9ec1 (diff)
iio: accel: bma220: Use dev_get_drvdata() directly
Instead of using to_spi_dev() + spi_get_drvdata(), use dev_get_drvdata() to make code simpler. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20200831090813.78841-3-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/accel/bma220_spi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
index 4774668ea7dc..cddd45c38ecf 100644
--- a/drivers/iio/accel/bma220_spi.c
+++ b/drivers/iio/accel/bma220_spi.c
@@ -289,8 +289,7 @@ static int bma220_remove(struct spi_device *spi)
#ifdef CONFIG_PM_SLEEP
static int bma220_suspend(struct device *dev)
{
- struct bma220_data *data =
- iio_priv(spi_get_drvdata(to_spi_device(dev)));
+ struct bma220_data *data = iio_priv(dev_get_drvdata(dev));
/* The chip can be suspended/woken up by a simple register read. */
return bma220_read_reg(data->spi_device, BMA220_REG_SUSPEND);
@@ -298,8 +297,7 @@ static int bma220_suspend(struct device *dev)
static int bma220_resume(struct device *dev)
{
- struct bma220_data *data =
- iio_priv(spi_get_drvdata(to_spi_device(dev)));
+ struct bma220_data *data = iio_priv(dev_get_drvdata(dev));
return bma220_read_reg(data->spi_device, BMA220_REG_SUSPEND);
}