From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D38834AE8B2 for ; Tue, 15 Sep 2026 15:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789487227; cv=none; b=cxdVRB/9fk5/71iQbMNK6K3FlSVMvxbueYo/ikGWI9RfENKf1E0s+q3ORCFuZPS5VEvIDMbnjltQCppXkWfsxfJlLqCHLQzmc8mh3J9p+NhMBoW7sIgdC619lJPIy5MMMplUExmGpMPXYVVMHtJ2dZmzCoPvUwEizNImQDjmWWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789487227; c=relaxed/simple; bh=rLGSnt01pkV/qpgbMPc32jphznOsqYG0nK8jRGVoTH4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GrzIvSj+0tvNo+efc+2U+ZxQU20dv3zctFRWhVde83r0xgLLh0Q7IjeKA2o05c2VRYV0eIWR6hDNdrX7rB9lttXOIfWPrdNTSOjeHyRY2xdeiakqBzs/c3V9wGcJZk8qIzna/c1nn9Gsriu3muwi6nLKZUgcIaqvERClIYr6XoM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C5xkMmsv; arc=none smtp.client-ip=74.125.225.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C5xkMmsv" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-4843c3ea1f6so1620526f8f.0 for ; Tue, 15 Sep 2026 08:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789487223; x=1790092023; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uzCg6OBZUcUYAx3OaMdOACh0u4h8Pv6g2Vq3JQp8FD4=; b=C5xkMmsvlt+eVMIWELPWNMtDYxRCRTxinl3xzUrDNWqSNqmoLpJiSTXghig3Od5qMz qH/g65RlKQ1/W9siCgafJ7bCWKcUFMbWLG7Lk5Gz6I6+ey2L03BMKJbWk8ykVSQD/Lrs w1kRCik4oh03OrstV6Fy6DAHXTqU8BmkiNYKkXb1Ids3GpT/zDvvleN77qYz21BKB7kh qGYe/wmOo7uo5CnIj8NRE9Rxleuo8Mz3K2QAUk4UcEs5/eBsqSwGHPVA3j1rfksOKkIK JNnVi0ysz6P9K78lRD1AAfIQAuwadfQwoy2p1osJ2wdDMVmc2LLIznwsh/0bvds4PJ/5 +EAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789487223; x=1790092023; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=uzCg6OBZUcUYAx3OaMdOACh0u4h8Pv6g2Vq3JQp8FD4=; b=aQL9vq/p7reIUMKMc0VNX2ZROdVN9KD9A0ha/x3WgqHVuHpVD96ClWcaXCjnLgNzbA tK5HHmDbfd71AOdaApFRhUFluq/x439Od22tXD+0lNuNfRVOxIxriigAa7Or28X9v8ps fc6dBrsPzmTfAyTodyqnWXMEBNQ7q1ddFoXHsKxf5c/KxY6Xog08G9IaNrO1g/mKosb/ WFRZpJaX/AHEq8oNFF1IeQVFanT4FJUoZoqi7z58PEv0yJHUc+WHTSRoNrYfyGzwRzVe S5khPCYYzXjg5fzZD7R48gipgrW7SWMTD8wq6fBrfP/532LWosGt/N6YEVRvKYk1choT QvAQ== X-Forwarded-Encrypted: i=1; AKwUvBxfBC3FZ9Evtyn8eMlvY+X7MGJEJx6K6nk/bLAZNJTmejCy5PlRKauG+DxUdzq/1uxXYYHUnWHv06xNC2Y=@vger.kernel.org X-Gm-Message-State: AFuF++n9P8J79e37t0MG7UwMKFTScwx+ZVhWADANgR/thfn64YLtyF6i v1GQ8dUo7AM4Gukt/C//ZuGB772kac/NMwynbeJSk192MPu49EKVk8/G X-Gm-Gg: AYBFou2OaGgaAOttam9W8swMoSXjayi/cLhyoKG4r63WTZQqGYP+3eWMBfWyj/7lWXw Y+feiftF3Jbruf3MtYUPpDejQH4scvlrl63d6+tUbSk0lt4HzefYsGgzSBHN+gCrTIy8QPim2/4 VCd45TKWRUhnK2oLC/ted7yfpdGUZX7M93whE7sy2PTdJILeHTxSL66q9dnRmxl89Kur8pT3Yeu GV1N9k5jN4Yg0Ul6vcvOucZQl9GuzgroDEwK0g1CL3UjYETunn4Tiamytr3Hlo5VZYkA2I1MLvs 1foxE7sBMHjclkshBqKusvnTwT+ompdwy+uVXuyJE9zIf7GtmTTsEJ6Pg8EQt3iemWO2kxYupKS RJCDuSHSfXoiiQQvzutngdJeyZ+BNwCflfIo8cHOSz5SPsTy9+/dWg9/CjzOeMnKCBqO0YcsZhf IHlg9ejqoJ0ne9q4E0myeJk+L5LzzQQLIBNqCXgf7xUgbyd1KF681ifADSBDHlrGKwJq606e7YD 76TArYbvk3A4RbUg2PqHiqqJwMRv/66Ydk= X-Received: by 2002:a5d:6f17:0:b0:486:f980:2367 with SMTP id ffacd0b85a97d-48702b6f168mr9963505f8f.48.1789487222696; Tue, 15 Sep 2026 08:47:02 -0700 (PDT) Received: from osama.. ([156.223.70.89]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb33fc02sm34160468f8f.16.2026.09.15.08.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 08:47:02 -0700 (PDT) From: Osama Abdelkader To: luca.ceresoli@bootlin.com, Linus Walleij , Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Cristian Cozzolino , Sumit Semwal , Krzysztof Kozlowski , Robert Chiras , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Osama Abdelkader Subject: [PATCH v6 2/3] drm/panel: Use managed helpers in Novatek and Raydium panels Date: Tue, 15 Sep 2026 17:46:39 +0200 Message-ID: <20260915154644.104460-3-osama.abdelkader@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260915154644.104460-1-osama.abdelkader@gmail.com> References: <20260915154644.104460-1-osama.abdelkader@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use the managed MIPI DSI attach and panel add helpers in Novatek and Raydium panel drivers and drop the corresponding manual detach and panel remove calls from remove paths. Suggested-by: Luca Ceresoli Signed-off-by: Osama Abdelkader --- v5: - nt35510: keep mipi_dsi_attach()/mipi_dsi_detach() manual instead of devm_mipi_dsi_attach(), since nt35510_remove() also powers off the panel; deferring the detach to devm would run it after the power-off instead of before it, changing the teardown order. (Luca) v4: - use devm_drm_panel_add instead of drm_panel_add. drivers/gpu/drm/panel/panel-novatek-nt35510.c | 13 ++++++---- drivers/gpu/drm/panel/panel-novatek-nt35532.c | 23 ++++------------- drivers/gpu/drm/panel/panel-novatek-nt35560.c | 19 +++----------- .../gpu/drm/panel/panel-novatek-nt36672a.c | 25 ++----------------- .../gpu/drm/panel/panel-novatek-nt36672e.c | 21 ++++------------ .../gpu/drm/panel/panel-novatek-nt37700f.c | 23 ++++------------- drivers/gpu/drm/panel/panel-novatek-nt37801.c | 23 ++++------------- drivers/gpu/drm/panel/panel-raydium-rm67191.c | 22 +++------------- drivers/gpu/drm/panel/panel-raydium-rm67200.c | 23 ++++------------- drivers/gpu/drm/panel/panel-raydium-rm68200.c | 16 +++--------- drivers/gpu/drm/panel/panel-raydium-rm692e5.c | 20 +++------------ 11 files changed, 49 insertions(+), 179 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35510.c b/drivers/gpu/drm/panel/panel-novatek-nt35510.c index 3189d89c7ca0..86d1a19afb7b 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35510.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35510.c @@ -1173,11 +1173,13 @@ static int nt35510_probe(struct mipi_dsi_device *dsi) nt->panel.backlight = bl; } - drm_panel_add(&nt->panel); + ret = devm_drm_panel_add(dev, &nt->panel); + if (ret) + return ret; ret = mipi_dsi_attach(dsi); if (ret < 0) - drm_panel_remove(&nt->panel); + return ret; return 0; } @@ -1187,13 +1189,14 @@ static void nt35510_remove(struct mipi_dsi_device *dsi) struct nt35510 *nt = mipi_dsi_get_drvdata(dsi); int ret; - mipi_dsi_detach(dsi); + ret = mipi_dsi_detach(dsi); + if (ret < 0) + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); + /* Power off */ ret = nt35510_power_off(nt); if (ret) dev_err(&dsi->dev, "Failed to power off\n"); - - drm_panel_remove(&nt->panel); } /* diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35532.c b/drivers/gpu/drm/panel/panel-novatek-nt35532.c index edea766a3c44..752144220514 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35532.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35532.c @@ -752,29 +752,17 @@ static int nt35532_probe(struct mipi_dsi_device *dsi) if (ret) return dev_err_probe(dev, ret, "Failed to get backlight\n"); - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - drm_panel_remove(&ctx->panel); + ret = devm_mipi_dsi_attach(dev, dsi); + if (ret < 0) return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); - } return 0; } -static void nt35532_remove(struct mipi_dsi_device *dsi) -{ - struct novatek_nt35532 *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = mipi_dsi_detach(dsi); - if (ret < 0) - dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); - - drm_panel_remove(&ctx->panel); -} - static const struct of_device_id nt35532_of_match[] = { { .compatible = "flipkart,rimob-panel-nt35532-cs", .data = &rimob_panel_desc }, { /* sentinel */ } @@ -783,7 +771,6 @@ MODULE_DEVICE_TABLE(of, nt35532_of_match); static struct mipi_dsi_driver nt35532_driver = { .probe = nt35532_probe, - .remove = nt35532_remove, .driver = { .name = "panel-novatek-nt35532", .of_match_table = nt35532_of_match, diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35560.c b/drivers/gpu/drm/panel/panel-novatek-nt35560.c index 6e5173f98a22..be42eb9ef423 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35560.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35560.c @@ -433,23 +433,11 @@ static int nt35560_probe(struct mipi_dsi_device *dsi) return dev_err_probe(dev, PTR_ERR(nt->panel.backlight), "failed to register backlight device\n"); - drm_panel_add(&nt->panel); - - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - drm_panel_remove(&nt->panel); + ret = devm_drm_panel_add(dev, &nt->panel); + if (ret) return ret; - } - - return 0; -} - -static void nt35560_remove(struct mipi_dsi_device *dsi) -{ - struct nt35560 *nt = mipi_dsi_get_drvdata(dsi); - mipi_dsi_detach(dsi); - drm_panel_remove(&nt->panel); + return devm_mipi_dsi_attach(dev, dsi); } static const struct of_device_id nt35560_of_match[] = { @@ -467,7 +455,6 @@ MODULE_DEVICE_TABLE(of, nt35560_of_match); static struct mipi_dsi_driver nt35560_driver = { .probe = nt35560_probe, - .remove = nt35560_remove, .driver = { .name = "panel-novatek-nt35560", .of_match_table = nt35560_of_match, diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c index 464d9ce47d87..da466cdd9354 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -428,9 +428,7 @@ static int nt36672a_panel_add(struct nt36672a_panel *pinfo) if (ret) return dev_err_probe(dev, ret, "Failed to get backlight\n"); - drm_panel_add(&pinfo->base); - - return 0; + return devm_drm_panel_add(dev, &pinfo->base); } static int nt36672a_panel_probe(struct mipi_dsi_device *dsi) @@ -458,25 +456,7 @@ static int nt36672a_panel_probe(struct mipi_dsi_device *dsi) if (err < 0) return err; - err = mipi_dsi_attach(dsi); - if (err < 0) { - drm_panel_remove(&pinfo->base); - return err; - } - - return 0; -} - -static void nt36672a_panel_remove(struct mipi_dsi_device *dsi) -{ - struct nt36672a_panel *pinfo = mipi_dsi_get_drvdata(dsi); - int err; - - err = mipi_dsi_detach(dsi); - if (err < 0) - dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); - - drm_panel_remove(&pinfo->base); + return devm_mipi_dsi_attach(&dsi->dev, dsi); } static const struct of_device_id tianma_fhd_video_of_match[] = { @@ -491,7 +471,6 @@ static struct mipi_dsi_driver nt36672a_panel_driver = { .of_match_table = tianma_fhd_video_of_match, }, .probe = nt36672a_panel_probe, - .remove = nt36672a_panel_remove, }; module_mipi_dsi_driver(nt36672a_panel_driver); diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c index c5e00eb55722..85902338f10d 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c @@ -561,27 +561,17 @@ static int nt36672e_panel_probe(struct mipi_dsi_device *dsi) ctx->panel.prepare_prev_first = true; - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; - ret = mipi_dsi_attach(dsi); + ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { dev_err(dev, "Failed to attach to DSI host: %d\n", ret); - goto err_dsi_attach; + return ret; } return 0; - -err_dsi_attach: - drm_panel_remove(&ctx->panel); - return ret; -} - -static void nt36672e_panel_remove(struct mipi_dsi_device *dsi) -{ - struct nt36672e_panel *ctx = mipi_dsi_get_drvdata(dsi); - - mipi_dsi_detach(ctx->dsi); - drm_panel_remove(&ctx->panel); } static const struct of_device_id nt36672e_of_match[] = { @@ -599,7 +589,6 @@ static struct mipi_dsi_driver nt36672e_panel_driver = { .of_match_table = nt36672e_of_match, }, .probe = nt36672e_panel_probe, - .remove = nt36672e_panel_remove, }; module_mipi_dsi_driver(nt36672e_panel_driver); diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37700f.c b/drivers/gpu/drm/panel/panel-novatek-nt37700f.c index c221dd498fed..c2d219e52f6a 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt37700f.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt37700f.c @@ -257,29 +257,17 @@ static int nt37700f_tianma_probe(struct mipi_dsi_device *dsi) return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), "Failed to create backlight\n"); - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - drm_panel_remove(&ctx->panel); + ret = devm_mipi_dsi_attach(dev, dsi); + if (ret < 0) return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); - } return 0; } -static void nt37700f_tianma_remove(struct mipi_dsi_device *dsi) -{ - struct nt37700f_tianma *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = mipi_dsi_detach(dsi); - if (ret < 0) - dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); - - drm_panel_remove(&ctx->panel); -} - static const struct of_device_id nt37700f_tianma_of_match[] = { { .compatible = "novatek,nt37700f" }, { /* sentinel */ } @@ -288,7 +276,6 @@ MODULE_DEVICE_TABLE(of, nt37700f_tianma_of_match); static struct mipi_dsi_driver nt37700f_tianma_driver = { .probe = nt37700f_tianma_probe, - .remove = nt37700f_tianma_remove, .driver = { .name = "panel-novatek-nt37700f", .of_match_table = nt37700f_tianma_of_match, diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37801.c b/drivers/gpu/drm/panel/panel-novatek-nt37801.c index 5e46c4c6d771..4db560b66f4d 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt37801.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt37801.c @@ -270,7 +270,9 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi) return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), "Failed to create backlight\n"); - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; /* This panel only supports DSC; unconditionally enable it */ dsi->dsc = &ctx->dsc; @@ -283,27 +285,13 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi) ctx->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */ ctx->dsc.block_pred_enable = true; - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - drm_panel_remove(&ctx->panel); + ret = devm_mipi_dsi_attach(dev, dsi); + if (ret < 0) return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); - } return 0; } -static void novatek_nt37801_remove(struct mipi_dsi_device *dsi) -{ - struct novatek_nt37801 *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = mipi_dsi_detach(dsi); - if (ret < 0) - dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); - - drm_panel_remove(&ctx->panel); -} - static const struct of_device_id novatek_nt37801_of_match[] = { { .compatible = "novatek,nt37801" }, {} @@ -312,7 +300,6 @@ MODULE_DEVICE_TABLE(of, novatek_nt37801_of_match); static struct mipi_dsi_driver novatek_nt37801_driver = { .probe = novatek_nt37801_probe, - .remove = novatek_nt37801_remove, .driver = { .name = "panel-novatek-nt37801", .of_match_table = novatek_nt37801_of_match, diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c index 2af6aa47a551..62062ae0ebe3 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c @@ -590,26 +590,11 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi) dev_set_drvdata(dev, panel); - drm_panel_add(&panel->panel); - - ret = mipi_dsi_attach(dsi); - if (ret) - drm_panel_remove(&panel->panel); - - return ret; -} - -static void rad_panel_remove(struct mipi_dsi_device *dsi) -{ - struct rad_panel *rad = mipi_dsi_get_drvdata(dsi); - struct device *dev = &dsi->dev; - int ret; - - ret = mipi_dsi_detach(dsi); + ret = devm_drm_panel_add(dev, &panel->panel); if (ret) - dev_err(dev, "Failed to detach from host (%d)\n", ret); + return ret; - drm_panel_remove(&rad->panel); + return devm_mipi_dsi_attach(dev, dsi); } static const struct of_device_id rad_of_match[] = { @@ -624,7 +609,6 @@ static struct mipi_dsi_driver rad_panel_driver = { .of_match_table = rad_of_match, }, .probe = rad_panel_probe, - .remove = rad_panel_remove, }; module_mipi_dsi_driver(rad_panel_driver); diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67200.c b/drivers/gpu/drm/panel/panel-raydium-rm67200.c index b2ba006c06f6..e16f9ad6d193 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm67200.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm67200.c @@ -420,29 +420,17 @@ static int raydium_rm67200_probe(struct mipi_dsi_device *dsi) if (ret) return ret; - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; - ret = mipi_dsi_attach(dsi); - if (ret < 0) { + ret = devm_mipi_dsi_attach(dev, dsi); + if (ret < 0) dev_err(dev, "Failed to attach to DSI host: %d\n", ret); - drm_panel_remove(&ctx->panel); - } return ret; } -static void raydium_rm67200_remove(struct mipi_dsi_device *dsi) -{ - struct raydium_rm67200 *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = mipi_dsi_detach(dsi); - if (ret < 0) - dev_err(&dsi->dev, "Failed to detach DSI host: %d\n", ret); - - drm_panel_remove(&ctx->panel); -} - static const struct regulator_bulk_data w552793baa_regulators[] = { { .supply = "vdd", }, /* 2.8V */ { .supply = "iovcc", }, /* 1.8V */ @@ -479,7 +467,6 @@ MODULE_DEVICE_TABLE(of, raydium_rm67200_of_match); static struct mipi_dsi_driver raydium_rm67200_driver = { .probe = raydium_rm67200_probe, - .remove = raydium_rm67200_remove, .driver = { .name = "panel-raydium-rm67200", .of_match_table = raydium_rm67200_of_match, diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c index c535dc931903..f235cb4ae071 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c @@ -360,26 +360,19 @@ static int rm68200_probe(struct mipi_dsi_device *dsi) if (ret) return ret; - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; - ret = mipi_dsi_attach(dsi); + ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { dev_err(dev, "mipi_dsi_attach() failed: %d\n", ret); - drm_panel_remove(&ctx->panel); return ret; } return 0; } -static void rm68200_remove(struct mipi_dsi_device *dsi) -{ - struct rm68200 *ctx = mipi_dsi_get_drvdata(dsi); - - mipi_dsi_detach(dsi); - drm_panel_remove(&ctx->panel); -} - static const struct of_device_id raydium_rm68200_of_match[] = { { .compatible = "raydium,rm68200" }, { } @@ -388,7 +381,6 @@ MODULE_DEVICE_TABLE(of, raydium_rm68200_of_match); static struct mipi_dsi_driver raydium_rm68200_driver = { .probe = rm68200_probe, - .remove = rm68200_remove, .driver = { .name = "panel-raydium-rm68200", .of_match_table = raydium_rm68200_of_match, diff --git a/drivers/gpu/drm/panel/panel-raydium-rm692e5.c b/drivers/gpu/drm/panel/panel-raydium-rm692e5.c index 8e9484768657..4065cdf690f9 100644 --- a/drivers/gpu/drm/panel/panel-raydium-rm692e5.c +++ b/drivers/gpu/drm/panel/panel-raydium-rm692e5.c @@ -315,7 +315,9 @@ static int rm692e5_probe(struct mipi_dsi_device *dsi) return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), "Failed to create backlight\n"); - drm_panel_add(&ctx->panel); + ret = devm_drm_panel_add(dev, &ctx->panel); + if (ret) + return ret; /* This panel only supports DSC; unconditionally enable it */ dsi->dsc = &ctx->dsc; @@ -331,28 +333,15 @@ static int rm692e5_probe(struct mipi_dsi_device *dsi) ctx->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */ ctx->dsc.block_pred_enable = true; - ret = mipi_dsi_attach(dsi); + ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { dev_err(dev, "Failed to attach to DSI host: %d\n", ret); - drm_panel_remove(&ctx->panel); return ret; } return 0; } -static void rm692e5_remove(struct mipi_dsi_device *dsi) -{ - struct rm692e5_panel *ctx = mipi_dsi_get_drvdata(dsi); - int ret; - - ret = mipi_dsi_detach(dsi); - if (ret < 0) - dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); - - drm_panel_remove(&ctx->panel); -} - static const struct of_device_id rm692e5_of_match[] = { { .compatible = "fairphone,fp5-rm692e5-boe" }, { } @@ -361,7 +350,6 @@ MODULE_DEVICE_TABLE(of, rm692e5_of_match); static struct mipi_dsi_driver rm692e5_driver = { .probe = rm692e5_probe, - .remove = rm692e5_remove, .driver = { .name = "panel-rm692e5-boe-amoled", .of_match_table = rm692e5_of_match, -- 2.43.0