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>
This commit is contained in:
parent
938d1b3873
commit
700e63dada
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue