diff options
Diffstat (limited to 'drivers/s390/net/ctcmain.c')
-rw-r--r-- | drivers/s390/net/ctcmain.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index 6bf3ebbe985a..97adc701a819 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device *cgdev) | |||
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | /** | 2784 | /** |
2785 | * Initialize everything of the net device except the name and the | 2785 | * Device setup function called by alloc_netdev(). |
2786 | * channel structs. | 2786 | * |
2787 | * @param dev Device to be setup. | ||
2787 | */ | 2788 | */ |
2788 | static struct net_device * | 2789 | void ctc_init_netdevice(struct net_device * dev) |
2789 | ctc_init_netdevice(struct net_device * dev, int alloc_device, | ||
2790 | struct ctc_priv *privptr) | ||
2791 | { | 2790 | { |
2792 | if (!privptr) | ||
2793 | return NULL; | ||
2794 | |||
2795 | DBF_TEXT(setup, 3, __FUNCTION__); | 2791 | DBF_TEXT(setup, 3, __FUNCTION__); |
2796 | 2792 | ||
2797 | if (alloc_device) { | ||
2798 | dev = kzalloc(sizeof(struct net_device), GFP_KERNEL); | ||
2799 | if (!dev) | ||
2800 | return NULL; | ||
2801 | } | ||
2802 | |||
2803 | dev->priv = privptr; | ||
2804 | privptr->fsm = init_fsm("ctcdev", dev_state_names, | ||
2805 | dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS, | ||
2806 | dev_fsm, DEV_FSM_LEN, GFP_KERNEL); | ||
2807 | if (privptr->fsm == NULL) { | ||
2808 | if (alloc_device) | ||
2809 | kfree(dev); | ||
2810 | return NULL; | ||
2811 | } | ||
2812 | fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); | ||
2813 | fsm_settimer(privptr->fsm, &privptr->restart_timer); | ||
2814 | if (dev->mtu == 0) | 2793 | if (dev->mtu == 0) |
2815 | dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2; | 2794 | dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2; |
2816 | dev->hard_start_xmit = ctc_tx; | 2795 | dev->hard_start_xmit = ctc_tx; |
@@ -2823,7 +2802,6 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device, | |||
2823 | dev->type = ARPHRD_SLIP; | 2802 | dev->type = ARPHRD_SLIP; |
2824 | dev->tx_queue_len = 100; | 2803 | dev->tx_queue_len = 100; |
2825 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | 2804 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
2826 | return dev; | ||
2827 | } | 2805 | } |
2828 | 2806 | ||
2829 | 2807 | ||
@@ -2879,14 +2857,22 @@ ctc_new_device(struct ccwgroup_device *cgdev) | |||
2879 | "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret); | 2857 | "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret); |
2880 | } | 2858 | } |
2881 | 2859 | ||
2882 | dev = ctc_init_netdevice(NULL, 1, privptr); | 2860 | dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice); |
2883 | |||
2884 | if (!dev) { | 2861 | if (!dev) { |
2885 | ctc_pr_warn("ctc_init_netdevice failed\n"); | 2862 | ctc_pr_warn("ctc_init_netdevice failed\n"); |
2886 | goto out; | 2863 | goto out; |
2887 | } | 2864 | } |
2865 | dev->priv = privptr; | ||
2888 | 2866 | ||
2889 | strlcpy(dev->name, "ctc%d", IFNAMSIZ); | 2867 | privptr->fsm = init_fsm("ctcdev", dev_state_names, |
2868 | dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS, | ||
2869 | dev_fsm, DEV_FSM_LEN, GFP_KERNEL); | ||
2870 | if (privptr->fsm == NULL) { | ||
2871 | free_netdev(dev); | ||
2872 | goto out; | ||
2873 | } | ||
2874 | fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); | ||
2875 | fsm_settimer(privptr->fsm, &privptr->restart_timer); | ||
2890 | 2876 | ||
2891 | for (direction = READ; direction <= WRITE; direction++) { | 2877 | for (direction = READ; direction <= WRITE; direction++) { |
2892 | privptr->channel[direction] = | 2878 | privptr->channel[direction] = |