Bluetooth: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. As already done in hci_qca, add struct hci_uart pointer to priv structure. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:

committed by
Marcel Holtmann

parent
8a92056837
commit
0435605289
@@ -78,6 +78,7 @@ struct h5 {
|
||||
int (*rx_func)(struct hci_uart *hu, u8 c);
|
||||
|
||||
struct timer_list timer; /* Retransmission timer */
|
||||
struct hci_uart *hu; /* Parent HCI UART */
|
||||
|
||||
u8 tx_seq; /* Next seq number to send */
|
||||
u8 tx_ack; /* Next ack number to send */
|
||||
@@ -120,12 +121,12 @@ static u8 h5_cfg_field(struct h5 *h5)
|
||||
return h5->tx_win & 0x07;
|
||||
}
|
||||
|
||||
static void h5_timed_event(unsigned long arg)
|
||||
static void h5_timed_event(struct timer_list *t)
|
||||
{
|
||||
const unsigned char sync_req[] = { 0x01, 0x7e };
|
||||
unsigned char conf_req[3] = { 0x03, 0xfc };
|
||||
struct hci_uart *hu = (struct hci_uart *)arg;
|
||||
struct h5 *h5 = hu->priv;
|
||||
struct h5 *h5 = from_timer(h5, t, timer);
|
||||
struct hci_uart *hu = h5->hu;
|
||||
struct sk_buff *skb;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -197,6 +198,7 @@ static int h5_open(struct hci_uart *hu)
|
||||
return -ENOMEM;
|
||||
|
||||
hu->priv = h5;
|
||||
h5->hu = hu;
|
||||
|
||||
skb_queue_head_init(&h5->unack);
|
||||
skb_queue_head_init(&h5->rel);
|
||||
@@ -204,7 +206,7 @@ static int h5_open(struct hci_uart *hu)
|
||||
|
||||
h5_reset_rx(h5);
|
||||
|
||||
setup_timer(&h5->timer, h5_timed_event, (unsigned long)hu);
|
||||
timer_setup(&h5->timer, h5_timed_event, 0);
|
||||
|
||||
h5->tx_win = H5_TX_WIN_MAX;
|
||||
|
||||
|
Reference in New Issue
Block a user