netdevice: safe convert to netdev_priv() #part-4
We have some reasons to kill netdev->priv: 1. netdev->priv is equal to netdev_priv(). 2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously netdev_priv() is more flexible than netdev->priv. But we cann't kill netdev->priv, because so many drivers reference to it directly. This patch is a safe convert for netdev->priv to netdev_priv(netdev). Since all of the netdev->priv is only for read. But it is too big to be sent in one mail. I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
8f15ea42b6
commit
524ad0a791
@@ -167,7 +167,7 @@ static void znet_tx_timeout (struct net_device *dev);
|
||||
/* Request needed resources */
|
||||
static int znet_request_resources (struct net_device *dev)
|
||||
{
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
|
||||
if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev))
|
||||
@@ -201,7 +201,7 @@ static int znet_request_resources (struct net_device *dev)
|
||||
|
||||
static void znet_release_resources (struct net_device *dev)
|
||||
{
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
|
||||
release_region (znet->sia_base, znet->sia_size);
|
||||
@@ -216,7 +216,7 @@ static void znet_release_resources (struct net_device *dev)
|
||||
/* Keep the magical SIA stuff in a single function... */
|
||||
static void znet_transceiver_power (struct net_device *dev, int on)
|
||||
{
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
unsigned char v;
|
||||
|
||||
/* Turn on/off the 82501 SIA, using zenith-specific magic. */
|
||||
@@ -235,7 +235,7 @@ static void znet_transceiver_power (struct net_device *dev, int on)
|
||||
Also used from hardware_init. */
|
||||
static void znet_set_multicast_list (struct net_device *dev)
|
||||
{
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
short ioaddr = dev->base_addr;
|
||||
struct i82593_conf_block *cfblk = &znet->i593_init;
|
||||
|
||||
@@ -386,7 +386,7 @@ static int __init znet_probe (void)
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
znet = dev->priv;
|
||||
znet = netdev_priv(dev);
|
||||
|
||||
netinfo = (struct netidblk *)p;
|
||||
dev->base_addr = netinfo->iobase1;
|
||||
@@ -530,7 +530,7 @@ static void znet_tx_timeout (struct net_device *dev)
|
||||
static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
int ioaddr = dev->base_addr;
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
short length = skb->len;
|
||||
|
||||
@@ -600,7 +600,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)
|
||||
static irqreturn_t znet_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct net_device *dev = dev_id;
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
int ioaddr;
|
||||
int boguscnt = 20;
|
||||
int handled = 0;
|
||||
@@ -678,7 +678,7 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id)
|
||||
|
||||
static void znet_rx(struct net_device *dev)
|
||||
{
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
int ioaddr = dev->base_addr;
|
||||
int boguscount = 1;
|
||||
short next_frame_end_offset = 0; /* Offset of next frame start. */
|
||||
@@ -827,7 +827,7 @@ static void show_dma(struct net_device *dev)
|
||||
{
|
||||
short ioaddr = dev->base_addr;
|
||||
unsigned char stat = inb (ioaddr);
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
short dma_port = ((znet->tx_dma&3)<<2) + IO_DMA2_BASE;
|
||||
unsigned addr = inb(dma_port);
|
||||
@@ -850,7 +850,7 @@ static void hardware_init(struct net_device *dev)
|
||||
{
|
||||
unsigned long flags;
|
||||
short ioaddr = dev->base_addr;
|
||||
struct znet_private *znet = dev->priv;
|
||||
struct znet_private *znet = netdev_priv(dev);
|
||||
|
||||
znet->rx_cur = znet->rx_start;
|
||||
znet->tx_cur = znet->tx_start;
|
||||
@@ -912,7 +912,7 @@ static void update_stop_hit(short ioaddr, unsigned short rx_stop_offset)
|
||||
static __exit void znet_cleanup (void)
|
||||
{
|
||||
if (znet_dev) {
|
||||
struct znet_private *znet = znet_dev->priv;
|
||||
struct znet_private *znet = netdev_priv(znet_dev);
|
||||
|
||||
unregister_netdev (znet_dev);
|
||||
kfree (znet->rx_start);
|
||||
|
Reference in New Issue
Block a user