From patchwork Mon Jun 24 19:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13710015 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 9CA18C2BD09 for ; Mon, 24 Jun 2024 19:59:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C2AAE10E571; Mon, 24 Jun 2024 19:59:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="aqhg+JBN"; dkim-atps=neutral Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C88710E571 for ; Mon, 24 Jun 2024 19:59:48 +0000 (UTC) Received: from fedora.home ([86.243.222.230]) by smtp.orange.fr with ESMTPA id Lpqrsf3K7qnVgLpqrsXGhT; Mon, 24 Jun 2024 21:59:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1719259186; bh=PKvXmWL5ia+tMLrsPCdtaw8yQlKmPVzcIZ50EnxNumY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=aqhg+JBNDULyFJdYyzAawWk2UelUDJ7vZGWcpuDed6f1j963n0r7rQGpxDOc0LNuJ x0kQoBY+wTeKvUkka2MrNEKIX4sRKiMdhnLL+4YhyQMgduhDZgD7+5Xjrie5kO0TuX zHn41oG70Ybt0Aev6DzSLEsisnJ1KTkuyb32VplrZkyZvKHdFK1OeaqOvjrLsB+B6K 0LgOjHSyE45ZLum68oKQtxu+5QN7jb2NLlH00Gml6LW3MqcMUbetckwGd6HJy0afQa yRHkQyunEGbdyuGXr4WzyxKmp3xsixlNpr+TyKxs5LxpHS6CTWZKKaL8mevX/vDqAS g+3HZ35IODryA== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 24 Jun 2024 21:59:46 +0200 X-ME-IP: 86.243.222.230 From: Christophe JAILLET To: Helge Deller Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH] fbdev: mmp: Constify struct mmp_overlay_ops Date: Mon, 24 Jun 2024 21:59:42 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 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" 'struct mmp_overlay_ops' is not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 11798 555 16 12369 3051 drivers/video/fbdev/mmp/hw/mmp_ctrl.o After: ===== text data bss dec hex filename 11834 507 16 12357 3045 drivers/video/fbdev/mmp/hw/mmp_ctrl.o Signed-off-by: Christophe JAILLET --- Compile tested-only --- drivers/video/fbdev/mmp/hw/mmp_ctrl.c | 2 +- include/video/mmp_disp.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index 76b50b6c98ad..a20a2c408127 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c @@ -313,7 +313,7 @@ static void path_set_mode(struct mmp_path *path, struct mmp_mode *mode) mutex_unlock(&path->access_ok); } -static struct mmp_overlay_ops mmphw_overlay_ops = { +static const struct mmp_overlay_ops mmphw_overlay_ops = { .set_fetch = overlay_set_fetch, .set_onoff = overlay_set_onoff, .set_win = overlay_set_win, diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h index a722dcbf5073..41354bd49895 100644 --- a/include/video/mmp_disp.h +++ b/include/video/mmp_disp.h @@ -156,7 +156,7 @@ struct mmp_overlay { int status; struct mutex access_ok; - struct mmp_overlay_ops *ops; + const struct mmp_overlay_ops *ops; }; /* panel type */ @@ -299,7 +299,7 @@ struct mmp_path_info { int overlay_num; void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode); void (*set_onoff)(struct mmp_path *path, int status); - struct mmp_overlay_ops *overlay_ops; + const struct mmp_overlay_ops *overlay_ops; void *plat_data; };