From patchwork Tue Aug 27 15:25:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13779687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E2BDC54731 for ; Tue, 27 Aug 2024 15:26:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8E4610E351; Tue, 27 Aug 2024 15:26:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="DCqt5RYP"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 72D0510E34F for ; Tue, 27 Aug 2024 15:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1724772359; bh=2fuwEC3Yp225FwaS701NUfjP1g4xTmgB08/zOpmpsAA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DCqt5RYPBHq4y1tFuB7C/JYlnHW4jqqVrEEB1R/smTUMuyK20U4nSdr/FlzcZzJ8W LwMRCSA5L2wN0ozoBsQGBx7s/HbX0HnQXv3kOU2+TJwq2Zd09JVyIP2jycTHMSXOnL kwDWf9a5ogwdQi1LGAsMK7jQ3ZgqyDJzn6CJQYGo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 27 Aug 2024 17:25:12 +0200 Subject: [PATCH 1/5] fbdev/efifb: Use stack memory for screeninfo structs MIME-Version: 1.0 Message-Id: <20240827-efifb-sysfs-v1-1-c9cc3e052180@weissschuh.net> References: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> In-Reply-To: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> To: Peter Jones , Helge Deller , Daniel Vetter Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724772358; l=1859; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2fuwEC3Yp225FwaS701NUfjP1g4xTmgB08/zOpmpsAA=; b=rOkv5WWJdsYyy7gSwo6ETnm+0fpNWf1gQQInzjmRji2pSdC5vaSVpncDd9Wvim18h/qjuGEaS 6mXd0NYbotdCVXwSvlogkuLn3iuwWJeBwPQzO8P3C6CInqlgPfHpFPJ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" These variables are only used inside efifb_probe(). Afterwards they are using memory unnecessarily. Signed-off-by: Thomas Weißschuh --- drivers/video/fbdev/efifb.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 8dd82afb3452..8bfe0ccbc67a 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -52,24 +52,6 @@ struct efifb_par { resource_size_t size; }; -static struct fb_var_screeninfo efifb_defined = { - .activate = FB_ACTIVATE_NOW, - .height = -1, - .width = -1, - .right_margin = 32, - .upper_margin = 16, - .lower_margin = 4, - .vsync_len = 4, - .vmode = FB_VMODE_NONINTERLACED, -}; - -static struct fb_fix_screeninfo efifb_fix = { - .id = "EFI VGA", - .type = FB_TYPE_PACKED_PIXELS, - .accel = FB_ACCEL_NONE, - .visual = FB_VISUAL_TRUECOLOR, -}; - static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) @@ -357,6 +339,24 @@ static int efifb_probe(struct platform_device *dev) char *option = NULL; efi_memory_desc_t md; + struct fb_var_screeninfo efifb_defined = { + .activate = FB_ACTIVATE_NOW, + .height = -1, + .width = -1, + .right_margin = 32, + .upper_margin = 16, + .lower_margin = 4, + .vsync_len = 4, + .vmode = FB_VMODE_NONINTERLACED, + }; + + struct fb_fix_screeninfo efifb_fix = { + .id = "EFI VGA", + .type = FB_TYPE_PACKED_PIXELS, + .accel = FB_ACCEL_NONE, + .visual = FB_VISUAL_TRUECOLOR, + }; + /* * If we fail probing the device, the kernel might try a different * driver. We get a copy of the attached screen_info, so that we can From patchwork Tue Aug 27 15:25:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13779689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26A07C5472F for ; Tue, 27 Aug 2024 15:26:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 986A510E356; Tue, 27 Aug 2024 15:26:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="i8EjG6U6"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51CE210E351 for ; Tue, 27 Aug 2024 15:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1724772359; bh=z4+MXZQwSzyk1DP5JRe+oUonhr5WcjwKYTX3+no3UJk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=i8EjG6U6G1PkfcqAsUdXQFhmPUG3mk30QmSV7iu3wr2oUNGMRPqCdynu45Ib3l8HG SvaKdjX23oRT7GBBUUtbIhRBltGzxt3NrZ0R4+RPbDpT0UrylB4sbIRcSmPw7cu+IT 5tBe1aSXkWhiRVPM6hAgG3tJQpcnDwYi3QQhAYxI= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 27 Aug 2024 17:25:13 +0200 Subject: [PATCH 2/5] fbdev/efifb: Register sysfs groups through driver core MIME-Version: 1.0 Message-Id: <20240827-efifb-sysfs-v1-2-c9cc3e052180@weissschuh.net> References: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> In-Reply-To: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> To: Peter Jones , Helge Deller , Daniel Vetter Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724772358; l=1814; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=z4+MXZQwSzyk1DP5JRe+oUonhr5WcjwKYTX3+no3UJk=; b=dFQ22KZQtiJhBVo/hCnGO4UOTOmeEvkQZjkIRcgRS5YGTZFjIL+ghunSlzA2DUjztOeDJq+G3 Vf69rcJVMwdCvEjMXIqXtmhG+AgZbyjeP6gBQo8cNof0NulgiAvPWk0 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The driver core can register and cleanup sysfs groups already. Make use of that functionality to simplify the error handling and cleanup. Also avoid a UAF race during unregistering where the sysctl attributes were usable after the info struct was freed. Signed-off-by: Thomas Weißschuh --- drivers/video/fbdev/efifb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 8bfe0ccbc67a..d36b95856dd0 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -561,15 +561,10 @@ static int efifb_probe(struct platform_device *dev) break; } - err = sysfs_create_groups(&dev->dev.kobj, efifb_groups); - if (err) { - pr_err("efifb: cannot add sysfs attrs\n"); - goto err_unmap; - } err = fb_alloc_cmap(&info->cmap, 256, 0); if (err < 0) { pr_err("efifb: cannot allocate colormap\n"); - goto err_groups; + goto err_unmap; } err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size); @@ -587,8 +582,6 @@ static int efifb_probe(struct platform_device *dev) err_fb_dealloc_cmap: fb_dealloc_cmap(&info->cmap); -err_groups: - sysfs_remove_groups(&dev->dev.kobj, efifb_groups); err_unmap: if (mem_flags & (EFI_MEMORY_UC | EFI_MEMORY_WC)) iounmap(info->screen_base); @@ -608,12 +601,12 @@ static void efifb_remove(struct platform_device *pdev) /* efifb_destroy takes care of info cleanup */ unregister_framebuffer(info); - sysfs_remove_groups(&pdev->dev.kobj, efifb_groups); } static struct platform_driver efifb_driver = { .driver = { .name = "efi-framebuffer", + .dev_groups = efifb_groups, }, .probe = efifb_probe, .remove_new = efifb_remove, From patchwork Tue Aug 27 15:25:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13779685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6B33C5472F for ; Tue, 27 Aug 2024 15:26:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15F1510E350; Tue, 27 Aug 2024 15:26:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="iUY18HRY"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D6EA10E351 for ; Tue, 27 Aug 2024 15:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1724772359; bh=yU1HRW3itAcyR9oaVPrkFjRYW6YZAfrAKd8xjgvUGtk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iUY18HRYTEem0/qjmhokwz2FVxdlGRX4smmQMntU+vzzcP5p1PhlqfanMz0zdFngm GRCY/Wq6TDzcPI420yStpLPZGadcmeEjWL9DMMbUbQ02Kq2chKgYQpKEkflbnPr6vJ PROZx+XDTdMjaaXH6wa5FrXUhpH7AOR5XTGKsK4Q= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 27 Aug 2024 17:25:14 +0200 Subject: [PATCH 3/5] fbdev: Introduce devm_register_framebuffer() MIME-Version: 1.0 Message-Id: <20240827-efifb-sysfs-v1-3-c9cc3e052180@weissschuh.net> References: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> In-Reply-To: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> To: Peter Jones , Helge Deller , Daniel Vetter Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724772358; l=2207; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=yU1HRW3itAcyR9oaVPrkFjRYW6YZAfrAKd8xjgvUGtk=; b=bu4ONSTKd3WZjVd+jzRq5fuyqvqHuGJ/m8lrieSml0bQiOp9hlbHZIyqEkp+oq6l/xlFSO579 jXLouV3SJFODtjYY/3KU23UVYxNlKmhAAU6Sugwp1NnEutR8EKtmroX X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce a device-managed variant of register_framebuffer() which automatically unregisters the framebuffer on device destruction. This can simplify the error handling and resource management in drivers. Signed-off-by: Thomas Weißschuh --- drivers/video/fbdev/core/fbmem.c | 24 ++++++++++++++++++++++++ include/linux/fb.h | 1 + 2 files changed, 25 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 4c4ad0a86a50..d17a2daa2483 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -544,6 +544,30 @@ unregister_framebuffer(struct fb_info *fb_info) } EXPORT_SYMBOL(unregister_framebuffer); +static void devm_unregister_framebuffer(void *data) +{ + struct fb_info *info = data; + + unregister_framebuffer(info); +} + +/** + * devm_register_framebuffer - resource-managed frame buffer device registration + * @dev: device the framebuffer belongs to + * @fb_info: frame buffer info structure + * + * Registers a frame buffer device @fb_info to device @dev. + * + * Returns negative errno on error, or zero for success. + * + */ +int +devm_register_framebuffer(struct device *dev, struct fb_info *fb_info) +{ + return devm_add_action_or_reset(dev, devm_unregister_framebuffer, fb_info); +} +EXPORT_SYMBOL(devm_register_framebuffer); + /** * fb_set_suspend - low level driver signals suspend * @info: framebuffer affected diff --git a/include/linux/fb.h b/include/linux/fb.h index db7d97b10964..abf6643ebcaf 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -601,6 +601,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, /* fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern void unregister_framebuffer(struct fb_info *fb_info); +extern int devm_register_framebuffer(struct device *dev, struct fb_info *fb_info); extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height, u32 shift_high, u32 shift_low, u32 mod); From patchwork Tue Aug 27 15:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13779686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 881F5C54731 for ; Tue, 27 Aug 2024 15:26:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D1F210E352; Tue, 27 Aug 2024 15:26:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="AXL8RrMW"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id BBA2C10E352 for ; Tue, 27 Aug 2024 15:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1724772359; bh=iZHa8sxD6VzxS56Wiia/CBINwT4dds6hEws/m9z7Qyc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AXL8RrMWVHeeUiMpd7h0QA1RqW47PggK65uqz7shee0v+B7fcNQFHgqv7XwuKAuOb 8WPE8EgxznKRIebDmPSnM0XH+5tEDao4he2IjenlIupKO9zGOwcJh74RZu0xDG3Agl eRh0OlzeJ8gClS1utkoS5jI4ZpbqNRnuCkO4CG1E= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 27 Aug 2024 17:25:15 +0200 Subject: [PATCH 4/5] fbdev/efifb: Use devm_register_framebuffer() MIME-Version: 1.0 Message-Id: <20240827-efifb-sysfs-v1-4-c9cc3e052180@weissschuh.net> References: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> In-Reply-To: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> To: Peter Jones , Helge Deller , Daniel Vetter Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724772358; l=1590; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=iZHa8sxD6VzxS56Wiia/CBINwT4dds6hEws/m9z7Qyc=; b=dXtcqh+lvUHCooHxFhjBUo0CAWGLafEFqjCKX5bR6GiC4GIpeihEQY2Ft7LEsBzbXr6lrLEQt OuKiWsfDc1OCz9k6JOIPtzVRz0aq6ox8fYZMewi8PR59ICxo746jkCO X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This simplifies the error handling. Also the drvdata slot is now unused and can be used for other usecases. Signed-off-by: Thomas Weißschuh --- drivers/video/fbdev/efifb.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index d36b95856dd0..7215973ef602 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -449,7 +449,6 @@ static int efifb_probe(struct platform_device *dev) err = -ENOMEM; goto err_release_mem; } - platform_set_drvdata(dev, info); par = info->par; info->pseudo_palette = par->pseudo_palette; @@ -572,7 +571,7 @@ static int efifb_probe(struct platform_device *dev) pr_err("efifb: cannot acquire aperture\n"); goto err_fb_dealloc_cmap; } - err = register_framebuffer(info); + err = devm_register_framebuffer(&dev->dev, info); if (err < 0) { pr_err("efifb: cannot register framebuffer\n"); goto err_fb_dealloc_cmap; @@ -595,21 +594,12 @@ static int efifb_probe(struct platform_device *dev) return err; } -static void efifb_remove(struct platform_device *pdev) -{ - struct fb_info *info = platform_get_drvdata(pdev); - - /* efifb_destroy takes care of info cleanup */ - unregister_framebuffer(info); -} - static struct platform_driver efifb_driver = { .driver = { .name = "efi-framebuffer", .dev_groups = efifb_groups, }, .probe = efifb_probe, - .remove_new = efifb_remove, }; builtin_platform_driver(efifb_driver); From patchwork Tue Aug 27 15:25:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13779688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBF24C5472F for ; Tue, 27 Aug 2024 15:26:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2622010E353; Tue, 27 Aug 2024 15:26:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="tky1Hq3+"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id EDEE410E353 for ; Tue, 27 Aug 2024 15:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1724772360; bh=2e4vyf28xxH0Hr6la1wTNPqSQ1+adyxwjIEbYSuV2ZQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tky1Hq3+/fxIo0PR0yLhX4NeR2JZSc/FpDc/+iBEYIVZx4tKdGLw00kqmM651bNzx sd/ivrIlYFCsOdOLZ7rW7yGaUt5cSBkW2IUp7YpXHJZ7zqNPzqlNN6f+cUB8uQtxj4 agBtu0KwAJHvWLvPv1OlQD8y27tatHW9ABsom+58= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 27 Aug 2024 17:25:16 +0200 Subject: [PATCH 5/5] fbdev/efifb: Use driver-private screen_info for sysfs MIME-Version: 1.0 Message-Id: <20240827-efifb-sysfs-v1-5-c9cc3e052180@weissschuh.net> References: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> In-Reply-To: <20240827-efifb-sysfs-v1-0-c9cc3e052180@weissschuh.net> To: Peter Jones , Helge Deller , Daniel Vetter Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724772358; l=1194; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2e4vyf28xxH0Hr6la1wTNPqSQ1+adyxwjIEbYSuV2ZQ=; b=+Pk0n0e5P2rpmmg2vlrNRCkM2i9FDYVDXSk03eilvNcK3JU9PZrT56fs06i4gUziwWgueLNAH XoyCQh/LzQbAT60VaYMbFxlv0u10WFRv1JQti4gSy+KJhNvN/dOi9qd X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Since commit b9cfd1d271ab ("fbdev/efifb: Use screen_info pointer from device") efifb uses a local copy of screen_info and applies its modifications there. Adapt the sysfs attributes to also work with the custom copy instead of the unmodified platform data. Signed-off-by: Thomas Weißschuh --- drivers/video/fbdev/efifb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 7215973ef602..1f86a07bf292 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -304,7 +304,7 @@ static ssize_t name##_show(struct device *dev, \ struct device_attribute *attr, \ char *buf) \ { \ - struct screen_info *si = dev_get_platdata(dev); \ + struct screen_info *si = dev_get_drvdata(dev); \ if (!si) \ return -ENODEV; \ return sprintf(buf, fmt "\n", (si->lfb_##name)); \ @@ -369,6 +369,8 @@ static int efifb_probe(struct platform_device *dev) if (!si) return -ENOMEM; + dev_set_drvdata(&dev->dev, si); + if (si->orig_video_isVGA != VIDEO_TYPE_EFI) return -ENODEV;