Use to_spi_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/spi/spi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 19659c4..2ae1588 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -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 = {         \
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to