Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Andy Shevchenko <[email protected]>
---
v2: used correct parameter
 drivers/gpu/drm/tiny/repaper.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index c8270591afc7..3885a57600c0 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -941,24 +941,14 @@ MODULE_DEVICE_TABLE(spi, repaper_id);
 static int repaper_probe(struct spi_device *spi)
 {
        const struct drm_display_mode *mode;
-       const struct spi_device_id *spi_id;
        struct device *dev = &spi->dev;
        enum repaper_model model;
        const char *thermal_zone;
        struct repaper_epd *epd;
        size_t line_buffer_size;
        struct drm_device *drm;
-       const void *match;
        int ret;
 
-       match = device_get_match_data(dev);
-       if (match) {
-               model = (enum repaper_model)(uintptr_t)match;
-       } else {
-               spi_id = spi_get_device_id(spi);
-               model = (enum repaper_model)spi_id->driver_data;
-       }
-
        /* The SPI device is used to allocate dma memory */
        if (!dev->coherent_dma_mask) {
                ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
@@ -1023,6 +1013,7 @@ static int repaper_probe(struct spi_device *spi)
                }
        }
 
+       model = (enum repaper_model)(uintptr_t)spi_get_device_match_data(spi);
        switch (model) {
        case E1144CS021:
                mode = &repaper_e1144cs021_mode;
-- 
2.50.1

Reply via email to