Skip to contentSkip to conversation

Bluetooth: hci_uart: Make struct hci_uart_proto always const

PATCH Applied Marcel Holtmann 2 participants 2 messages Apr 5, 2015 Bluetooth drivers

lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_uart: Make struct hci_uart_proto always const

The usage of struct hci_uart_proto should always be const. Change the function headers and individual protocol drivers.

---
 drivers/bluetooth/hci_ath.c   |  2 +-
 drivers/bluetooth/hci_bcsp.c  |  2 +-
 drivers/bluetooth/hci_h4.c    |  2 +-
 drivers/bluetooth/hci_h5.c    |  2 +-
 drivers/bluetooth/hci_ldisc.c | 10 +++++-----
 drivers/bluetooth/hci_ll.c    |  2 +-
 drivers/bluetooth/hci_uart.h  |  6 +++---
 7 files changed, 13 insertions(+), 13 deletions(-)
drivers/bluetooth/hci_ath.c +1 -1
index 15beb974f3a0..c1c0b0c7e1c9 100644
@@ -205,7 +205,7 @@ static int ath_recv(struct hci_uart *hu, const void *data, int count)
 	return count;
 }
 
-static struct hci_uart_proto athp = {
+static const struct hci_uart_proto athp = {
 	.id = HCI_UART_ATH3K,
 	.open = ath_open,
 	.close = ath_close,
drivers/bluetooth/hci_bcsp.c +1 -1
index 50ef2e613d59..7d30e05a973f 100644
@@ -735,7 +735,7 @@ static int bcsp_close(struct hci_uart *hu)
 	return 0;
 }
 
-static struct hci_uart_proto bcsp = {
+static const struct hci_uart_proto bcsp = {
 	.id		= HCI_UART_BCSP,
 	.open		= bcsp_open,
 	.close		= bcsp_close,
drivers/bluetooth/hci_h4.c +1 -1
index d8414540f743..fc783103ee36 100644
@@ -139,7 +139,7 @@ static struct sk_buff *h4_dequeue(struct hci_uart *hu)
 	return skb_dequeue(&h4->txq);
 }
 
-static struct hci_uart_proto h4p = {
+static const struct hci_uart_proto h4p = {
 	.id		= HCI_UART_H4,
 	.open		= h4_open,
 	.close		= h4_close,
drivers/bluetooth/hci_h5.c +1 -1
index 0f681cc1af64..aac0e8f718b0 100644
@@ -743,7 +743,7 @@ static int h5_flush(struct hci_uart *hu)
 	return 0;
 }
 
-static struct hci_uart_proto h5p = {
+static const struct hci_uart_proto h5p = {
 	.id		= HCI_UART_3WIRE,
 	.open		= h5_open,
 	.close		= h5_close,
drivers/bluetooth/hci_ldisc.c +5 -5
index 50dbaf3579ed..ba3b988ce60a 100644
@@ -48,9 +48,9 @@
 
 #define VERSION "2.2"
 
-static struct hci_uart_proto *hup[HCI_UART_MAX_PROTO];
+static const struct hci_uart_proto *hup[HCI_UART_MAX_PROTO];
 
-int hci_uart_register_proto(struct hci_uart_proto *p)
+int hci_uart_register_proto(const struct hci_uart_proto *p)
 {
 	if (p->id >= HCI_UART_MAX_PROTO)
 		return -EINVAL;
@@ -63,7 +63,7 @@ int hci_uart_register_proto(struct hci_uart_proto *p)
 	return 0;
 }
 
-int hci_uart_unregister_proto(struct hci_uart_proto *p)
+int hci_uart_unregister_proto(const struct hci_uart_proto *p)
 {
 	if (p->id >= HCI_UART_MAX_PROTO)
 		return -EINVAL;
@@ -76,7 +76,7 @@ int hci_uart_unregister_proto(struct hci_uart_proto *p)
 	return 0;
 }
 
-static struct hci_uart_proto *hci_uart_get_proto(unsigned int id)
+static const struct hci_uart_proto *hci_uart_get_proto(unsigned int id)
 {
 	if (id >= HCI_UART_MAX_PROTO)
 		return NULL;
@@ -506,7 +506,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
 
 static int hci_uart_set_proto(struct hci_uart *hu, int id)
 {
-	struct hci_uart_proto *p;
+	const struct hci_uart_proto *p;
 	int err;
 
 	p = hci_uart_get_proto(id);
drivers/bluetooth/hci_ll.c +1 -1
index 79eea1cbd988..e66f0fa65485 100644
@@ -505,7 +505,7 @@ static struct sk_buff *ll_dequeue(struct hci_uart *hu)
 	return skb_dequeue(&ll->txq);
 }
 
-static struct hci_uart_proto llp = {
+static const struct hci_uart_proto llp = {
 	.id		= HCI_UART_LL,
 	.open		= ll_open,
 	.close		= ll_close,
drivers/bluetooth/hci_uart.h +3 -3
index 53b329229f2e..683153d2e9db 100644
@@ -75,7 +75,7 @@ struct hci_uart {
 	struct work_struct	init_ready;
 	struct work_struct	write_work;
 
-	struct hci_uart_proto	*proto;
+	const struct hci_uart_proto *proto;
 	void			*priv;
 
 	struct sk_buff		*tx_skb;
@@ -91,8 +91,8 @@ struct hci_uart {
 #define HCI_UART_SENDING	1
 #define HCI_UART_TX_WAKEUP	2
 
-int hci_uart_register_proto(struct hci_uart_proto *p);
-int hci_uart_unregister_proto(struct hci_uart_proto *p);
+int hci_uart_register_proto(const struct hci_uart_proto *p);
+int hci_uart_unregister_proto(const struct hci_uart_proto *p);
 int hci_uart_tx_wakeup(struct hci_uart *hu);
 int hci_uart_init_ready(struct hci_uart *hu);
 
Signature · 1 line
2.1.0
#1 lore raw

Hi Marcel,

Quoted 4 lines · Marcel Holtmann

The usage of struct hci_uart_proto should always be const. Change the function headers and individual protocol drivers.

Quoted 9 lines
---
 drivers/bluetooth/hci_ath.c   |  2 +-
 drivers/bluetooth/hci_bcsp.c  |  2 +-
 drivers/bluetooth/hci_h4.c    |  2 +-
 drivers/bluetooth/hci_h5.c    |  2 +-
 drivers/bluetooth/hci_ldisc.c | 10 +++++-----
 drivers/bluetooth/hci_ll.c    |  2 +-
 drivers/bluetooth/hci_uart.h  |  6 +++---
 7 files changed, 13 insertions(+), 13 deletions(-)

Applied to bluetooth-next. Thanks.

Johan