Commit 700e63da authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200831090813.78841-3-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 938d1b38
...@@ -289,8 +289,7 @@ static int bma220_remove(struct spi_device *spi) ...@@ -289,8 +289,7 @@ static int bma220_remove(struct spi_device *spi)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int bma220_suspend(struct device *dev) static int bma220_suspend(struct device *dev)
{ {
struct bma220_data *data = struct bma220_data *data = iio_priv(dev_get_drvdata(dev));
iio_priv(spi_get_drvdata(to_spi_device(dev)));
/* The chip can be suspended/woken up by a simple register read. */ /* The chip can be suspended/woken up by a simple register read. */
return bma220_read_reg(data->spi_device, BMA220_REG_SUSPEND); return bma220_read_reg(data->spi_device, BMA220_REG_SUSPEND);
...@@ -298,8 +297,7 @@ static int bma220_suspend(struct device *dev) ...@@ -298,8 +297,7 @@ static int bma220_suspend(struct device *dev)
static int bma220_resume(struct device *dev) static int bma220_resume(struct device *dev)
{ {
struct bma220_data *data = struct bma220_data *data = iio_priv(dev_get_drvdata(dev));
iio_priv(spi_get_drvdata(to_spi_device(dev)));
return bma220_read_reg(data->spi_device, BMA220_REG_SUSPEND); return bma220_read_reg(data->spi_device, BMA220_REG_SUSPEND);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment