mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
arcnet: Remove function pointer macro indirections
It's clearer to use function pointer calls directly instead of the macro indirections of ARCRESET, ACOMMAND, ASTATUS, and AINTMASK. Remove the now unused macros too. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
This commit is contained in:
parent
a11a5442d1
commit
e15b03625c
2 changed files with 32 additions and 37 deletions
|
@ -318,11 +318,6 @@ struct arcnet_local {
|
||||||
void __iomem *mem_start; /* pointer to ioremap'ed MMIO */
|
void __iomem *mem_start; /* pointer to ioremap'ed MMIO */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ARCRESET(x) (lp->hw.reset(dev, (x)))
|
|
||||||
#define ACOMMAND(x) (lp->hw.command(dev, (x)))
|
|
||||||
#define ASTATUS() (lp->hw.status(dev))
|
|
||||||
#define AINTMASK(x) (lp->hw.intmask(dev, (x)))
|
|
||||||
|
|
||||||
#if ARCNET_DEBUG_MAX & D_SKB
|
#if ARCNET_DEBUG_MAX & D_SKB
|
||||||
void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
|
void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -361,7 +361,7 @@ int arcnet_open(struct net_device *dev)
|
||||||
* time, actually reset it.
|
* time, actually reset it.
|
||||||
*/
|
*/
|
||||||
error = -ENODEV;
|
error = -ENODEV;
|
||||||
if (ARCRESET(0) && ARCRESET(1))
|
if (lp->hw.reset(dev, 0) && lp->hw.reset(dev, 1))
|
||||||
goto out_module_put;
|
goto out_module_put;
|
||||||
|
|
||||||
newmtu = choose_mtu();
|
newmtu = choose_mtu();
|
||||||
|
@ -404,22 +404,22 @@ int arcnet_open(struct net_device *dev)
|
||||||
arc_printk(D_NORMAL, dev, "WARNING! Station address FF may confuse DOS networking programs!\n");
|
arc_printk(D_NORMAL, dev, "WARNING! Station address FF may confuse DOS networking programs!\n");
|
||||||
|
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
||||||
if (ASTATUS() & RESETflag) {
|
if (lp->hw.status(dev) & RESETflag) {
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s\n",
|
arc_printk(D_DEBUG, dev, "%s: %d: %s\n",
|
||||||
__FILE__, __LINE__, __func__);
|
__FILE__, __LINE__, __func__);
|
||||||
ACOMMAND(CFLAGScmd | RESETclear);
|
lp->hw.command(dev, CFLAGScmd | RESETclear);
|
||||||
}
|
}
|
||||||
|
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
||||||
/* make sure we're ready to receive IRQ's. */
|
/* make sure we're ready to receive IRQ's. */
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
udelay(1); /* give it time to set the mask before
|
udelay(1); /* give it time to set the mask before
|
||||||
* we reset it again. (may not even be
|
* we reset it again. (may not even be
|
||||||
* necessary)
|
* necessary)
|
||||||
*/
|
*/
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
||||||
lp->intmask = NORXflag | RECONflag;
|
lp->intmask = NORXflag | RECONflag;
|
||||||
AINTMASK(lp->intmask);
|
lp->hw.intmask(dev, lp->intmask);
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
||||||
|
|
||||||
netif_start_queue(dev);
|
netif_start_queue(dev);
|
||||||
|
@ -440,9 +440,9 @@ int arcnet_close(struct net_device *dev)
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
/* flush TX and disable RX */
|
/* flush TX and disable RX */
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
ACOMMAND(NOTXcmd); /* stop transmit */
|
lp->hw.command(dev, NOTXcmd); /* stop transmit */
|
||||||
ACOMMAND(NORXcmd); /* disable receive */
|
lp->hw.command(dev, NORXcmd); /* disable receive */
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
|
|
||||||
/* shut down the card */
|
/* shut down the card */
|
||||||
|
@ -518,7 +518,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
|
||||||
|
|
||||||
arc_printk(D_DURING, dev,
|
arc_printk(D_DURING, dev,
|
||||||
"transmit requested (status=%Xh, txbufs=%d/%d, len=%d, protocol %x)\n",
|
"transmit requested (status=%Xh, txbufs=%d/%d, len=%d, protocol %x)\n",
|
||||||
ASTATUS(), lp->cur_tx, lp->next_tx, skb->len, skb->protocol);
|
lp->hw.status(dev), lp->cur_tx, lp->next_tx, skb->len, skb->protocol);
|
||||||
|
|
||||||
pkt = (struct archdr *)skb->data;
|
pkt = (struct archdr *)skb->data;
|
||||||
soft = &pkt->soft.rfc1201;
|
soft = &pkt->soft.rfc1201;
|
||||||
|
@ -540,7 +540,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
spin_lock_irqsave(&lp->lock, flags);
|
spin_lock_irqsave(&lp->lock, flags);
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
if (lp->next_tx == -1)
|
if (lp->next_tx == -1)
|
||||||
txbuf = get_arcbuf(dev);
|
txbuf = get_arcbuf(dev);
|
||||||
else
|
else
|
||||||
|
@ -577,15 +577,15 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
|
||||||
}
|
}
|
||||||
|
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s, status: %x\n",
|
arc_printk(D_DEBUG, dev, "%s: %d: %s, status: %x\n",
|
||||||
__FILE__, __LINE__, __func__, ASTATUS());
|
__FILE__, __LINE__, __func__, lp->hw.status(dev));
|
||||||
/* make sure we didn't ignore a TX IRQ while we were in here */
|
/* make sure we didn't ignore a TX IRQ while we were in here */
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
|
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
arc_printk(D_DEBUG, dev, "%s: %d: %s\n", __FILE__, __LINE__, __func__);
|
||||||
lp->intmask |= TXFREEflag | EXCNAKflag;
|
lp->intmask |= TXFREEflag | EXCNAKflag;
|
||||||
AINTMASK(lp->intmask);
|
lp->hw.intmask(dev, lp->intmask);
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s, status: %x\n",
|
arc_printk(D_DEBUG, dev, "%s: %d: %s, status: %x\n",
|
||||||
__FILE__, __LINE__, __func__, ASTATUS());
|
__FILE__, __LINE__, __func__, lp->hw.status(dev));
|
||||||
|
|
||||||
spin_unlock_irqrestore(&lp->lock, flags);
|
spin_unlock_irqrestore(&lp->lock, flags);
|
||||||
if (freeskb)
|
if (freeskb)
|
||||||
|
@ -603,7 +603,7 @@ static int go_tx(struct net_device *dev)
|
||||||
struct arcnet_local *lp = netdev_priv(dev);
|
struct arcnet_local *lp = netdev_priv(dev);
|
||||||
|
|
||||||
arc_printk(D_DURING, dev, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
|
arc_printk(D_DURING, dev, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
|
||||||
ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);
|
lp->hw.status(dev), lp->intmask, lp->next_tx, lp->cur_tx);
|
||||||
|
|
||||||
if (lp->cur_tx != -1 || lp->next_tx == -1)
|
if (lp->cur_tx != -1 || lp->next_tx == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -615,7 +615,7 @@ static int go_tx(struct net_device *dev)
|
||||||
lp->next_tx = -1;
|
lp->next_tx = -1;
|
||||||
|
|
||||||
/* start sending */
|
/* start sending */
|
||||||
ACOMMAND(TXcmd | (lp->cur_tx << 3));
|
lp->hw.command(dev, TXcmd | (lp->cur_tx << 3));
|
||||||
|
|
||||||
dev->stats.tx_packets++;
|
dev->stats.tx_packets++;
|
||||||
lp->lasttrans_dest = lp->lastload_dest;
|
lp->lasttrans_dest = lp->lastload_dest;
|
||||||
|
@ -631,7 +631,7 @@ void arcnet_timeout(struct net_device *dev)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct arcnet_local *lp = netdev_priv(dev);
|
struct arcnet_local *lp = netdev_priv(dev);
|
||||||
int status = ASTATUS();
|
int status = lp->hw.status(dev);
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
spin_lock_irqsave(&lp->lock, flags);
|
spin_lock_irqsave(&lp->lock, flags);
|
||||||
|
@ -641,14 +641,14 @@ void arcnet_timeout(struct net_device *dev)
|
||||||
msg = "";
|
msg = "";
|
||||||
dev->stats.tx_aborted_errors++;
|
dev->stats.tx_aborted_errors++;
|
||||||
lp->timed_out = 1;
|
lp->timed_out = 1;
|
||||||
ACOMMAND(NOTXcmd | (lp->cur_tx << 3));
|
lp->hw.command(dev, NOTXcmd | (lp->cur_tx << 3));
|
||||||
}
|
}
|
||||||
dev->stats.tx_errors++;
|
dev->stats.tx_errors++;
|
||||||
|
|
||||||
/* make sure we didn't miss a TX or a EXC NAK IRQ */
|
/* make sure we didn't miss a TX or a EXC NAK IRQ */
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
lp->intmask |= TXFREEflag | EXCNAKflag;
|
lp->intmask |= TXFREEflag | EXCNAKflag;
|
||||||
AINTMASK(lp->intmask);
|
lp->hw.intmask(dev, lp->intmask);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&lp->lock, flags);
|
spin_unlock_irqrestore(&lp->lock, flags);
|
||||||
|
|
||||||
|
@ -687,19 +687,19 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||||
* clear it right away (but nothing else).
|
* clear it right away (but nothing else).
|
||||||
*/
|
*/
|
||||||
if (!netif_running(dev)) {
|
if (!netif_running(dev)) {
|
||||||
if (ASTATUS() & RESETflag)
|
if (lp->hw.status(dev) & RESETflag)
|
||||||
ACOMMAND(CFLAGScmd | RESETclear);
|
lp->hw.command(dev, CFLAGScmd | RESETclear);
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
spin_unlock(&lp->lock);
|
spin_unlock(&lp->lock);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
arc_printk(D_DURING, dev, "in arcnet_inthandler (status=%Xh, intmask=%Xh)\n",
|
arc_printk(D_DURING, dev, "in arcnet_inthandler (status=%Xh, intmask=%Xh)\n",
|
||||||
ASTATUS(), lp->intmask);
|
lp->hw.status(dev), lp->intmask);
|
||||||
|
|
||||||
boguscount = 5;
|
boguscount = 5;
|
||||||
do {
|
do {
|
||||||
status = ASTATUS();
|
status = lp->hw.status(dev);
|
||||||
diagstatus = (status >> 8) & 0xFF;
|
diagstatus = (status >> 8) & 0xFF;
|
||||||
|
|
||||||
arc_printk(D_DEBUG, dev, "%s: %d: %s: status=%x\n",
|
arc_printk(D_DEBUG, dev, "%s: %d: %s: status=%x\n",
|
||||||
|
@ -739,7 +739,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||||
if (lp->cur_rx != -1) {
|
if (lp->cur_rx != -1) {
|
||||||
arc_printk(D_DURING, dev, "enabling receive to buffer #%d\n",
|
arc_printk(D_DURING, dev, "enabling receive to buffer #%d\n",
|
||||||
lp->cur_rx);
|
lp->cur_rx);
|
||||||
ACOMMAND(RXcmd | (lp->cur_rx << 3) | RXbcasts);
|
lp->hw.command(dev, RXcmd | (lp->cur_rx << 3) | RXbcasts);
|
||||||
}
|
}
|
||||||
didsomething++;
|
didsomething++;
|
||||||
}
|
}
|
||||||
|
@ -748,10 +748,10 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||||
arc_printk(D_DURING, dev, "EXCNAK IRQ (diagstat=%Xh)\n",
|
arc_printk(D_DURING, dev, "EXCNAK IRQ (diagstat=%Xh)\n",
|
||||||
diagstatus);
|
diagstatus);
|
||||||
|
|
||||||
ACOMMAND(NOTXcmd); /* disable transmit */
|
lp->hw.command(dev, NOTXcmd); /* disable transmit */
|
||||||
lp->excnak_pending = 1;
|
lp->excnak_pending = 1;
|
||||||
|
|
||||||
ACOMMAND(EXCNAKclear);
|
lp->hw.command(dev, EXCNAKclear);
|
||||||
lp->intmask &= ~(EXCNAKflag);
|
lp->intmask &= ~(EXCNAKflag);
|
||||||
didsomething++;
|
didsomething++;
|
||||||
}
|
}
|
||||||
|
@ -837,7 +837,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||||
didsomething++;
|
didsomething++;
|
||||||
}
|
}
|
||||||
if (status & lp->intmask & RECONflag) {
|
if (status & lp->intmask & RECONflag) {
|
||||||
ACOMMAND(CFLAGScmd | CONFIGclear);
|
lp->hw.command(dev, CFLAGScmd | CONFIGclear);
|
||||||
dev->stats.tx_carrier_errors++;
|
dev->stats.tx_carrier_errors++;
|
||||||
|
|
||||||
arc_printk(D_RECON, dev, "Network reconfiguration detected (status=%Xh)\n",
|
arc_printk(D_RECON, dev, "Network reconfiguration detected (status=%Xh)\n",
|
||||||
|
@ -899,12 +899,12 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||||
} while (--boguscount && didsomething);
|
} while (--boguscount && didsomething);
|
||||||
|
|
||||||
arc_printk(D_DURING, dev, "arcnet_interrupt complete (status=%Xh, count=%d)\n",
|
arc_printk(D_DURING, dev, "arcnet_interrupt complete (status=%Xh, count=%d)\n",
|
||||||
ASTATUS(), boguscount);
|
lp->hw.status(dev), boguscount);
|
||||||
arc_printk(D_DURING, dev, "\n");
|
arc_printk(D_DURING, dev, "\n");
|
||||||
|
|
||||||
AINTMASK(0);
|
lp->hw.intmask(dev, 0);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
AINTMASK(lp->intmask);
|
lp->hw.intmask(dev, lp->intmask);
|
||||||
|
|
||||||
spin_unlock(&lp->lock);
|
spin_unlock(&lp->lock);
|
||||||
return retval;
|
return retval;
|
||||||
|
|
Loading…
Reference in a new issue