* [PATCH] memory: tegra: Constify struct thermal_cooling_device_ops
@ 2021-11-28 20:41 Rikard Falkeborn
2021-11-29 9:11 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Rikard Falkeborn @ 2021-11-28 20:41 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Thierry Reding, Jonathan Hunter, linux-kernel, linux-tegra,
Kai Song, Jing Yangyang, Rikard Falkeborn
The only usage of tegra210_emc_cd_ops is to pass its address to
devm_thermal_of_cooling_device_register() which is a pointer to const
struct thermal_cooling_device_ops. Make it const to allow the compiler
to put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/memory/tegra/tegra210-emc-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegra/tegra210-emc-core.c
index 13584f9317a4..cbe1a7723514 100644
--- a/drivers/memory/tegra/tegra210-emc-core.c
+++ b/drivers/memory/tegra/tegra210-emc-core.c
@@ -711,7 +711,7 @@ static int tegra210_emc_cd_set_state(struct thermal_cooling_device *cd,
return 0;
}
-static struct thermal_cooling_device_ops tegra210_emc_cd_ops = {
+static const struct thermal_cooling_device_ops tegra210_emc_cd_ops = {
.get_max_state = tegra210_emc_cd_max_state,
.get_cur_state = tegra210_emc_cd_get_state,
.set_cur_state = tegra210_emc_cd_set_state,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] memory: tegra: Constify struct thermal_cooling_device_ops
2021-11-28 20:41 [PATCH] memory: tegra: Constify struct thermal_cooling_device_ops Rikard Falkeborn
@ 2021-11-29 9:11 ` Krzysztof Kozlowski
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2021-11-29 9:11 UTC (permalink / raw)
To: Rikard Falkeborn
Cc: Krzysztof Kozlowski, linux-tegra, linux-kernel, Jing Yangyang,
Kai Song, Jonathan Hunter, Thierry Reding
On Sun, 28 Nov 2021 21:41:58 +0100, Rikard Falkeborn wrote:
> The only usage of tegra210_emc_cd_ops is to pass its address to
> devm_thermal_of_cooling_device_register() which is a pointer to const
> struct thermal_cooling_device_ops. Make it const to allow the compiler
> to put it in read-only memory.
>
>
Applied, thanks!
[1/1] memory: tegra: Constify struct thermal_cooling_device_ops
commit: 56985dc4f437d7a77d4abede73191da20cf11429
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] memory: tegra: Constify struct thermal_cooling_device_ops
@ 2020-06-09 22:12 Rikard Falkeborn
0 siblings, 0 replies; 3+ messages in thread
From: Rikard Falkeborn @ 2020-06-09 22:12 UTC (permalink / raw)
Cc: thierry.reding, jonathanh, josephl, linux-tegra, linux-kernel,
Rikard Falkeborn
tegra210_emc_cd_ops is never modified and can be made const to allow the
compiler to put it in read-only memory.
Before:
text data bss dec hex filename
27936 5600 192 33728 83c0 drivers/memory/tegra/tegra210-emc-core.o
After:
text data bss dec hex filename
28040 5504 192 33736 83c8 drivers/memory/tegra/tegra210-emc-core.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/memory/tegra/tegra210-emc-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegra/tegra210-emc-core.c
index cdd663ba4733..2dfcc0e2e15d 100644
--- a/drivers/memory/tegra/tegra210-emc-core.c
+++ b/drivers/memory/tegra/tegra210-emc-core.c
@@ -711,7 +711,7 @@ static int tegra210_emc_cd_set_state(struct thermal_cooling_device *cd,
return 0;
}
-static struct thermal_cooling_device_ops tegra210_emc_cd_ops = {
+static const struct thermal_cooling_device_ops tegra210_emc_cd_ops = {
.get_max_state = tegra210_emc_cd_max_state,
.get_cur_state = tegra210_emc_cd_get_state,
.set_cur_state = tegra210_emc_cd_set_state,
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-29 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-28 20:41 [PATCH] memory: tegra: Constify struct thermal_cooling_device_ops Rikard Falkeborn
2021-11-29 9:11 ` Krzysztof Kozlowski
-- strict thread matches above, loose matches on Subject: below --
2020-06-09 22:12 Rikard Falkeborn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).