提交 3a1a27fa 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

atp: convert to net_device_ops

Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 887e53d2
...@@ -204,8 +204,7 @@ static irqreturn_t atp_interrupt(int irq, void *dev_id); ...@@ -204,8 +204,7 @@ static irqreturn_t atp_interrupt(int irq, void *dev_id);
static void net_rx(struct net_device *dev); static void net_rx(struct net_device *dev);
static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode); static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode);
static int net_close(struct net_device *dev); static int net_close(struct net_device *dev);
static void set_rx_mode_8002(struct net_device *dev); static void set_rx_mode(struct net_device *dev);
static void set_rx_mode_8012(struct net_device *dev);
static void tx_timeout(struct net_device *dev); static void tx_timeout(struct net_device *dev);
...@@ -242,6 +241,17 @@ static int __init atp_init(void) ...@@ -242,6 +241,17 @@ static int __init atp_init(void)
return -ENODEV; return -ENODEV;
} }
static const struct net_device_ops atp_netdev_ops = {
.ndo_open = net_open,
.ndo_stop = net_close,
.ndo_start_xmit = atp_send_packet,
.ndo_set_multicast_list = set_rx_mode,
.ndo_tx_timeout = tx_timeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __init atp_probe1(long ioaddr) static int __init atp_probe1(long ioaddr)
{ {
struct net_device *dev = NULL; struct net_device *dev = NULL;
...@@ -342,12 +352,7 @@ static int __init atp_probe1(long ioaddr) ...@@ -342,12 +352,7 @@ static int __init atp_probe1(long ioaddr)
if (dev->mem_end & 0xf) if (dev->mem_end & 0xf)
net_debug = dev->mem_end & 7; net_debug = dev->mem_end & 7;
dev->open = net_open; dev->netdev_ops = &atp_netdev_ops;
dev->stop = net_close;
dev->hard_start_xmit = atp_send_packet;
dev->set_multicast_list =
lp->chip_type == RTL8002 ? &set_rx_mode_8002 : &set_rx_mode_8012;
dev->tx_timeout = tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
res = register_netdev(dev); res = register_netdev(dev);
...@@ -903,6 +908,17 @@ static void set_rx_mode_8012(struct net_device *dev) ...@@ -903,6 +908,17 @@ static void set_rx_mode_8012(struct net_device *dev)
write_reg(ioaddr, CMR2, CMR2_IRQOUT); /* Switch back to page 0 */ write_reg(ioaddr, CMR2, CMR2_IRQOUT); /* Switch back to page 0 */
} }
static void set_rx_mode(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
if (lp->chip_type == RTL8002)
return set_rx_mode_8002(dev);
else
return set_rx_mode_8012(dev);
}
static int __init atp_init_module(void) { static int __init atp_init_module(void) {
if (debug) /* Emit version even if no cards detected. */ if (debug) /* Emit version even if no cards detected. */
printk(KERN_INFO "%s", version); printk(KERN_INFO "%s", version);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册