mirror of https://gitee.com/openkylin/linux.git
[NET] WANROUTER: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ac7bfa62f3
commit
4ba6122b4e
|
@ -247,11 +247,11 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
|
||||
/*
|
||||
* WAN_PACKET_DATA : Data which should be passed up the receive queue.
|
||||
* WAN_PACKET_ASYC : Asynchronous data like place call, which should
|
||||
* be passed up the listening sock.
|
||||
* WAN_PACKET_ERR : Asynchronous data like clear call or restart
|
||||
* which should go into an error queue.
|
||||
*/
|
||||
* WAN_PACKET_ASYC : Asynchronous data like place call, which should
|
||||
* be passed up the listening sock.
|
||||
* WAN_PACKET_ERR : Asynchronous data like clear call or restart
|
||||
* which should go into an error queue.
|
||||
*/
|
||||
switch (skb->pkt_type){
|
||||
|
||||
case WAN_PACKET_DATA:
|
||||
|
@ -262,9 +262,9 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
case WAN_PACKET_CMD:
|
||||
sk->sk_state = chan->state;
|
||||
/* Bug fix: update Mar6.
|
||||
* Do not set the sock lcn number here, since
|
||||
* cmd is not guaranteed to be executed on the
|
||||
* board, thus Lcn could be wrong */
|
||||
* Do not set the sock lcn number here, since
|
||||
* cmd is not guaranteed to be executed on the
|
||||
* board, thus Lcn could be wrong */
|
||||
sk->sk_data_ready(sk, skb->len);
|
||||
kfree_skb(skb);
|
||||
break;
|
||||
|
@ -328,7 +328,7 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
|
|||
wanpipe_common_t *chan;
|
||||
|
||||
/* Find a free device, if none found, all svc's are busy
|
||||
*/
|
||||
*/
|
||||
|
||||
card = (sdla_t*)wp->card;
|
||||
if (!card){
|
||||
|
@ -346,7 +346,7 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
|
|||
chan->state = WANSOCK_CONNECTING;
|
||||
|
||||
/* Allocate a new sock, which accept will bind
|
||||
* and pass up to the user
|
||||
* and pass up to the user
|
||||
*/
|
||||
if ((newsk = wanpipe_make_new(sk)) == NULL){
|
||||
release_device(dev);
|
||||
|
@ -361,15 +361,15 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
|
|||
newwp->card = wp->card;
|
||||
|
||||
/* Insert the sock into the main wanpipe
|
||||
* sock list.
|
||||
*/
|
||||
* sock list.
|
||||
*/
|
||||
atomic_inc(&wanpipe_socks_nr);
|
||||
|
||||
/* Allocate and fill in the new Mail Box. Then
|
||||
* bind the mail box to the sock. It will be
|
||||
* used by the ioctl call to read call information
|
||||
* and to execute commands.
|
||||
*/
|
||||
* bind the mail box to the sock. It will be
|
||||
* used by the ioctl call to read call information
|
||||
* and to execute commands.
|
||||
*/
|
||||
if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
|
||||
wanpipe_kill_sock_irq (newsk);
|
||||
release_device(dev);
|
||||
|
@ -378,8 +378,8 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
|
|||
memcpy(mbox_ptr,skb->data,skb->len);
|
||||
|
||||
/* Register the lcn on which incoming call came
|
||||
* from. Thus, if we have to clear it, we know
|
||||
* which lcn to clear
|
||||
* from. Thus, if we have to clear it, we know
|
||||
* which lcn to clear
|
||||
*/
|
||||
|
||||
newwp->lcn = mbox_ptr->cmd.lcn;
|
||||
|
@ -420,7 +420,7 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
|
|||
if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
|
||||
(unsigned)sk->sk_rcvbuf) {
|
||||
|
||||
wanpipe_unlink_driver(newsk);
|
||||
wanpipe_unlink_driver(newsk);
|
||||
wanpipe_kill_sock_irq (newsk);
|
||||
--sk->sk_ack_backlog;
|
||||
return -ENOMEM;
|
||||
|
@ -514,7 +514,7 @@ static struct sock *wanpipe_alloc_socket(void)
|
|||
wp_sk(sk) = wan_opt;
|
||||
|
||||
/* Use timer to send data to the driver. This will act
|
||||
* as a BH handler for sendmsg functions */
|
||||
* as a BH handler for sendmsg functions */
|
||||
init_timer(&wan_opt->tx_timer);
|
||||
wan_opt->tx_timer.data = (unsigned long)sk;
|
||||
wan_opt->tx_timer.function = wanpipe_delayed_transmit;
|
||||
|
@ -565,7 +565,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
|
|||
return(-EINVAL);
|
||||
|
||||
/* it was <=, now one can send
|
||||
* zero length packets */
|
||||
* zero length packets */
|
||||
if (len < sizeof(x25api_hdr_t))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -597,7 +597,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
|
|||
reserve = dev->hard_header_len;
|
||||
|
||||
if (len > dev->mtu+reserve){
|
||||
return -EMSGSIZE;
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev),
|
||||
|
@ -688,9 +688,9 @@ static void wanpipe_delayed_transmit (unsigned long data)
|
|||
}
|
||||
|
||||
/* If driver is executing command, we must offload
|
||||
* the board by not sending data. Otherwise a
|
||||
* pending command will never get a free buffer
|
||||
* to execute */
|
||||
* the board by not sending data. Otherwise a
|
||||
* pending command will never get a free buffer
|
||||
* to execute */
|
||||
if (atomic_read(&card->u.x.command_busy)){
|
||||
wp->tx_timer.expires = jiffies + SLOW_BACKOFF;
|
||||
add_timer(&wp->tx_timer);
|
||||
|
@ -712,16 +712,16 @@ static void wanpipe_delayed_transmit (unsigned long data)
|
|||
if (dev->hard_start_xmit(skb, dev) != 0){
|
||||
|
||||
/* Driver failed to transmit, re-enqueue
|
||||
* the packet and retry again later */
|
||||
* the packet and retry again later */
|
||||
skb_queue_head(&sk->sk_write_queue,skb);
|
||||
clear_bit(0,&wanpipe_tx_critical);
|
||||
return;
|
||||
}else{
|
||||
|
||||
/* Packet Sent successful. Check for more packets
|
||||
* if more packets, re-trigger the transmit routine
|
||||
* other wise exit
|
||||
*/
|
||||
* if more packets, re-trigger the transmit routine
|
||||
* other wise exit
|
||||
*/
|
||||
atomic_dec(&wp->packet_sent);
|
||||
|
||||
if (skb_peek(&sk->sk_write_queue) == NULL) {
|
||||
|
@ -962,9 +962,9 @@ static int wanpipe_release(struct socket *sock)
|
|||
check_write_queue(sk);
|
||||
|
||||
/* Kill the tx timer, if we don't kill it now, the timer
|
||||
* will run after we kill the sock. Timer code will
|
||||
* try to access the sock which has been killed and cause
|
||||
* kernel panic */
|
||||
* will run after we kill the sock. Timer code will
|
||||
* try to access the sock which has been killed and cause
|
||||
* kernel panic */
|
||||
|
||||
del_timer(&wp->tx_timer);
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
|
|||
int err=0;
|
||||
|
||||
/* This is x25 specific area if protocol doesn't
|
||||
* match, return error */
|
||||
* match, return error */
|
||||
if (sll->sll_protocol != htons(X25_PROT))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -1379,7 +1379,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
|
|||
}else if (!strcmp(sll->sll_device,"svc_connect")){
|
||||
|
||||
/* This is x25 specific area if protocol doesn't
|
||||
* match, return error */
|
||||
* match, return error */
|
||||
if (sll->sll_protocol != htons(X25_PROT))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -1393,8 +1393,8 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
|
|||
}
|
||||
}else{
|
||||
/* Bind a socket to a interface name
|
||||
* This is used by PVC mostly
|
||||
*/
|
||||
* This is used by PVC mostly
|
||||
*/
|
||||
strlcpy(name,sll->sll_device,sizeof(name));
|
||||
dev = dev_get_by_name(name);
|
||||
if (dev == NULL){
|
||||
|
@ -1732,7 +1732,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
|
|||
|
||||
if (msg == NETDEV_UNREGISTER) {
|
||||
printk(KERN_INFO "wansock: Unregistering Device: %s\n",
|
||||
dev->name);
|
||||
dev->name);
|
||||
wanpipe_unlink_driver(sk);
|
||||
sk->sk_bound_dev_if = 0;
|
||||
}
|
||||
|
@ -2094,10 +2094,10 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w
|
|||
|
||||
/* This check blocks the user process if there is
|
||||
* a packet already queued in the socket write queue.
|
||||
* This option is only for X25API protocol, for other
|
||||
* protocol like chdlc enable streaming mode,
|
||||
* where multiple packets can be pending in the socket
|
||||
* transmit queue */
|
||||
* This option is only for X25API protocol, for other
|
||||
* protocol like chdlc enable streaming mode,
|
||||
* where multiple packets can be pending in the socket
|
||||
* transmit queue */
|
||||
|
||||
if (wp_sk(sk)->num == htons(X25_PROT)) {
|
||||
if (atomic_read(&wp_sk(sk)->packet_sent))
|
||||
|
@ -2125,8 +2125,8 @@ static int wanpipe_listen(struct socket *sock, int backlog)
|
|||
{
|
||||
struct sock *sk = sock->sk;
|
||||
|
||||
/* This is x25 specific area if protocol doesn't
|
||||
* match, return error */
|
||||
/* This is x25 specific area if protocol doesn't
|
||||
* match, return error */
|
||||
if (wp_sk(sk)->num != htons(X25_PROT))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -2204,7 +2204,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
|
|||
}
|
||||
|
||||
/* This is x25 specific area if protocol doesn't
|
||||
* match, return error */
|
||||
* match, return error */
|
||||
if (wp->num != htons(X25_PROT))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -2223,10 +2223,10 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
|
|||
break;
|
||||
|
||||
/* Update. Mar6 2000.
|
||||
* Do not set the sock lcn number here, since
|
||||
* it is done in wanpipe_listen_rcv().
|
||||
*/
|
||||
if (sk->sk_state == WANSOCK_CONNECTED) {
|
||||
* Do not set the sock lcn number here, since
|
||||
* it is done in wanpipe_listen_rcv().
|
||||
*/
|
||||
if (sk->sk_state == WANSOCK_CONNECTED) {
|
||||
wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
|
||||
DBG_PRINTK(KERN_INFO "\nwansock: Accept OK %i\n",
|
||||
wp->lcn);
|
||||
|
@ -2249,12 +2249,12 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
|
|||
|
||||
|
||||
/* Check if data buffers are pending for transmission,
|
||||
* if so, check whether user wants to wait until data
|
||||
* is transmitted, or clear a call and drop packets */
|
||||
* if so, check whether user wants to wait until data
|
||||
* is transmitted, or clear a call and drop packets */
|
||||
|
||||
if (atomic_read(&sk->sk_wmem_alloc) ||
|
||||
check_driver_busy(sk)) {
|
||||
mbox_cmd_t *mbox = wp->mbox;
|
||||
mbox_cmd_t *mbox = wp->mbox;
|
||||
if (mbox->cmd.qdm & 0x80){
|
||||
mbox->cmd.result = 0x35;
|
||||
err = -EAGAIN;
|
||||
|
@ -2286,12 +2286,12 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
|
|||
|
||||
|
||||
/* Check if data buffers are pending for transmission,
|
||||
* if so, check whether user wants to wait until data
|
||||
* is transmitted, or reset a call and drop packets */
|
||||
* if so, check whether user wants to wait until data
|
||||
* is transmitted, or reset a call and drop packets */
|
||||
|
||||
if (atomic_read(&sk->sk_wmem_alloc) ||
|
||||
check_driver_busy(sk)) {
|
||||
mbox_cmd_t *mbox = wp->mbox;
|
||||
mbox_cmd_t *mbox = wp->mbox;
|
||||
if (mbox->cmd.qdm & 0x80){
|
||||
mbox->cmd.result = 0x35;
|
||||
err = -EAGAIN;
|
||||
|
|
|
@ -314,10 +314,10 @@ __be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev)
|
|||
cnt += 1;
|
||||
break;
|
||||
|
||||
case NLPID_SNAP: /* SNAP encapsulation */
|
||||
case NLPID_SNAP: /* SNAP encapsulation */
|
||||
if (memcmp(&skb->data[cnt + 1], wanrouter_oui_ether,
|
||||
sizeof(wanrouter_oui_ether))){
|
||||
printk(KERN_INFO
|
||||
printk(KERN_INFO
|
||||
"%s: unsupported SNAP OUI %02X-%02X-%02X "
|
||||
"on interface %s!\n", wanrouter_modname,
|
||||
skb->data[cnt+1], skb->data[cnt+2],
|
||||
|
@ -450,7 +450,7 @@ static int wanrouter_device_setup(struct wan_device *wandev,
|
|||
kfree(conf);
|
||||
printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n",
|
||||
wandev->name);
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (conf->data_size && conf->data) {
|
||||
|
@ -459,13 +459,13 @@ static int wanrouter_device_setup(struct wan_device *wandev,
|
|||
"%s: ERROR, Invalid firmware data size %i !\n",
|
||||
wandev->name, conf->data_size);
|
||||
kfree(conf);
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
data = vmalloc(conf->data_size);
|
||||
if (!data) {
|
||||
printk(KERN_INFO
|
||||
"%s: ERROR, Faild allocate kernel memory !\n",
|
||||
"%s: ERROR, Faild allocate kernel memory !\n",
|
||||
wandev->name);
|
||||
kfree(conf);
|
||||
return -ENOBUFS;
|
||||
|
@ -686,7 +686,7 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
|
|||
static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name)
|
||||
{
|
||||
char name[WAN_IFNAME_SZ + 1];
|
||||
int err = 0;
|
||||
int err = 0;
|
||||
|
||||
if (wandev->state == WAN_UNCONFIGURED)
|
||||
return -ENODEV;
|
||||
|
@ -709,8 +709,8 @@ static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_nam
|
|||
* interfaces are deleted and the link irrecoverably disconnected.
|
||||
*/
|
||||
|
||||
if (!wandev->ndev && wandev->shutdown)
|
||||
err = wandev->shutdown(wandev);
|
||||
if (!wandev->ndev && wandev->shutdown)
|
||||
err = wandev->shutdown(wandev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
|
|||
|
||||
static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
|
||||
{
|
||||
spin_lock_irqsave(lock, *smp_flags);
|
||||
spin_lock_irqsave(lock, *smp_flags);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
|
||||
#define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\
|
||||
(prot == WANCONFIG_X25) ? " X25" : \
|
||||
(prot == WANCONFIG_PPP) ? " PPP" : \
|
||||
(prot == WANCONFIG_PPP) ? " PPP" : \
|
||||
(prot == WANCONFIG_CHDLC) ? " CHDLC": \
|
||||
(prot == WANCONFIG_MPPP) ? " MPPP" : \
|
||||
" Unknown" )
|
||||
" Unknown" )
|
||||
|
||||
/****** Function Prototypes *************************************************/
|
||||
|
||||
|
|
Loading…
Reference in New Issue