Skip to contentSkip to conversation

drm/repaper: simplify with spi_get_device_match_data()

PATCH New Andy Shevchenko 1 participant 1 message May 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/repaper: simplify with spi_get_device_match_data()

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

---
v2: used correct parameter

 drivers/gpu/drm/tiny/repaper.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/gpu/drm/tiny/repaper.c +1 -10
index c8270591afc7..3885a57600c0 100644
@@ -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;
Signature · 1 line
2.50.1