]> err.no Git - linux-2.6/blobdiff - drivers/s390/net/ctcmain.c
firewire: cleanups
[linux-2.6] / drivers / s390 / net / ctcmain.c
index 92e8a37b50220f85517bc5367667f1db526f653c..77a503139e327fe7d1597c8aec6bf43b0301b438 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
  * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
- * Fixes by : Jochen Röhrig (roehrig@de.ibm.com)
+ * Fixes by : Jochen Röhrig (roehrig@de.ibm.com)
  *            Arnaldo Carvalho de Melo <acme@conectiva.com.br>
              Peter Tiedemann (ptiedem@de.ibm.com)
  * Driver Model stuff by : Cornelia Huck <cornelia.huck@de.ibm.com>
@@ -19,7 +19,7 @@
  *  Dieter Wellerdiek (wel@de.ibm.com)
  *  Martin Schwidefsky (schwidefsky@de.ibm.com)
  *  Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *  Jochen Röhrig (roehrig@de.ibm.com)
+ *  Jochen Röhrig (roehrig@de.ibm.com)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -478,14 +478,14 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
                skb->dev = pskb->dev;
                skb->protocol = pskb->protocol;
                pskb->ip_summed = CHECKSUM_UNNECESSARY;
-               netif_rx_ni(skb);
                /**
-                * Successful rx; reset logflags
+                * reset logflags
                 */
                ch->logflags = 0;
-               dev->last_rx = jiffies;
                privptr->stats.rx_packets++;
                privptr->stats.rx_bytes += skb->len;
+               netif_rx_ni(skb);
+               dev->last_rx = jiffies;
                if (len > 0) {
                        skb_pull(pskb, header->length);
                        if (skb_tailroom(pskb) < LL_HEADER_LENGTH) {
@@ -885,7 +885,7 @@ ch_action_firstio(fsm_instance * fi, int event, void *arg)
        }
 
        /**
-        * Don´t setup a timer for receiving the initial RX frame
+        * Don't setup a timer for receiving the initial RX frame
         * if in compatibility mode, since VM TCP delays the initial
         * frame until it has some data to send.
         */
@@ -905,10 +905,10 @@ ch_action_firstio(fsm_instance * fi, int event, void *arg)
                ccw_check_return_code(ch, rc, "init IO");
        }
        /**
-        * If in compatibility mode since we don´t setup a timer, we
+        * If in compatibility mode since we don't setup a timer, we
         * also signal RX channel up immediately. This enables us
         * to send packets early which in turn usually triggers some
-        * reply from VM TCP which brings up the RX channel to it´s
+        * reply from VM TCP which brings up the RX channel to it's
         * final state.
         */
        if ((CHANNEL_DIRECTION(ch->flags) == READ) &&
@@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device *cgdev)
 }
 
 /**
- * Initialize everything of the net device except the name and the
- * channel structs.
+ * Device setup function called by alloc_netdev().
+ *
+ * @param dev  Device to be setup.
  */
-static struct net_device *
-ctc_init_netdevice(struct net_device * dev, int alloc_device,
-                  struct ctc_priv *privptr)
+void ctc_init_netdevice(struct net_device * dev)
 {
-       if (!privptr)
-               return NULL;
-
        DBF_TEXT(setup, 3, __FUNCTION__);
 
-       if (alloc_device) {
-               dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
-               if (!dev)
-                       return NULL;
-       }
-
-       dev->priv = privptr;
-       privptr->fsm = init_fsm("ctcdev", dev_state_names,
-                               dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
-                               dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
-       if (privptr->fsm == NULL) {
-               if (alloc_device)
-                       kfree(dev);
-               return NULL;
-       }
-       fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
-       fsm_settimer(privptr->fsm, &privptr->restart_timer);
        if (dev->mtu == 0)
                dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
        dev->hard_start_xmit = ctc_tx;
@@ -2823,8 +2802,6 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
        dev->type = ARPHRD_SLIP;
        dev->tx_queue_len = 100;
        dev->flags = IFF_POINTOPOINT | IFF_NOARP;
-       SET_MODULE_OWNER(dev);
-       return dev;
 }
 
 
@@ -2880,14 +2857,22 @@ ctc_new_device(struct ccwgroup_device *cgdev)
                        "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret);
        }
 
-       dev = ctc_init_netdevice(NULL, 1, privptr);
-
+       dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
        if (!dev) {
                ctc_pr_warn("ctc_init_netdevice failed\n");
                goto out;
        }
+       dev->priv = privptr;
 
-       strlcpy(dev->name, "ctc%d", IFNAMSIZ);
+       privptr->fsm = init_fsm("ctcdev", dev_state_names,
+                       dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
+                       dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
+       if (privptr->fsm == NULL) {
+               free_netdev(dev);
+               goto out;
+       }
+       fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
+       fsm_settimer(privptr->fsm, &privptr->restart_timer);
 
        for (direction = READ; direction <= WRITE; direction++) {
                privptr->channel[direction] =