Skip to content

Commit 61c33e0

Browse files
Mitchell Blank Jrdavem330
authored andcommitted
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>
1 parent df3bc8b commit 61c33e0

6 files changed

Lines changed: 50 additions & 51 deletions

File tree

‎net/atm/addr.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "signaling.h"
1010
#include "addr.h"
1111

12-
static int check_addr(struct sockaddr_atmsvc *addr)
12+
static int check_addr(const struct sockaddr_atmsvc *addr)
1313
{
1414
int i;
1515

@@ -23,7 +23,7 @@ static int check_addr(struct sockaddr_atmsvc *addr)
2323
return -EINVAL;
2424
}
2525

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)
2727
{
2828
if (*a->sas_addr.prv)
2929
if (memcmp(a->sas_addr.prv, b->sas_addr.prv, ATM_ESA_LEN))
@@ -35,7 +35,7 @@ static int identical(struct sockaddr_atmsvc *a, struct sockaddr_atmsvc *b)
3535
return !strcmp(a->sas_addr.pub, b->sas_addr.pub);
3636
}
3737

38-
static void notify_sigd(struct atm_dev *dev)
38+
static void notify_sigd(const struct atm_dev *dev)
3939
{
4040
struct sockaddr_atmpvc pvc;
4141

@@ -63,7 +63,7 @@ void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype)
6363
notify_sigd(dev);
6464
}
6565

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,
6767
enum atm_addr_type_t atype)
6868
{
6969
unsigned long flags;
@@ -98,7 +98,7 @@ int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
9898
return 0;
9999
}
100100

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,
102102
enum atm_addr_type_t atype)
103103
{
104104
unsigned long flags;

‎net/atm/addr.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include <linux/atmdev.h>
1111

1212
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,
1414
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,
1616
enum atm_addr_type_t type);
1717
int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf,
1818
size_t size, enum atm_addr_type_t type);

‎net/atm/br2684.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ static void skb_debug(const struct sk_buff *skb)
5252
#define ETHERTYPE_IPV6 0x86, 0xdd
5353
#define PAD_BRIDGED 0x00, 0x00
5454

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[] =
5858
{ 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 };
6161

6262
enum br2684_encaps {
6363
e_vc = BR2684_ENCAPS_VC,
@@ -217,8 +217,8 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
217217
return 1;
218218
}
219219

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)
222222
{
223223
return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */
224224
}

‎net/atm/common.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int adjust_tp(struct atm_trafprm *tp,unsigned char aal)
262262
}
263263

264264

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)
266266
{
267267
struct hlist_head *head = &vcc_hash[vci &
268268
(VCC_HTABLE_SIZE - 1)];
@@ -290,7 +290,7 @@ static int check_ci(struct atm_vcc *vcc, short vpi, int vci)
290290
}
291291

292292

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)
294294
{
295295
static short p; /* poor man's per-device cache */
296296
static int c;
@@ -646,7 +646,7 @@ static int atm_change_qos(struct atm_vcc *vcc,struct atm_qos *qos)
646646
}
647647

648648

649-
static int check_tp(struct atm_trafprm *tp)
649+
static int check_tp(const struct atm_trafprm *tp)
650650
{
651651
/* @@@ Should be merged with adjust_tp */
652652
if (!tp->traffic_class || tp->traffic_class == ATM_ANYCLASS) return 0;
@@ -663,7 +663,7 @@ static int check_tp(struct atm_trafprm *tp)
663663
}
664664

665665

666-
static int check_qos(struct atm_qos *qos)
666+
static int check_qos(const struct atm_qos *qos)
667667
{
668668
int error;
669669

‎net/atm/lec.c‎

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,36 @@ static int lec_close(struct net_device *dev);
6565
static struct net_device_stats *lec_get_stats(struct net_device *dev);
6666
static void lec_init(struct net_device *dev);
6767
static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
68-
unsigned char *mac_addr);
68+
const unsigned char *mac_addr);
6969
static int lec_arp_remove(struct lec_priv *priv,
7070
struct lec_arp_table *to_remove);
7171
/* 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,
7575
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);
7878

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,
8080
unsigned long permanent);
8181
static void lec_arp_check_empties(struct lec_priv *priv,
8282
struct atm_vcc *vcc, struct sk_buff *skb);
8383
static void lec_arp_destroy(struct lec_priv *priv);
8484
static void lec_arp_init(struct lec_priv *priv);
8585
static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
86-
unsigned char *mac_to_find,
86+
const unsigned char *mac_to_find,
8787
int is_rdesc,
8888
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,
9191
unsigned int targetless_le_arp);
9292
static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id);
9393
static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc);
9494
static void lec_set_flush_tran_id(struct lec_priv *priv,
95-
unsigned char *atm_addr,
95+
const unsigned char *atm_addr,
9696
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,
9898
struct atm_vcc *vcc,
9999
void (*old_push) (struct atm_vcc *vcc,
100100
struct sk_buff *skb));
@@ -634,7 +634,7 @@ static struct atm_dev lecatm_dev = {
634634
*/
635635
static int
636636
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,
638638
struct sk_buff *data)
639639
{
640640
struct sock *sk;
@@ -705,10 +705,9 @@ static void lec_init(struct net_device *dev)
705705
dev->set_multicast_list = lec_set_multicast_list;
706706
dev->do_ioctl = NULL;
707707
printk("%s: Initialized!\n", dev->name);
708-
return;
709708
}
710709

711-
static unsigned char lec_ctrl_magic[] = {
710+
static const unsigned char lec_ctrl_magic[] = {
712711
0xff,
713712
0x00,
714713
0x01,
@@ -1276,7 +1275,7 @@ module_exit(lane_module_cleanup);
12761275
* lec will be used.
12771276
* If dst_mac == NULL, targetless LE_ARP will be sent
12781277
*/
1279-
static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force,
1278+
static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force,
12801279
u8 **tlvs, u32 *sizeoftlvs)
12811280
{
12821281
unsigned long flags;
@@ -1322,8 +1321,8 @@ static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force,
13221321
* Returns 1 for success, 0 for failure (out of memory)
13231322
*
13241323
*/
1325-
static int lane2_associate_req(struct net_device *dev, u8 *lan_dst,
1326-
u8 *tlvs, u32 sizeoftlvs)
1324+
static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
1325+
const u8 *tlvs, u32 sizeoftlvs)
13271326
{
13281327
int retval;
13291328
struct sk_buff *skb;
@@ -1358,8 +1357,8 @@ static int lane2_associate_req(struct net_device *dev, u8 *lan_dst,
13581357
* LANE2: 3.1.5, LE_ASSOCIATE.indication
13591358
*
13601359
*/
1361-
static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
1362-
u8 *tlvs, u32 sizeoftlvs)
1360+
static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,
1361+
const u8 *tlvs, u32 sizeoftlvs)
13631362
{
13641363
#if 0
13651364
int i = 0;
@@ -1744,7 +1743,7 @@ static void lec_arp_destroy(struct lec_priv *priv)
17441743
* Find entry by mac_address
17451744
*/
17461745
static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
1747-
unsigned char *mac_addr)
1746+
const unsigned char *mac_addr)
17481747
{
17491748
struct hlist_node *node;
17501749
struct hlist_head *head;
@@ -1764,7 +1763,7 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
17641763
}
17651764

17661765
static struct lec_arp_table *make_entry(struct lec_priv *priv,
1767-
unsigned char *mac_addr)
1766+
const unsigned char *mac_addr)
17681767
{
17691768
struct lec_arp_table *to_return;
17701769

@@ -1921,7 +1920,7 @@ static void lec_arp_check_expire(struct work_struct *work)
19211920
*
19221921
*/
19231922
static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
1924-
unsigned char *mac_to_find, int is_rdesc,
1923+
const unsigned char *mac_to_find, int is_rdesc,
19251924
struct lec_arp_table **ret_entry)
19261925
{
19271926
unsigned long flags;
@@ -2017,7 +2016,7 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
20172016
}
20182017

20192018
static int
2020-
lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
2019+
lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr,
20212020
unsigned long permanent)
20222021
{
20232022
unsigned long flags;
@@ -2047,8 +2046,8 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
20472046
* Notifies: Response to arp_request (atm_addr != NULL)
20482047
*/
20492048
static void
2050-
lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
2051-
unsigned char *atm_addr, unsigned long remoteflag,
2049+
lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr,
2050+
const unsigned char *atm_addr, unsigned long remoteflag,
20522051
unsigned int targetless_le_arp)
20532052
{
20542053
unsigned long flags;
@@ -2148,7 +2147,7 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
21482147
* Notifies: Vcc setup ready
21492148
*/
21502149
static void
2151-
lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
2150+
lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
21522151
struct atm_vcc *vcc,
21532152
void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb))
21542153
{
@@ -2336,7 +2335,7 @@ static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id)
23362335

23372336
static void
23382337
lec_set_flush_tran_id(struct lec_priv *priv,
2339-
unsigned char *atm_addr, unsigned long tran_id)
2338+
const unsigned char *atm_addr, unsigned long tran_id)
23402339
{
23412340
unsigned long flags;
23422341
struct hlist_node *node;

‎net/atm/lec.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ struct lecdatahdr_8025 {
4242
*
4343
*/
4444
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,
4646
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);
5151
};
5252

5353
/*

0 commit comments

Comments
 (0)