spi: use to_spi_device
authorGeliang Tang <geliangtang@163.com>
Tue, 22 Dec 2015 16:18:41 +0000 (00:18 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 23 Dec 2015 12:15:41 +0000 (12:15 +0000)
Use to_spi_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index e2415be209d5a77e9224add30db37d65244fabda..70828521e6bb66c17758437fd98f13660ca0ab74 100644 (file)
@@ -84,8 +84,7 @@ static ssize_t spi_device_##field##_show(struct device *dev,          \
                                         struct device_attribute *attr, \
                                        char *buf)                      \
 {                                                                      \
-       struct spi_device *spi = container_of(dev,                      \
-                                             struct spi_device, dev);  \
+       struct spi_device *spi = to_spi_device(dev);                    \
        return spi_statistics_##field##_show(&spi->statistics, buf);    \
 }                                                                      \
 static struct device_attribute dev_attr_spi_device_##field = {         \