Skip to content

Commit ffb42e6

Browse files
andy-shevsravnborg
authored andcommitted
drm/tiny/repaper: Make driver OF-independent
There is one OF call in the driver that limits its area of use. Replace it to generic device_get_match_data() and get rid of OF dependency. While here, cast SPI driver data to certain enumerator type. Cc: Noralf Trønnes <noralf@tronnes.org> Cc: dri-devel@lists.freedesktop.org Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Lechner <david@lechnology.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200131204923.48928-1-andriy.shevchenko@linux.intel.com
1 parent cdb702a commit ffb42e6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎drivers/gpu/drm/tiny/repaper.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <linux/dma-buf.h>
1818
#include <linux/gpio/consumer.h>
1919
#include <linux/module.h>
20-
#include <linux/of_device.h>
20+
#include <linux/property.h>
2121
#include <linux/sched/clock.h>
2222
#include <linux/spi/spi.h>
2323
#include <linux/thermal.h>
@@ -39,6 +39,7 @@
3939
#define REPAPER_RID_G2_COG_ID 0x12
4040

4141
enum repaper_model {
42+
/* 0 is reserved to avoid clashing with NULL */
4243
E1144CS021 = 1,
4344
E1190CS021,
4445
E2200CS021,
@@ -986,21 +987,21 @@ static int repaper_probe(struct spi_device *spi)
986987
{
987988
const struct drm_display_mode *mode;
988989
const struct spi_device_id *spi_id;
989-
const struct of_device_id *match;
990990
struct device *dev = &spi->dev;
991991
enum repaper_model model;
992992
const char *thermal_zone;
993993
struct repaper_epd *epd;
994994
size_t line_buffer_size;
995995
struct drm_device *drm;
996+
const void *match;
996997
int ret;
997998

998-
match = of_match_device(repaper_of_match, dev);
999+
match = device_get_match_data(dev);
9991000
if (match) {
1000-
model = (enum repaper_model)match->data;
1001+
model = (enum repaper_model)match;
10011002
} else {
10021003
spi_id = spi_get_device_id(spi);
1003-
model = spi_id->driver_data;
1004+
model = (enum repaper_model)spi_id->driver_data;
10041005
}
10051006

10061007
/* The SPI device is used to allocate dma memory */

0 commit comments

Comments
 (0)