Skip to content

Commit

Permalink
netdevice ni65: Convert directly reference of netdev->priv
Browse files Browse the repository at this point in the history
This patch is to kill directly reference of netdev->priv too.
Because the private data needs special memory: lower 16MB DMA.
alloc_etherdev() can not do this work.
So we can't use netdev->priv to point to netdev's private data.
Use netdev->ml_priv instead.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wang Chen authored and David S. Miller committed Nov 20, 2008
1 parent c8019bf commit 826dd0e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions drivers/net/ni65.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static void ni65_set_performance(struct priv *p)
*/
static int ni65_open(struct net_device *dev)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;
int irqval = request_irq(dev->irq, &ni65_interrupt,0,
cards[p->cardno].cardname,dev);
if (irqval) {
Expand All @@ -321,7 +321,7 @@ static int ni65_open(struct net_device *dev)
*/
static int ni65_close(struct net_device *dev)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;

netif_stop_queue(dev);

Expand All @@ -345,7 +345,7 @@ static int ni65_close(struct net_device *dev)

static void cleanup_card(struct net_device *dev)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;
disable_dma(dev->dma);
free_dma(dev->dma);
release_region(dev->base_addr, cards[p->cardno].total_size);
Expand Down Expand Up @@ -444,7 +444,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
release_region(ioaddr, cards[i].total_size);
return j;
}
p = (struct priv *) dev->priv;
p = dev->ml_priv;
p->cmdr_addr = ioaddr + cards[i].cmd_offset;
p->cardno = i;
spin_lock_init(&p->ring_lock);
Expand Down Expand Up @@ -647,8 +647,8 @@ static int ni65_alloc_buffer(struct net_device *dev)
if(!ptr)
return -ENOMEM;

p = dev->priv = (struct priv *) (((unsigned long) ptr + 7) & ~0x7);
memset((char *) dev->priv,0,sizeof(struct priv));
p = dev->ml_priv = (struct priv *) (((unsigned long) ptr + 7) & ~0x7);
memset((char *)p, 0, sizeof(struct priv));
p->self = ptr;

for(i=0;i<TMDNUM;i++)
Expand Down Expand Up @@ -790,7 +790,7 @@ static void ni65_stop_start(struct net_device *dev,struct priv *p)
static int ni65_lance_reinit(struct net_device *dev)
{
int i;
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;
unsigned long flags;

p->lock = 0;
Expand Down Expand Up @@ -876,7 +876,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
struct priv *p;
int bcnt = 32;

p = (struct priv *) dev->priv;
p = dev->ml_priv;

spin_lock(&p->ring_lock);

Expand All @@ -899,7 +899,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)

if(csr0 & CSR0_ERR)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;
if(debuglevel > 1)
printk(KERN_ERR "%s: general error: %04x.\n",dev->name,csr0);
if(csr0 & CSR0_BABL)
Expand All @@ -924,7 +924,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
int j;
for(j=0;j<RMDNUM;j++)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;
int i,k,num1,num2;
for(i=RMDNUM-1;i>0;i--) {
num2 = (p->rmdnum + i) & (RMDNUM-1);
Expand Down Expand Up @@ -982,7 +982,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
*/
static void ni65_xmit_intr(struct net_device *dev,int csr0)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;

while(p->xmit_queued)
{
Expand Down Expand Up @@ -1049,7 +1049,7 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
struct rmd *rmdp;
int rmdstat,len;
int cnt=0;
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;

rmdp = p->rmdhead + p->rmdnum;
while(!( (rmdstat = rmdp->u.s.status) & RCV_OWN))
Expand Down Expand Up @@ -1139,7 +1139,7 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
static void ni65_timeout(struct net_device *dev)
{
int i;
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;

printk(KERN_ERR "%s: xmitter timed out, try to restart!\n",dev->name);
for(i=0;i<TMDNUM;i++)
Expand All @@ -1156,7 +1156,7 @@ static void ni65_timeout(struct net_device *dev)

static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev)
{
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;

netif_stop_queue(dev);

Expand Down Expand Up @@ -1221,7 +1221,7 @@ static struct net_device_stats *ni65_get_stats(struct net_device *dev)

#if 0
int i;
struct priv *p = (struct priv *) dev->priv;
struct priv *p = dev->ml_priv;
for(i=0;i<RMDNUM;i++)
{
struct rmd *rmdp = p->rmdhead + ((p->rmdnum + i) & (RMDNUM-1));
Expand All @@ -1230,7 +1230,7 @@ static struct net_device_stats *ni65_get_stats(struct net_device *dev)
printk("\n");
#endif

return &((struct priv *) dev->priv)->stats;
return &((struct priv *)dev->ml_priv)->stats;
}

static void set_multicast_list(struct net_device *dev)
Expand Down

0 comments on commit 826dd0e

Please sign in to comment.