Commit 036bca1f authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

n_gsm: drop unneeded gsm_dlci->fifo field

gsm_dlci->fifo always points to gsm_dlci->_fifo. So drop the pointer and
rename _fifo to fifo. And update all the users (add & to them).
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200219084949.28074-1-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21680a6d
...@@ -129,8 +129,7 @@ struct gsm_dlci { ...@@ -129,8 +129,7 @@ struct gsm_dlci {
int retries; int retries;
/* Uplink tty if active */ /* Uplink tty if active */
struct tty_port port; /* The tty bound to this DLCI if there is one */ struct tty_port port; /* The tty bound to this DLCI if there is one */
struct kfifo *fifo; /* Queue fifo for the DLCI */ struct kfifo fifo; /* Queue fifo for the DLCI */
struct kfifo _fifo; /* For new fifo API porting only */
int adaption; /* Adaption layer in use */ int adaption; /* Adaption layer in use */
int prev_adaption; int prev_adaption;
u32 modem_rx; /* Our incoming virtual modem lines */ u32 modem_rx; /* Our incoming virtual modem lines */
...@@ -796,7 +795,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) ...@@ -796,7 +795,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
total_size = 0; total_size = 0;
while (1) { while (1) {
len = kfifo_len(dlci->fifo); len = kfifo_len(&dlci->fifo);
if (len == 0) if (len == 0)
return total_size; return total_size;
...@@ -820,7 +819,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) ...@@ -820,7 +819,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
*dp++ = gsm_encode_modem(dlci); *dp++ = gsm_encode_modem(dlci);
break; break;
} }
WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != len); WARN_ON(kfifo_out_locked(&dlci->fifo, dp , len, &dlci->lock) != len);
__gsm_data_queue(dlci, msg); __gsm_data_queue(dlci, msg);
total_size += size; total_size += size;
} }
...@@ -1424,7 +1423,7 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) ...@@ -1424,7 +1423,7 @@ static void gsm_dlci_close(struct gsm_dlci *dlci)
dlci->state = DLCI_CLOSED; dlci->state = DLCI_CLOSED;
if (dlci->addr != 0) { if (dlci->addr != 0) {
tty_port_tty_hangup(&dlci->port, false); tty_port_tty_hangup(&dlci->port, false);
kfifo_reset(dlci->fifo); kfifo_reset(&dlci->fifo);
} else } else
dlci->gsm->dead = 1; dlci->gsm->dead = 1;
wake_up(&dlci->gsm->event); wake_up(&dlci->gsm->event);
...@@ -1645,8 +1644,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr) ...@@ -1645,8 +1644,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
return NULL; return NULL;
spin_lock_init(&dlci->lock); spin_lock_init(&dlci->lock);
mutex_init(&dlci->mutex); mutex_init(&dlci->mutex);
dlci->fifo = &dlci->_fifo; if (kfifo_alloc(&dlci->fifo, 4096, GFP_KERNEL) < 0) {
if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) {
kfree(dlci); kfree(dlci);
return NULL; return NULL;
} }
...@@ -1681,7 +1679,7 @@ static void gsm_dlci_free(struct tty_port *port) ...@@ -1681,7 +1679,7 @@ static void gsm_dlci_free(struct tty_port *port)
del_timer_sync(&dlci->t1); del_timer_sync(&dlci->t1);
dlci->gsm->dlci[dlci->addr] = NULL; dlci->gsm->dlci[dlci->addr] = NULL;
kfifo_free(dlci->fifo); kfifo_free(&dlci->fifo);
while ((dlci->skb = skb_dequeue(&dlci->skb_list))) while ((dlci->skb = skb_dequeue(&dlci->skb_list)))
dev_kfree_skb(dlci->skb); dev_kfree_skb(dlci->skb);
kfree(dlci); kfree(dlci);
...@@ -3030,7 +3028,7 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, ...@@ -3030,7 +3028,7 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
if (dlci->state == DLCI_CLOSED) if (dlci->state == DLCI_CLOSED)
return -EINVAL; return -EINVAL;
/* Stuff the bytes into the fifo queue */ /* Stuff the bytes into the fifo queue */
sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock); sent = kfifo_in_locked(&dlci->fifo, buf, len, &dlci->lock);
/* Need to kick the channel */ /* Need to kick the channel */
gsm_dlci_data_kick(dlci); gsm_dlci_data_kick(dlci);
return sent; return sent;
...@@ -3041,7 +3039,7 @@ static int gsmtty_write_room(struct tty_struct *tty) ...@@ -3041,7 +3039,7 @@ static int gsmtty_write_room(struct tty_struct *tty)
struct gsm_dlci *dlci = tty->driver_data; struct gsm_dlci *dlci = tty->driver_data;
if (dlci->state == DLCI_CLOSED) if (dlci->state == DLCI_CLOSED)
return -EINVAL; return -EINVAL;
return TX_SIZE - kfifo_len(dlci->fifo); return TX_SIZE - kfifo_len(&dlci->fifo);
} }
static int gsmtty_chars_in_buffer(struct tty_struct *tty) static int gsmtty_chars_in_buffer(struct tty_struct *tty)
...@@ -3049,7 +3047,7 @@ static int gsmtty_chars_in_buffer(struct tty_struct *tty) ...@@ -3049,7 +3047,7 @@ static int gsmtty_chars_in_buffer(struct tty_struct *tty)
struct gsm_dlci *dlci = tty->driver_data; struct gsm_dlci *dlci = tty->driver_data;
if (dlci->state == DLCI_CLOSED) if (dlci->state == DLCI_CLOSED)
return -EINVAL; return -EINVAL;
return kfifo_len(dlci->fifo); return kfifo_len(&dlci->fifo);
} }
static void gsmtty_flush_buffer(struct tty_struct *tty) static void gsmtty_flush_buffer(struct tty_struct *tty)
...@@ -3061,7 +3059,7 @@ static void gsmtty_flush_buffer(struct tty_struct *tty) ...@@ -3061,7 +3059,7 @@ static void gsmtty_flush_buffer(struct tty_struct *tty)
then the data being transmitted can't simply be junked once then the data being transmitted can't simply be junked once
it has first hit the stack. Until then we can just blow it it has first hit the stack. Until then we can just blow it
away */ away */
kfifo_reset(dlci->fifo); kfifo_reset(&dlci->fifo);
/* Need to unhook this DLCI from the transmit queue logic */ /* Need to unhook this DLCI from the transmit queue logic */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment