diff mbox series

[v1,3/8] iio: accel: bma220: Use dev_get_drvdata() directly

Message ID 20200831090813.78841-3-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/8] iio: accel: bma220: Fix returned codes from bma220_init(), bma220_deinit() | expand

Commit Message

Andy Shevchenko Aug. 31, 2020, 9:08 a.m. UTC
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>
---
 drivers/iio/accel/bma220_spi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
index cb634a3a995d..529c88fc2949 100644
--- a/drivers/iio/accel/bma220_spi.c
+++ b/drivers/iio/accel/bma220_spi.c
@@ -291,8 +291,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);
@@ -300,8 +299,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);
 }