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

atm: use const where reasonable

From: Mitchell Blank Jr <mitch@sfgoth.com>

Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mitchell Blank Jr and committed by
David S. Miller
61c33e01 df3bc8bd

+50 -51
+5 -5
net/atm/addr.c
··· 9 9 #include "signaling.h" 10 10 #include "addr.h" 11 11 12 - static int check_addr(struct sockaddr_atmsvc *addr) 12 + static int check_addr(const struct sockaddr_atmsvc *addr) 13 13 { 14 14 int i; 15 15 ··· 23 23 return -EINVAL; 24 24 } 25 25 26 - static int identical(struct sockaddr_atmsvc *a, struct sockaddr_atmsvc *b) 26 + static int identical(const struct sockaddr_atmsvc *a, const struct sockaddr_atmsvc *b) 27 27 { 28 28 if (*a->sas_addr.prv) 29 29 if (memcmp(a->sas_addr.prv, b->sas_addr.prv, ATM_ESA_LEN)) ··· 35 35 return !strcmp(a->sas_addr.pub, b->sas_addr.pub); 36 36 } 37 37 38 - static void notify_sigd(struct atm_dev *dev) 38 + static void notify_sigd(const struct atm_dev *dev) 39 39 { 40 40 struct sockaddr_atmpvc pvc; 41 41 ··· 63 63 notify_sigd(dev); 64 64 } 65 65 66 - int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, 66 + int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, 67 67 enum atm_addr_type_t atype) 68 68 { 69 69 unsigned long flags; ··· 98 98 return 0; 99 99 } 100 100 101 - int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, 101 + int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, 102 102 enum atm_addr_type_t atype) 103 103 { 104 104 unsigned long flags;
+2 -2
net/atm/addr.h
··· 10 10 #include <linux/atmdev.h> 11 11 12 12 void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type); 13 - int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, 13 + int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, 14 14 enum atm_addr_type_t type); 15 - int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, 15 + int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, 16 16 enum atm_addr_type_t type); 17 17 int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf, 18 18 size_t size, enum atm_addr_type_t type);
+7 -7
net/atm/br2684.c
··· 52 52 #define ETHERTYPE_IPV6 0x86, 0xdd 53 53 #define PAD_BRIDGED 0x00, 0x00 54 54 55 - static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 }; 56 - static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 }; 57 - static unsigned char llc_oui_pid_pad[] = 55 + static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 }; 56 + static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 }; 57 + static const unsigned char llc_oui_pid_pad[] = 58 58 { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED }; 59 - static unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 }; 60 - static unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 }; 59 + static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 }; 60 + static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 }; 61 61 62 62 enum br2684_encaps { 63 63 e_vc = BR2684_ENCAPS_VC, ··· 217 217 return 1; 218 218 } 219 219 220 - static inline struct br2684_vcc *pick_outgoing_vcc(struct sk_buff *skb, 221 - struct br2684_dev *brdev) 220 + static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb, 221 + const struct br2684_dev *brdev) 222 222 { 223 223 return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */ 224 224 }
+4 -4
net/atm/common.c
··· 262 262 } 263 263 264 264 265 - static int check_ci(struct atm_vcc *vcc, short vpi, int vci) 265 + static int check_ci(const struct atm_vcc *vcc, short vpi, int vci) 266 266 { 267 267 struct hlist_head *head = &vcc_hash[vci & 268 268 (VCC_HTABLE_SIZE - 1)]; ··· 290 290 } 291 291 292 292 293 - static int find_ci(struct atm_vcc *vcc, short *vpi, int *vci) 293 + static int find_ci(const struct atm_vcc *vcc, short *vpi, int *vci) 294 294 { 295 295 static short p; /* poor man's per-device cache */ 296 296 static int c; ··· 646 646 } 647 647 648 648 649 - static int check_tp(struct atm_trafprm *tp) 649 + static int check_tp(const struct atm_trafprm *tp) 650 650 { 651 651 /* @@@ Should be merged with adjust_tp */ 652 652 if (!tp->traffic_class || tp->traffic_class == ATM_ANYCLASS) return 0; ··· 663 663 } 664 664 665 665 666 - static int check_qos(struct atm_qos *qos) 666 + static int check_qos(const struct atm_qos *qos) 667 667 { 668 668 int error; 669 669
+27 -28
net/atm/lec.c
··· 65 65 static struct net_device_stats *lec_get_stats(struct net_device *dev); 66 66 static void lec_init(struct net_device *dev); 67 67 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, 68 - unsigned char *mac_addr); 68 + const unsigned char *mac_addr); 69 69 static int lec_arp_remove(struct lec_priv *priv, 70 70 struct lec_arp_table *to_remove); 71 71 /* LANE2 functions */ 72 - static void lane2_associate_ind(struct net_device *dev, u8 *mac_address, 73 - u8 *tlvs, u32 sizeoftlvs); 74 - static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, 72 + static void lane2_associate_ind(struct net_device *dev, const u8 *mac_address, 73 + const u8 *tlvs, u32 sizeoftlvs); 74 + static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force, 75 75 u8 **tlvs, u32 *sizeoftlvs); 76 - static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, 77 - u8 *tlvs, u32 sizeoftlvs); 76 + static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, 77 + const u8 *tlvs, u32 sizeoftlvs); 78 78 79 - static int lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, 79 + static int lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr, 80 80 unsigned long permanent); 81 81 static void lec_arp_check_empties(struct lec_priv *priv, 82 82 struct atm_vcc *vcc, struct sk_buff *skb); 83 83 static void lec_arp_destroy(struct lec_priv *priv); 84 84 static void lec_arp_init(struct lec_priv *priv); 85 85 static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, 86 - unsigned char *mac_to_find, 86 + const unsigned char *mac_to_find, 87 87 int is_rdesc, 88 88 struct lec_arp_table **ret_entry); 89 - static void lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, 90 - unsigned char *atm_addr, unsigned long remoteflag, 89 + static void lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, 90 + const unsigned char *atm_addr, unsigned long remoteflag, 91 91 unsigned int targetless_le_arp); 92 92 static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id); 93 93 static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc); 94 94 static void lec_set_flush_tran_id(struct lec_priv *priv, 95 - unsigned char *atm_addr, 95 + const unsigned char *atm_addr, 96 96 unsigned long tran_id); 97 - static void lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, 97 + static void lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, 98 98 struct atm_vcc *vcc, 99 99 void (*old_push) (struct atm_vcc *vcc, 100 100 struct sk_buff *skb)); ··· 634 634 */ 635 635 static int 636 636 send_to_lecd(struct lec_priv *priv, atmlec_msg_type type, 637 - unsigned char *mac_addr, unsigned char *atm_addr, 637 + const unsigned char *mac_addr, const unsigned char *atm_addr, 638 638 struct sk_buff *data) 639 639 { 640 640 struct sock *sk; ··· 705 705 dev->set_multicast_list = lec_set_multicast_list; 706 706 dev->do_ioctl = NULL; 707 707 printk("%s: Initialized!\n", dev->name); 708 - return; 709 708 } 710 709 711 - static unsigned char lec_ctrl_magic[] = { 710 + static const unsigned char lec_ctrl_magic[] = { 712 711 0xff, 713 712 0x00, 714 713 0x01, ··· 1275 1276 * lec will be used. 1276 1277 * If dst_mac == NULL, targetless LE_ARP will be sent 1277 1278 */ 1278 - static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, 1279 + static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force, 1279 1280 u8 **tlvs, u32 *sizeoftlvs) 1280 1281 { 1281 1282 unsigned long flags; ··· 1321 1322 * Returns 1 for success, 0 for failure (out of memory) 1322 1323 * 1323 1324 */ 1324 - static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, 1325 - u8 *tlvs, u32 sizeoftlvs) 1325 + static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, 1326 + const u8 *tlvs, u32 sizeoftlvs) 1326 1327 { 1327 1328 int retval; 1328 1329 struct sk_buff *skb; ··· 1357 1358 * LANE2: 3.1.5, LE_ASSOCIATE.indication 1358 1359 * 1359 1360 */ 1360 - static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr, 1361 - u8 *tlvs, u32 sizeoftlvs) 1361 + static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr, 1362 + const u8 *tlvs, u32 sizeoftlvs) 1362 1363 { 1363 1364 #if 0 1364 1365 int i = 0; ··· 1743 1744 * Find entry by mac_address 1744 1745 */ 1745 1746 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, 1746 - unsigned char *mac_addr) 1747 + const unsigned char *mac_addr) 1747 1748 { 1748 1749 struct hlist_node *node; 1749 1750 struct hlist_head *head; ··· 1763 1764 } 1764 1765 1765 1766 static struct lec_arp_table *make_entry(struct lec_priv *priv, 1766 - unsigned char *mac_addr) 1767 + const unsigned char *mac_addr) 1767 1768 { 1768 1769 struct lec_arp_table *to_return; 1769 1770 ··· 1920 1921 * 1921 1922 */ 1922 1923 static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, 1923 - unsigned char *mac_to_find, int is_rdesc, 1924 + const unsigned char *mac_to_find, int is_rdesc, 1924 1925 struct lec_arp_table **ret_entry) 1925 1926 { 1926 1927 unsigned long flags; ··· 2016 2017 } 2017 2018 2018 2019 static int 2019 - lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, 2020 + lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr, 2020 2021 unsigned long permanent) 2021 2022 { 2022 2023 unsigned long flags; ··· 2046 2047 * Notifies: Response to arp_request (atm_addr != NULL) 2047 2048 */ 2048 2049 static void 2049 - lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, 2050 - unsigned char *atm_addr, unsigned long remoteflag, 2050 + lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, 2051 + const unsigned char *atm_addr, unsigned long remoteflag, 2051 2052 unsigned int targetless_le_arp) 2052 2053 { 2053 2054 unsigned long flags; ··· 2147 2148 * Notifies: Vcc setup ready 2148 2149 */ 2149 2150 static void 2150 - lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, 2151 + lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, 2151 2152 struct atm_vcc *vcc, 2152 2153 void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb)) 2153 2154 { ··· 2335 2336 2336 2337 static void 2337 2338 lec_set_flush_tran_id(struct lec_priv *priv, 2338 - unsigned char *atm_addr, unsigned long tran_id) 2339 + const unsigned char *atm_addr, unsigned long tran_id) 2339 2340 { 2340 2341 unsigned long flags; 2341 2342 struct hlist_node *node;
+5 -5
net/atm/lec.h
··· 42 42 * 43 43 */ 44 44 struct lane2_ops { 45 - int (*resolve) (struct net_device *dev, u8 *dst_mac, int force, 45 + int (*resolve) (struct net_device *dev, const u8 *dst_mac, int force, 46 46 u8 **tlvs, u32 *sizeoftlvs); 47 - int (*associate_req) (struct net_device *dev, u8 *lan_dst, 48 - u8 *tlvs, u32 sizeoftlvs); 49 - void (*associate_indicator) (struct net_device *dev, u8 *mac_addr, 50 - u8 *tlvs, u32 sizeoftlvs); 47 + int (*associate_req) (struct net_device *dev, const u8 *lan_dst, 48 + const u8 *tlvs, u32 sizeoftlvs); 49 + void (*associate_indicator) (struct net_device *dev, const u8 *mac_addr, 50 + const u8 *tlvs, u32 sizeoftlvs); 51 51 }; 52 52 53 53 /*