]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: 6lowpan: constify lowpan_nhc structures
authorAlexander Aring <aahringo@redhat.com>
Thu, 28 Apr 2022 03:05:34 +0000 (23:05 -0400)
committerStefan Schmidt <stefan@datenfreihafen.org>
Thu, 9 Jun 2022 19:53:28 +0000 (21:53 +0200)
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>
net/6lowpan/nhc.c
net/6lowpan/nhc.h

index 019f121b2449e1ea601a46ea301aededc4d9eed6..7b374595328deb33fb646aada4c296a5af3944b3 100644 (file)
 
 #include "nhc.h"
 
-static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
+static const struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
 static DEFINE_SPINLOCK(lowpan_nhc_lock);
 
-static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
+static const struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
 {
-       struct lowpan_nhc *nhc;
+       const struct lowpan_nhc *nhc;
        int i;
        u8 id;
 
@@ -41,7 +41,7 @@ static struct lowpan_nhc *lowpan_nhc_by_nhcid(struct sk_buff *skb)
 int lowpan_nhc_check_compression(struct sk_buff *skb,
                                 const struct ipv6hdr *hdr, u8 **hc_ptr)
 {
-       struct lowpan_nhc *nhc;
+       const struct lowpan_nhc *nhc;
        int ret = 0;
 
        spin_lock_bh(&lowpan_nhc_lock);
@@ -59,7 +59,7 @@ int lowpan_nhc_do_compression(struct sk_buff *skb, const struct ipv6hdr *hdr,
                              u8 **hc_ptr)
 {
        int ret;
-       struct lowpan_nhc *nhc;
+       const struct lowpan_nhc *nhc;
 
        spin_lock_bh(&lowpan_nhc_lock);
 
@@ -102,7 +102,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
                                const struct net_device *dev,
                                struct ipv6hdr *hdr)
 {
-       struct lowpan_nhc *nhc;
+       const struct lowpan_nhc *nhc;
        int ret;
 
        spin_lock_bh(&lowpan_nhc_lock);
@@ -138,7 +138,7 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
        return 0;
 }
 
-int lowpan_nhc_add(struct lowpan_nhc *nhc)
+int lowpan_nhc_add(const struct lowpan_nhc *nhc)
 {
        int ret = 0;
 
@@ -156,7 +156,7 @@ out:
 }
 EXPORT_SYMBOL(lowpan_nhc_add);
 
-void lowpan_nhc_del(struct lowpan_nhc *nhc)
+void lowpan_nhc_del(const struct lowpan_nhc *nhc)
 {
        spin_lock_bh(&lowpan_nhc_lock);
 
index 9df602a632bd70c4b1aa678fe9b1f6c16832fd10..ab7b4977c32be41d2797797316184db589417fda 100644 (file)
@@ -24,7 +24,7 @@
 #define LOWPAN_NHC(__nhc, _name, _nexthdr,     \
                   _hdrlen, _id, _idmask,       \
                   _uncompress, _compress)      \
-static struct lowpan_nhc __nhc = {             \
+static const struct lowpan_nhc __nhc = {       \
        .name           = _name,                \
        .nexthdr        = _nexthdr,             \
        .nexthdrlen     = _hdrlen,              \
@@ -116,14 +116,14 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
  *
  * @nhc: nhc which should be add.
  */
-int lowpan_nhc_add(struct lowpan_nhc *nhc);
+int lowpan_nhc_add(const struct lowpan_nhc *nhc);
 
 /**
  * lowpan_nhc_del - delete a next header compression from framework
  *
  * @nhc: nhc which should be delete.
  */
-void lowpan_nhc_del(struct lowpan_nhc *nhc);
+void lowpan_nhc_del(const struct lowpan_nhc *nhc);
 
 /**
  * lowpan_nhc_init - adding all default nhcs