From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 6A13BC54E90 for ; Sun, 25 May 2025 10:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Nde2SkTDak5t7cCJKYp/aSUwJXpBCopTUS04DjQZk70=; b=aECi4pn1W0uiyxJcuVvci8j8K1 +AlLN67o09msZ6+GTdx3I+AhJmqzZm/IN7S/KEmdb7TmtJgtD9kwWzwu+czaPr/W1MlL7UYtPqp5B vo8D0fkRhBOkBbL7E/mfOraRtQwjEbuTUL6rU978ND6MEaQ1Tdy6XzsDH/fOA46TPFKk/9htM5PER ZPK4BuLTXuqCvIWijRefwfEb45R8SIDZ3RIyWXyp0LKJjGqvYVinlGXTSsuQ2ryzuzKEDLDxLHWSI ynp00xpZnJwYtPxN10H+C9ZUh0IyvoZTJozQEUbWLqorK74GqeZrRQxuN07jfMLHDjk9qGumRwbh/ VcaIxZDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uJ8VL-00000006wfY-1Mlo; Sun, 25 May 2025 10:22:55 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uJ8SV-00000006wQo-0JqG; Sun, 25 May 2025 10:20:00 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 5C6431380186; Sun, 25 May 2025 06:19:55 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sun, 25 May 2025 06:19:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1748168395; x=1748254795; bh=Nde2SkTDak5t7cCJKYp/aSUwJXpBCopTUS04DjQZk70=; b= VkZ5059rjCC9tiBPqn7yu4+dDulqLrtNHPnj4JyYGRCy86WYJFp/+EtIUTQ9K4b9 1kaUtqRdQ4MxsIlDX6K6UqeZLVmR6U4X/Q63n3aOne3AuO+BSn5xbk7V8QqtUDzy Gt7almcJrT7PJrtKNqbteTIDSwwOFex2xjXGFnFMmrUi70qFnPSWw3YDhs5zNAwV JM5kCLWQoPy9RHImp9mXWQqJxVirCLN/mm6lEzrjJQdF71XF0S9mw5Fd3bR23EwZ eU8LQNF2X3xnAI9NjvSUutSIGIZjZoeqz/mLxLlNjR1kCe0yhSzB+IZONvsJA3I9 oqgb6UddBuRc1OxQ1lhAOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1748168395; x= 1748254795; bh=Nde2SkTDak5t7cCJKYp/aSUwJXpBCopTUS04DjQZk70=; b=P LO3eXAaO+KaHnZS4qXMn3JmsoC72DXJTNsjvQxCpwCs7d0E2QeVW1hga+nkCCe64 alLwkz1ZPJx4ESMp20Dyq51x5D58eVS+ZmQa7P9qrsQHXcs0kwPK6qDDFGbig5PQ vBj84OYKCAPjcywwgzr7jQ2OebeJNZvnGsO8C4N68nNjtPwy0pwS1mfFS+KSxI/S Zvnh/gwcx0/m3jy0M85JSlGM4oB4ha8A0qJBMSPzwY/dlN+2zWvSHn9+Q5XPRisN xz1klJOm1/zD3QLJ+Hbyj3u+XaVWn1kbYpcON3HpXvzbOHkR73vNCm3UeHnOa83E k5tMmYtiupoOHInIQPYdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgddugeefheculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhf gggtugfgjgesthekredttddtjeenucfhrhhomheppfhikhhlrghsucfunpguvghrlhhunh guuceonhhikhhlrghsrdhsohguvghrlhhunhgusehrrghgnhgrthgvtghhrdhsvgeqnecu ggftrfgrthhtvghrnhepveetgedtvddvhfdtkeeghfeffeehteehkeekgeefjeduieduue elgedtheekkeetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepnhhikhhlrghsrdhsohguvghrlhhunhgusehrrghgnhgrthgvtghhrdhsvgdpnh gspghrtghpthhtohepvddvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegthhhr ihhsthhophhhvgdrjhgrihhllhgvthesfigrnhgrughoohdrfhhrpdhrtghpthhtohepmh hiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomhdprhgtphhtthhopehrrghf rggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnh hosehlihhnrghrohdrohhrghdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghl rdgtohhmpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtph htthhopehsuhhpphhorhhtrdhophgvnhhsohhurhgtvgesughirghsvghmihdrtghomhdp rhgtphhtthhopehshhgrfihnghhuoheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepsh drhhgruhgvrhesphgvnhhguhhtrhhonhhigidruggv X-ME-Proxy: Feedback-ID: i80c9496c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 25 May 2025 06:19:53 -0400 (EDT) Date: Sun, 25 May 2025 12:19:50 +0200 From: Niklas =?utf-8?Q?S=C3=B6derlund?= To: Christophe JAILLET Cc: Miquel Raynal , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Geert Uytterhoeven , Magnus Damm , Matthias Brugger , AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-pm@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] thermal: Constify struct thermal_zone_device_ops Message-ID: <20250525101950.GE600042@ragnatech.se> References: <5bba3bf0139e2418b306a0f9a2f1f81ef49e88a6.1748165978.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5bba3bf0139e2418b306a0f9a2f1f81ef49e88a6.1748165978.git.christophe.jaillet@wanadoo.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250525_031959_688246_9D7D255F X-CRM114-Status: GOOD ( 16.67 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Hi Christophe, Thanks for your work. On 2025-05-25 11:40:04 +0200, Christophe JAILLET wrote: > 'struct thermal_zone_device_ops' are not modified in these drivers. > > Constifying these structures moves some data to a read-only section, so > increases overall security, especially when the structure holds some > function pointers. > > On a x86_64, with allmodconfig, as an example: > Before: > ====== > text data bss dec hex filename > 28116 5168 128 33412 8284 drivers/thermal/armada_thermal.o > > After: > ===== > text data bss dec hex filename > 28244 5040 128 33412 8284 drivers/thermal/armada_thermal.o > > Signed-off-by: Christophe JAILLET > --- > Compile tested only > --- > drivers/thermal/armada_thermal.c | 2 +- > drivers/thermal/da9062-thermal.c | 2 +- > drivers/thermal/dove_thermal.c | 2 +- > drivers/thermal/imx_thermal.c | 2 +- > drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- > drivers/thermal/kirkwood_thermal.c | 2 +- > drivers/thermal/mediatek/lvts_thermal.c | 2 +- > drivers/thermal/renesas/rcar_thermal.c | 2 +- For R-Car, Reviewed-by: Niklas Söderlund > drivers/thermal/spear_thermal.c | 2 +- > drivers/thermal/st/st_thermal.c | 2 +- > drivers/thermal/testing/zone.c | 2 +- > 11 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c > index 9bff21068721..c2fbdb534f61 100644 > --- a/drivers/thermal/armada_thermal.c > +++ b/drivers/thermal/armada_thermal.c > @@ -408,7 +408,7 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal, > return ret; > } > > -static struct thermal_zone_device_ops legacy_ops = { > +static const struct thermal_zone_device_ops legacy_ops = { > .get_temp = armada_get_temp_legacy, > }; > > diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c > index 2077e85ef5ca..a8d4b766ba21 100644 > --- a/drivers/thermal/da9062-thermal.c > +++ b/drivers/thermal/da9062-thermal.c > @@ -137,7 +137,7 @@ static int da9062_thermal_get_temp(struct thermal_zone_device *z, > return 0; > } > > -static struct thermal_zone_device_ops da9062_thermal_ops = { > +static const struct thermal_zone_device_ops da9062_thermal_ops = { > .get_temp = da9062_thermal_get_temp, > }; > > diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c > index f9157a47156b..723bc72f0626 100644 > --- a/drivers/thermal/dove_thermal.c > +++ b/drivers/thermal/dove_thermal.c > @@ -106,7 +106,7 @@ static int dove_get_temp(struct thermal_zone_device *thermal, > return 0; > } > > -static struct thermal_zone_device_ops ops = { > +static const struct thermal_zone_device_ops ops = { > .get_temp = dove_get_temp, > }; > > diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c > index bab52e6b3b15..38c993d1bcb3 100644 > --- a/drivers/thermal/imx_thermal.c > +++ b/drivers/thermal/imx_thermal.c > @@ -361,7 +361,7 @@ static bool imx_should_bind(struct thermal_zone_device *tz, > return trip->type == THERMAL_TRIP_PASSIVE; > } > > -static struct thermal_zone_device_ops imx_tz_ops = { > +static const struct thermal_zone_device_ops imx_tz_ops = { > .should_bind = imx_should_bind, > .get_temp = imx_get_temp, > .change_mode = imx_change_mode, > diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > index 0e07693ecf59..5736638c586b 100644 > --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > @@ -515,7 +515,7 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal, > return result; > } > > -static struct thermal_zone_device_ops int3400_thermal_ops = { > +static const struct thermal_zone_device_ops int3400_thermal_ops = { > .get_temp = int3400_thermal_get_temp, > .change_mode = int3400_thermal_change_mode, > }; > diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c > index 7c2265231668..4619e090f756 100644 > --- a/drivers/thermal/kirkwood_thermal.c > +++ b/drivers/thermal/kirkwood_thermal.c > @@ -48,7 +48,7 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, > return 0; > } > > -static struct thermal_zone_device_ops ops = { > +static const struct thermal_zone_device_ops ops = { > .get_temp = kirkwood_get_temp, > }; > > diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c > index 985925147ac0..acce8fde2cba 100644 > --- a/drivers/thermal/mediatek/lvts_thermal.c > +++ b/drivers/thermal/mediatek/lvts_thermal.c > @@ -571,7 +571,7 @@ static irqreturn_t lvts_irq_handler(int irq, void *data) > return iret; > } > > -static struct thermal_zone_device_ops lvts_ops = { > +static const struct thermal_zone_device_ops lvts_ops = { > .get_temp = lvts_get_temp, > .set_trips = lvts_set_trips, > }; > diff --git a/drivers/thermal/renesas/rcar_thermal.c b/drivers/thermal/renesas/rcar_thermal.c > index 00a66ee0a5b0..fdd7afdc4ff6 100644 > --- a/drivers/thermal/renesas/rcar_thermal.c > +++ b/drivers/thermal/renesas/rcar_thermal.c > @@ -277,7 +277,7 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) > return rcar_thermal_get_current_temp(priv, temp); > } > > -static struct thermal_zone_device_ops rcar_thermal_zone_ops = { > +static const struct thermal_zone_device_ops rcar_thermal_zone_ops = { > .get_temp = rcar_thermal_get_temp, > }; > > diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c > index bb96be947521..603dadcd3df5 100644 > --- a/drivers/thermal/spear_thermal.c > +++ b/drivers/thermal/spear_thermal.c > @@ -41,7 +41,7 @@ static inline int thermal_get_temp(struct thermal_zone_device *thermal, > return 0; > } > > -static struct thermal_zone_device_ops ops = { > +static const struct thermal_zone_device_ops ops = { > .get_temp = thermal_get_temp, > }; > > diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c > index a14a37d54698..1470ca519def 100644 > --- a/drivers/thermal/st/st_thermal.c > +++ b/drivers/thermal/st/st_thermal.c > @@ -132,7 +132,7 @@ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) > return 0; > } > > -static struct thermal_zone_device_ops st_tz_ops = { > +static const struct thermal_zone_device_ops st_tz_ops = { > .get_temp = st_thermal_get_temp, > }; > > diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c > index 1f4e450100e2..4257d813d572 100644 > --- a/drivers/thermal/testing/zone.c > +++ b/drivers/thermal/testing/zone.c > @@ -381,7 +381,7 @@ static int tt_zone_get_temp(struct thermal_zone_device *tz, int *temp) > return 0; > } > > -static struct thermal_zone_device_ops tt_zone_ops = { > +static const struct thermal_zone_device_ops tt_zone_ops = { > .get_temp = tt_zone_get_temp, > }; > > -- > 2.49.0 > -- Kind Regards, Niklas Söderlund