[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201004193202.4044-2-rikard.falkeborn@gmail.com>
Date: Sun, 4 Oct 2020 21:32:00 +0200
From: Rikard Falkeborn <rikard.falkeborn@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Rikard Falkeborn <rikard.falkeborn@...il.com>,
Evgeniy Polyakov <zbr@...emap.net>,
Angelo Dureghello <angelo.dureghello@...esys.com>,
Akira Shimahara <akira215corp@...il.com>,
Sebastian Reichel <sre@...nel.org>
Subject: [PATCH 1/3] w1: Constify struct w1_family_ops
The fops field in the w1_family struct is never modified. Make it const
to indicate that. Constifying the pointer makes it possible for drivers
to declare static w1_family_ops structs const, which in turn will allow
the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@...il.com>
---
drivers/w1/w1.c | 2 +-
include/linux/w1.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index e58c7592008d..6bd64bcb6316 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -613,7 +613,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
static int w1_family_notify(unsigned long action, struct w1_slave *sl)
{
- struct w1_family_ops *fops;
+ const struct w1_family_ops *fops;
int err;
fops = sl->family->fops;
diff --git a/include/linux/w1.h b/include/linux/w1.h
index cebf3464bc03..949d3b10e531 100644
--- a/include/linux/w1.h
+++ b/include/linux/w1.h
@@ -269,7 +269,7 @@ struct w1_family {
struct list_head family_entry;
u8 fid;
- struct w1_family_ops *fops;
+ const struct w1_family_ops *fops;
const struct of_device_id *of_match_table;
--
2.28.0
Powered by blists - more mailing lists