netdevice ni65: Convert directly reference of netdev->priv
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>
This commit is contained in:
parent
c8019bf3af
commit
826dd0e1e3
@ -295,7 +295,7 @@ static void ni65_set_performance(struct priv *p)
|
|||||||
*/
|
*/
|
||||||
static int ni65_open(struct net_device *dev)
|
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,
|
int irqval = request_irq(dev->irq, &ni65_interrupt,0,
|
||||||
cards[p->cardno].cardname,dev);
|
cards[p->cardno].cardname,dev);
|
||||||
if (irqval) {
|
if (irqval) {
|
||||||
@ -321,7 +321,7 @@ static int ni65_open(struct net_device *dev)
|
|||||||
*/
|
*/
|
||||||
static int ni65_close(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);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ static int ni65_close(struct net_device *dev)
|
|||||||
|
|
||||||
static void cleanup_card(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);
|
disable_dma(dev->dma);
|
||||||
free_dma(dev->dma);
|
free_dma(dev->dma);
|
||||||
release_region(dev->base_addr, cards[p->cardno].total_size);
|
release_region(dev->base_addr, cards[p->cardno].total_size);
|
||||||
@ -444,7 +444,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
|
|||||||
release_region(ioaddr, cards[i].total_size);
|
release_region(ioaddr, cards[i].total_size);
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
p = (struct priv *) dev->priv;
|
p = dev->ml_priv;
|
||||||
p->cmdr_addr = ioaddr + cards[i].cmd_offset;
|
p->cmdr_addr = ioaddr + cards[i].cmd_offset;
|
||||||
p->cardno = i;
|
p->cardno = i;
|
||||||
spin_lock_init(&p->ring_lock);
|
spin_lock_init(&p->ring_lock);
|
||||||
@ -647,8 +647,8 @@ static int ni65_alloc_buffer(struct net_device *dev)
|
|||||||
if(!ptr)
|
if(!ptr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
p = dev->priv = (struct priv *) (((unsigned long) ptr + 7) & ~0x7);
|
p = dev->ml_priv = (struct priv *) (((unsigned long) ptr + 7) & ~0x7);
|
||||||
memset((char *) dev->priv,0,sizeof(struct priv));
|
memset((char *)p, 0, sizeof(struct priv));
|
||||||
p->self = ptr;
|
p->self = ptr;
|
||||||
|
|
||||||
for(i=0;i<TMDNUM;i++)
|
for(i=0;i<TMDNUM;i++)
|
||||||
@ -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)
|
static int ni65_lance_reinit(struct net_device *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct priv *p = (struct priv *) dev->priv;
|
struct priv *p = dev->ml_priv;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
p->lock = 0;
|
p->lock = 0;
|
||||||
@ -876,7 +876,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
|
|||||||
struct priv *p;
|
struct priv *p;
|
||||||
int bcnt = 32;
|
int bcnt = 32;
|
||||||
|
|
||||||
p = (struct priv *) dev->priv;
|
p = dev->ml_priv;
|
||||||
|
|
||||||
spin_lock(&p->ring_lock);
|
spin_lock(&p->ring_lock);
|
||||||
|
|
||||||
@ -899,7 +899,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
|
|||||||
|
|
||||||
if(csr0 & CSR0_ERR)
|
if(csr0 & CSR0_ERR)
|
||||||
{
|
{
|
||||||
struct priv *p = (struct priv *) dev->priv;
|
struct priv *p = dev->ml_priv;
|
||||||
if(debuglevel > 1)
|
if(debuglevel > 1)
|
||||||
printk(KERN_ERR "%s: general error: %04x.\n",dev->name,csr0);
|
printk(KERN_ERR "%s: general error: %04x.\n",dev->name,csr0);
|
||||||
if(csr0 & CSR0_BABL)
|
if(csr0 & CSR0_BABL)
|
||||||
@ -924,7 +924,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
|
|||||||
int j;
|
int j;
|
||||||
for(j=0;j<RMDNUM;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;
|
int i,k,num1,num2;
|
||||||
for(i=RMDNUM-1;i>0;i--) {
|
for(i=RMDNUM-1;i>0;i--) {
|
||||||
num2 = (p->rmdnum + i) & (RMDNUM-1);
|
num2 = (p->rmdnum + i) & (RMDNUM-1);
|
||||||
@ -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)
|
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)
|
while(p->xmit_queued)
|
||||||
{
|
{
|
||||||
@ -1049,7 +1049,7 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
|
|||||||
struct rmd *rmdp;
|
struct rmd *rmdp;
|
||||||
int rmdstat,len;
|
int rmdstat,len;
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
struct priv *p = (struct priv *) dev->priv;
|
struct priv *p = dev->ml_priv;
|
||||||
|
|
||||||
rmdp = p->rmdhead + p->rmdnum;
|
rmdp = p->rmdhead + p->rmdnum;
|
||||||
while(!( (rmdstat = rmdp->u.s.status) & RCV_OWN))
|
while(!( (rmdstat = rmdp->u.s.status) & RCV_OWN))
|
||||||
@ -1139,7 +1139,7 @@ static void ni65_recv_intr(struct net_device *dev,int csr0)
|
|||||||
static void ni65_timeout(struct net_device *dev)
|
static void ni65_timeout(struct net_device *dev)
|
||||||
{
|
{
|
||||||
int i;
|
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);
|
printk(KERN_ERR "%s: xmitter timed out, try to restart!\n",dev->name);
|
||||||
for(i=0;i<TMDNUM;i++)
|
for(i=0;i<TMDNUM;i++)
|
||||||
@ -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)
|
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);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
@ -1221,7 +1221,7 @@ static struct net_device_stats *ni65_get_stats(struct net_device *dev)
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int i;
|
int i;
|
||||||
struct priv *p = (struct priv *) dev->priv;
|
struct priv *p = dev->ml_priv;
|
||||||
for(i=0;i<RMDNUM;i++)
|
for(i=0;i<RMDNUM;i++)
|
||||||
{
|
{
|
||||||
struct rmd *rmdp = p->rmdhead + ((p->rmdnum + i) & (RMDNUM-1));
|
struct rmd *rmdp = p->rmdhead + ((p->rmdnum + i) & (RMDNUM-1));
|
||||||
@ -1230,7 +1230,7 @@ static struct net_device_stats *ni65_get_stats(struct net_device *dev)
|
|||||||
printk("\n");
|
printk("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return &((struct priv *) dev->priv)->stats;
|
return &((struct priv *)dev->ml_priv)->stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_multicast_list(struct net_device *dev)
|
static void set_multicast_list(struct net_device *dev)
|
||||||
|
Loading…
Reference in New Issue
Block a user