Skip to contentSkip to conversation

Bluetooth: Use const for struct l2cap_ops field

PATCH Applied Marcel Holtmann 2 participants 2 messages Jun 8, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Use const for struct l2cap_ops field

The struct l2cap_ops field should not allow any modifications and thus it is better declared as const.

---
 include/net/bluetooth/l2cap.h | 2 +-
 net/bluetooth/a2mp.c          | 2 +-
 net/bluetooth/l2cap_sock.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
include/net/bluetooth/l2cap.h +1 -1
index ca1294260de1..18f4f27e0f74 100644
@@ -579,7 +579,7 @@ struct l2cap_chan {
 	struct list_head	global_l;
 
 	void			*data;
-	struct l2cap_ops	*ops;
+	const struct l2cap_ops	*ops;
 	struct mutex		lock;
 };
 
net/bluetooth/a2mp.c +1 -1
index 0b7ec20981f8..1a5b1eb96d1a 100644
@@ -704,7 +704,7 @@ static struct sk_buff *a2mp_chan_alloc_skb_cb(struct l2cap_chan *chan,
 	return skb;
 }
 
-static struct l2cap_ops a2mp_chan_ops = {
+static const struct l2cap_ops a2mp_chan_ops = {
 	.name = "L2CAP A2MP channel",
 	.recv = a2mp_chan_recv_cb,
 	.close = a2mp_chan_close_cb,
net/bluetooth/l2cap_sock.c +1 -1
index f12c855a5a76..a083a24d80ae 100644
@@ -1382,7 +1382,7 @@ static void l2cap_sock_suspend_cb(struct l2cap_chan *chan)
 	sk->sk_state_change(sk);
 }
 
-static struct l2cap_ops l2cap_chan_ops = {
+static const struct l2cap_ops l2cap_chan_ops = {
 	.name		= "L2CAP Socket Interface",
 	.new_connection	= l2cap_sock_new_connection_cb,
 	.recv		= l2cap_sock_recv_cb,
Signature · 1 line
1.9.3
#1 lore raw

Hi Marcel,

Quoted 9 lines · Marcel Holtmann

The struct l2cap_ops field should not allow any modifications and thus it is better declared as const.

---
 include/net/bluetooth/l2cap.h | 2 +-
 net/bluetooth/a2mp.c          | 2 +-
 net/bluetooth/l2cap_sock.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Applied to bluetooth-next. Thanks.

Johan