From 6ef6fd88a52abf637ffb0b7687a7694f260a5af2 Mon Sep 17 00:00:00 2001 From: James Ward Date: Tue, 11 Jul 2023 02:42:51 -0400 Subject: [PATCH] fix: pull gpio after we initialize the panel struct --- drm_iface.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drm_iface.c b/drm_iface.c index 9f08d3e..43686e8 100644 --- a/drm_iface.c +++ b/drm_iface.c @@ -527,6 +527,15 @@ int drm_probe(struct spi_device *spi) } } + // Allocate panel storage + panel = devm_drm_dev_alloc(dev, &sharp_memory_driver, + struct sharp_memory_panel, drm); + if (IS_ERR(panel)) { + printk(KERN_ERR "sharp_memory: failed to allocate panel\n"); + return PTR_ERR(panel); + } + g_panel = panel; + // Initialize GPIO panel->gpio_scs = devm_gpiod_get_optional(dev, "scs", GPIOD_OUT_LOW); if (IS_ERR(panel->gpio_scs)) @@ -540,15 +549,6 @@ int drm_probe(struct spi_device *spi) if (IS_ERR(panel->gpio_vcom)) return dev_err_probe(dev, PTR_ERR(panel->gpio_vcom), "Failed to get GPIO 'vcom'\n"); - // Allocate panel storage - panel = devm_drm_dev_alloc(dev, &sharp_memory_driver, - struct sharp_memory_panel, drm); - if (IS_ERR(panel)) { - printk(KERN_ERR "sharp_memory: failed to allocate panel\n"); - return PTR_ERR(panel); - } - g_panel = panel; - // Initalize DRM mode drm = &panel->drm; ret = drmm_mode_config_init(drm);