Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: 6lowpan: constify lowpan_nhc structures

This patch constify the lowpan_nhc declarations. Since we drop the rb
node datastructure there is no need for runtime manipulation of this
structure.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Link: https://lore.kernel.org/r/20220428030534.3220410-4-aahringo@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>

authored by

Alexander Aring and committed by
Stefan Schmidt
f3de6f4e 31264f95

+11 -11
+8 -8
net/6lowpan/nhc.c
··· 12 12 13 13 #include "nhc.h" 14 14 15 - static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1]; 15 + static const struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1]; 16 16 static DEFINE_SPINLOCK(lowpan_nhc_lock); 17 17 18 - static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb) 18 + static const struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb) 19 19 { 20 - struct lowpan_nhc *nhc; 20 + const struct lowpan_nhc *nhc; 21 21 int i; 22 22 u8 id; 23 23 ··· 41 41 int lowpan_nhc_check_compression(struct sk_buff *skb, 42 42 const struct ipv6hdr *hdr, u8 **hc_ptr) 43 43 { 44 - struct lowpan_nhc *nhc; 44 + const struct lowpan_nhc *nhc; 45 45 int ret = 0; 46 46 47 47 spin_lock_bh(&lowpan_nhc_lock); ··· 59 59 u8 **hc_ptr) 60 60 { 61 61 int ret; 62 - struct lowpan_nhc *nhc; 62 + const struct lowpan_nhc *nhc; 63 63 64 64 spin_lock_bh(&lowpan_nhc_lock); 65 65 ··· 102 102 const struct net_device *dev, 103 103 struct ipv6hdr *hdr) 104 104 { 105 - struct lowpan_nhc *nhc; 105 + const struct lowpan_nhc *nhc; 106 106 int ret; 107 107 108 108 spin_lock_bh(&lowpan_nhc_lock); ··· 138 138 return 0; 139 139 } 140 140 141 - int lowpan_nhc_add(struct lowpan_nhc *nhc) 141 + int lowpan_nhc_add(const struct lowpan_nhc *nhc) 142 142 { 143 143 int ret = 0; 144 144 ··· 156 156 } 157 157 EXPORT_SYMBOL(lowpan_nhc_add); 158 158 159 - void lowpan_nhc_del(struct lowpan_nhc *nhc) 159 + void lowpan_nhc_del(const struct lowpan_nhc *nhc) 160 160 { 161 161 spin_lock_bh(&lowpan_nhc_lock); 162 162
+3 -3
net/6lowpan/nhc.h
··· 24 24 #define LOWPAN_NHC(__nhc, _name, _nexthdr, \ 25 25 _hdrlen, _id, _idmask, \ 26 26 _uncompress, _compress) \ 27 - static struct lowpan_nhc __nhc = { \ 27 + static const struct lowpan_nhc __nhc = { \ 28 28 .name = _name, \ 29 29 .nexthdr = _nexthdr, \ 30 30 .nexthdrlen = _hdrlen, \ ··· 116 116 * 117 117 * @nhc: nhc which should be add. 118 118 */ 119 - int lowpan_nhc_add(struct lowpan_nhc *nhc); 119 + int lowpan_nhc_add(const struct lowpan_nhc *nhc); 120 120 121 121 /** 122 122 * lowpan_nhc_del - delete a next header compression from framework 123 123 * 124 124 * @nhc: nhc which should be delete. 125 125 */ 126 - void lowpan_nhc_del(struct lowpan_nhc *nhc); 126 + void lowpan_nhc_del(const struct lowpan_nhc *nhc); 127 127 128 128 /** 129 129 * lowpan_nhc_init - adding all default nhcs