aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-04-11 08:35:37 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-04-29 19:05:29 -0400
commitc0ba7acd48d122fe5941c8f402fc1ee024cac6fb (patch)
tree265a57faae13ead433319b4f2a6323c484453568
parent50862ee5578efa342a25c8b86f0080494736057f (diff)
Bluetooth: hci_uart: Reorder Atheros specific driver callbacks
The driver callbacks in the Atheros support were all in a random order and did not help readability of this driver. So reorder them to make them aligned with what other Bluetooth UART drivers do. This patch is not changing any actual code. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--drivers/bluetooth/hci_ath.c66
1 files changed, 30 insertions, 36 deletions
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c
index 1b3f8647ea2f..42f13d0b437f 100644
--- a/drivers/bluetooth/hci_ath.c
+++ b/drivers/bluetooth/hci_ath.c
@@ -95,7 +95,6 @@ static void ath_hci_uart_work(struct work_struct *work)
95 hci_uart_tx_wakeup(hu); 95 hci_uart_tx_wakeup(hu);
96} 96}
97 97
98/* Initialize protocol */
99static int ath_open(struct hci_uart *hu) 98static int ath_open(struct hci_uart *hu)
100{ 99{
101 struct ath_struct *ath; 100 struct ath_struct *ath;
@@ -116,8 +115,7 @@ static int ath_open(struct hci_uart *hu)
116 return 0; 115 return 0;
117} 116}
118 117
119/* Flush protocol data */ 118static int ath_close(struct hci_uart *hu)
120static int ath_flush(struct hci_uart *hu)
121{ 119{
122 struct ath_struct *ath = hu->priv; 120 struct ath_struct *ath = hu->priv;
123 121
@@ -125,11 +123,17 @@ static int ath_flush(struct hci_uart *hu)
125 123
126 skb_queue_purge(&ath->txq); 124 skb_queue_purge(&ath->txq);
127 125
126 kfree_skb(ath->rx_skb);
127
128 cancel_work_sync(&ath->ctxtsw);
129
130 hu->priv = NULL;
131 kfree(ath);
132
128 return 0; 133 return 0;
129} 134}
130 135
131/* Close protocol */ 136static int ath_flush(struct hci_uart *hu)
132static int ath_close(struct hci_uart *hu)
133{ 137{
134 struct ath_struct *ath = hu->priv; 138 struct ath_struct *ath = hu->priv;
135 139
@@ -137,19 +141,32 @@ static int ath_close(struct hci_uart *hu)
137 141
138 skb_queue_purge(&ath->txq); 142 skb_queue_purge(&ath->txq);
139 143
140 kfree_skb(ath->rx_skb); 144 return 0;
145}
141 146
142 cancel_work_sync(&ath->ctxtsw); 147static const struct h4_recv_pkt ath_recv_pkts[] = {
148 { H4_RECV_ACL, .recv = hci_recv_frame },
149 { H4_RECV_SCO, .recv = hci_recv_frame },
150 { H4_RECV_EVENT, .recv = hci_recv_frame },
151};
143 152
144 hu->priv = NULL; 153static int ath_recv(struct hci_uart *hu, const void *data, int count)
145 kfree(ath); 154{
155 struct ath_struct *ath = hu->priv;
146 156
147 return 0; 157 ath->rx_skb = h4_recv_buf(hu->hdev, ath->rx_skb, data, count,
158 ath_recv_pkts, ARRAY_SIZE(ath_recv_pkts));
159 if (IS_ERR(ath->rx_skb)) {
160 int err = PTR_ERR(ath->rx_skb);
161 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);
162 return err;
163 }
164
165 return count;
148} 166}
149 167
150#define HCI_OP_ATH_SLEEP 0xFC04 168#define HCI_OP_ATH_SLEEP 0xFC04
151 169
152/* Enqueue frame for transmittion */
153static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) 170static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
154{ 171{
155 struct ath_struct *ath = hu->priv; 172 struct ath_struct *ath = hu->priv;
@@ -159,8 +176,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
159 return 0; 176 return 0;
160 } 177 }
161 178
162 /* 179 /* Update power management enable flag with parameters of
163 * Update power management enable flag with parameters of
164 * HCI sleep enable vendor specific HCI command. 180 * HCI sleep enable vendor specific HCI command.
165 */ 181 */
166 if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { 182 if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) {
@@ -190,37 +206,15 @@ static struct sk_buff *ath_dequeue(struct hci_uart *hu)
190 return skb_dequeue(&ath->txq); 206 return skb_dequeue(&ath->txq);
191} 207}
192 208
193static const struct h4_recv_pkt ath_recv_pkts[] = {
194 { H4_RECV_ACL, .recv = hci_recv_frame },
195 { H4_RECV_SCO, .recv = hci_recv_frame },
196 { H4_RECV_EVENT, .recv = hci_recv_frame },
197};
198
199/* Recv data */
200static int ath_recv(struct hci_uart *hu, const void *data, int count)
201{
202 struct ath_struct *ath = hu->priv;
203
204 ath->rx_skb = h4_recv_buf(hu->hdev, ath->rx_skb, data, count,
205 ath_recv_pkts, ARRAY_SIZE(ath_recv_pkts));
206 if (IS_ERR(ath->rx_skb)) {
207 int err = PTR_ERR(ath->rx_skb);
208 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);
209 return err;
210 }
211
212 return count;
213}
214
215static const struct hci_uart_proto athp = { 209static const struct hci_uart_proto athp = {
216 .id = HCI_UART_ATH3K, 210 .id = HCI_UART_ATH3K,
217 .name = "ATH3K", 211 .name = "ATH3K",
218 .open = ath_open, 212 .open = ath_open,
219 .close = ath_close, 213 .close = ath_close,
214 .flush = ath_flush,
220 .recv = ath_recv, 215 .recv = ath_recv,
221 .enqueue = ath_enqueue, 216 .enqueue = ath_enqueue,
222 .dequeue = ath_dequeue, 217 .dequeue = ath_dequeue,
223 .flush = ath_flush,
224}; 218};
225 219
226int __init ath_init(void) 220int __init ath_init(void)