From: Rikard Falkeborn Date: Sun, 4 Oct 2020 19:32:00 +0000 (+0200) Subject: w1: Constify struct w1_family_ops X-Git-Tag: v5.15~2672^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07f8569fbe44f35e53c7a5946fbb348432c68377;p=platform%2Fkernel%2Flinux-starfive.git 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. Reviewed-by: Sebastian Reichel Signed-off-by: Rikard Falkeborn Link: https://lore.kernel.org/r/20201004193202.4044-2-rikard.falkeborn@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index e58c759..6bd64bc 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -613,7 +613,7 @@ end: 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 cebf346..949d3b1 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;