Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
[pandora-kernel.git] / drivers / staging / et131x / et131x_netdev.c
index 95555d2..4996f76 100644 (file)
@@ -156,14 +156,12 @@ struct net_device *et131x_device_alloc(void)
  *
  * Returns 0 on success, errno on failure (as defined in errno.h)
  */
-struct net_device_stats *et131x_stats(struct net_device *netdev)
+static struct net_device_stats *et131x_stats(struct net_device *netdev)
 {
        struct et131x_adapter *adapter = netdev_priv(netdev);
        struct net_device_stats *stats = &adapter->net_stats;
-       CE_STATS_t *devstat = &adapter->Stats;
+       struct ce_stats *devstat = &adapter->stats;
 
-       stats->rx_packets = devstat->ipackets;
-       stats->tx_packets = devstat->opackets;
        stats->rx_errors = devstat->length_err + devstat->alignment_err +
            devstat->crc_err + devstat->code_violations + devstat->other_errors;
        stats->tx_errors = devstat->max_pkt_error;
@@ -226,7 +224,7 @@ int et131x_open(struct net_device *netdev)
        /* Enable device interrupts */
        et131x_enable_interrupts(adapter);
 
-       adapter->Flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
+       adapter->flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
 
        /* We're ready to move some data, so start the queue */
        netif_start_queue(netdev);
@@ -254,7 +252,7 @@ int et131x_close(struct net_device *netdev)
        et131x_disable_interrupts(adapter);
 
        /* Deregistering ISR */
-       adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
+       adapter->flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
        free_irq(netdev->irq, netdev);
 
        /* Stop the error timer */
@@ -278,7 +276,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
 
        switch (cmd) {
        case SIOCGMIIPHY:
-               data->phy_id = etdev->Stats.xcvr_addr;
+               data->phy_id = etdev->stats.xcvr_addr;
                break;
 
        case SIOCGMIIREG:
@@ -510,18 +508,14 @@ void et131x_tx_timeout(struct net_device *netdev)
        struct tcb *tcb;
        unsigned long flags;
 
-       /* Just skip this part if the adapter is doing link detection */
-       if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION)
-               return;
-
        /* Any nonrecoverable hardware error?
         * Checks adapter->flags for any failure in phy reading
         */
-       if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR)
+       if (etdev->flags & fMP_ADAPTER_NON_RECOVER_ERROR)
                return;
 
        /* Hardware failure? */
-       if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) {
+       if (etdev->flags & fMP_ADAPTER_HARDWARE_ERROR) {
                dev_err(&etdev->pdev->dev, "hardware error - reset\n");
                return;
        }
@@ -539,7 +533,7 @@ void et131x_tx_timeout(struct net_device *netdev)
                                               flags);
 
                        dev_warn(&etdev->pdev->dev,
-                               "Send stuck - reset.  tcb->WrIndex %x, Flags 0x%08x\n",
+                               "Send stuck - reset.  tcb->WrIndex %x, flags 0x%08x\n",
                                tcb->index,
                                tcb->flags);
 
@@ -608,7 +602,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu)
        et131x_adapter_setup(adapter);
 
        /* Enable interrupts */
-       if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
+       if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
                et131x_enable_interrupts(adapter);
 
        /* Restart the Tx and Rx DMA engines */
@@ -690,7 +684,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
        et131x_adapter_setup(adapter);
 
        /* Enable interrupts */
-       if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
+       if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
                et131x_enable_interrupts(adapter);
 
        /* Restart the Tx and Rx DMA engines */
@@ -701,3 +695,54 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
        netif_wake_queue(netdev);
        return result;
 }
+
+static const struct net_device_ops et131x_netdev_ops = {
+       .ndo_open               = et131x_open,
+       .ndo_stop               = et131x_close,
+       .ndo_start_xmit         = et131x_tx,
+       .ndo_set_multicast_list = et131x_multicast,
+       .ndo_tx_timeout         = et131x_tx_timeout,
+       .ndo_change_mtu         = et131x_change_mtu,
+       .ndo_set_mac_address    = et131x_set_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_get_stats          = et131x_stats,
+       .ndo_do_ioctl           = et131x_ioctl,
+};
+
+/**
+ * et131x_device_alloc
+ *
+ * Returns pointer to the allocated and initialized net_device struct for
+ * this device.
+ *
+ * Create instances of net_device and wl_private for the new adapter and
+ * register the device's entry points in the net_device structure.
+ */
+struct net_device *et131x_device_alloc(void)
+{
+       struct net_device *netdev;
+
+       /* Alloc net_device and adapter structs */
+       netdev = alloc_etherdev(sizeof(struct et131x_adapter));
+
+       if (netdev == NULL) {
+               printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
+               return NULL;
+       }
+
+       /* Setup the function registration table (and other data) for a
+        * net_device
+        */
+       /* netdev->init               = &et131x_init; */
+       /* netdev->set_config = &et131x_config; */
+       netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
+       netdev->netdev_ops = &et131x_netdev_ops;
+
+       /* netdev->ethtool_ops        = &et131x_ethtool_ops; */
+
+       /* Poll? */
+       /* netdev->poll               = &et131x_poll; */
+       /* netdev->poll_controller    = &et131x_poll_controller; */
+       return netdev;
+}
+