Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd0fab5b authored by Dominik Brodowski's avatar Dominik Brodowski
Browse files

pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (net)



Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of
requiring manual settings of PCMCIA_DEBUG. Only some rare debug checks are
now hidden behind "#ifdef DEBUG" or "#if 0".

Also, remove all usages of the CS_CHECK macro and replace them with proper
Linux style calling and return value checking. The extra error reporting may
be dropped, as the PCMCIA core already complains about any (non-driver-author)
errors.

CC: netdev@vger.kernel.org
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent e773cfe1
Loading
Loading
Loading
Loading
+29 −37
Original line number Diff line number Diff line
@@ -118,14 +118,6 @@ INT_MODULE_PARM(full_duplex, 0);
/* Autodetect link polarity reversal? */
INT_MODULE_PARM(auto_polarity, 1);

#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, becker@scyld.com.\n";
#else
#define DEBUG(n, args...)
#endif

/*====================================================================*/

@@ -278,7 +270,7 @@ static int tc574_probe(struct pcmcia_device *link)
	struct el3_private *lp;
	struct net_device *dev;

	DEBUG(0, "3c574_attach()\n");
	dev_dbg(&link->dev, "3c574_attach()\n");

	/* Create the PC card device object. */
	dev = alloc_etherdev(sizeof(struct el3_private));
@@ -319,7 +311,7 @@ static void tc574_detach(struct pcmcia_device *link)
{
	struct net_device *dev = link->priv;

	DEBUG(0, "3c574_detach(0x%p)\n", link);
	dev_dbg(&link->dev, "3c574_detach()\n");

	if (link->dev_node)
		unregister_netdev(dev);
@@ -335,16 +327,13 @@ static void tc574_detach(struct pcmcia_device *link)
	ethernet device available to the system.
*/

#define CS_CHECK(fn, ret) \
  do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)

static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};

static int tc574_config(struct pcmcia_device *link)
{
	struct net_device *dev = link->priv;
	struct el3_private *lp = netdev_priv(dev);
	int last_fn, last_ret, i, j;
	int ret, i, j;
	unsigned int ioaddr;
	__be16 *phys_addr;
	char *cardname;
@@ -354,7 +343,7 @@ static int tc574_config(struct pcmcia_device *link)

	phys_addr = (__be16 *)dev->dev_addr;

	DEBUG(0, "3c574_config(0x%p)\n", link);
	dev_dbg(&link->dev, "3c574_config()\n");

	link->io.IOAddrLines = 16;
	for (i = j = 0; j < 0x400; j += 0x20) {
@@ -363,12 +352,16 @@ static int tc574_config(struct pcmcia_device *link)
		if (i == 0)
			break;
	}
	if (i != 0) {
		cs_error(link, RequestIO, i);
	if (i != 0)
		goto failed;

	ret = pcmcia_request_irq(link, &link->irq);
	if (ret)
		goto failed;

	ret = pcmcia_request_configuration(link, &link->conf);
	if (ret)
		goto failed;
	}
	CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
	CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));

	dev->irq = link->irq.AssignedIRQ;
	dev->base_addr = link->io.BasePort1;
@@ -433,7 +426,8 @@ static int tc574_config(struct pcmcia_device *link)
			mii_status = mdio_read(ioaddr, phy & 0x1f, 1);
			if (mii_status != 0xffff) {
				lp->phys = phy & 0x1f;
				DEBUG(0, "  MII transceiver at index %d, status %x.\n",
				dev_dbg(&link->dev, "  MII transceiver at "
					"index %d, status %x.\n",
					  phy, mii_status);
				if ((mii_status & 0x0040) == 0)
					mii_preamble_required = 1;
@@ -476,8 +470,6 @@ static int tc574_config(struct pcmcia_device *link)

	return 0;

cs_failed:
	cs_error(link, last_fn, last_ret);
failed:
	tc574_release(link);
	return -ENODEV;
@@ -736,7 +728,7 @@ static int el3_open(struct net_device *dev)
	lp->media.expires = jiffies + HZ;
	add_timer(&lp->media);
	
	DEBUG(2, "%s: opened, status %4.4x.\n",
	dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
		  dev->name, inw(dev->base_addr + EL3_STATUS));
	
	return 0;
@@ -770,7 +762,7 @@ static void pop_tx_status(struct net_device *dev)
		if (tx_status & 0x30)
			tc574_wait_for_completion(dev, TxReset);
		if (tx_status & 0x38) {
			DEBUG(1, "%s: transmit error: status 0x%02x\n",
			pr_debug("%s: transmit error: status 0x%02x\n",
				  dev->name, tx_status);
			outw(TxEnable, ioaddr + EL3_CMD);
			dev->stats.tx_aborted_errors++;
@@ -786,7 +778,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
	struct el3_private *lp = netdev_priv(dev);
	unsigned long flags;

	DEBUG(3, "%s: el3_start_xmit(length = %ld) called, "
	pr_debug("%s: el3_start_xmit(length = %ld) called, "
		  "status %4.4x.\n", dev->name, (long)skb->len,
		  inw(ioaddr + EL3_STATUS));

@@ -825,7 +817,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
		return IRQ_NONE;
	ioaddr = dev->base_addr;

	DEBUG(3, "%s: interrupt, status %4.4x.\n",
	pr_debug("%s: interrupt, status %4.4x.\n",
		  dev->name, inw(ioaddr + EL3_STATUS));

	spin_lock(&lp->window_lock);
@@ -834,7 +826,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
		   (IntLatch | RxComplete | RxEarly | StatsFull)) {
		if (!netif_device_present(dev) ||
			((status & 0xe000) != 0x2000)) {
			DEBUG(1, "%s: Interrupt from dead card\n", dev->name);
			pr_debug("%s: Interrupt from dead card\n", dev->name);
			break;
		}

@@ -844,7 +836,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
			work_budget = el3_rx(dev, work_budget);

		if (status & TxAvailable) {
			DEBUG(3, "  TX room bit was handled.\n");
			pr_debug("  TX room bit was handled.\n");
			/* There's room in the FIFO for a full-sized packet. */
			outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
			netif_wake_queue(dev);
@@ -884,7 +876,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
		}

		if (--work_budget < 0) {
			DEBUG(0, "%s: Too much work in interrupt, "
			pr_debug("%s: Too much work in interrupt, "
				  "status %4.4x.\n", dev->name, status);
			/* Clear all interrupts */
			outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -894,7 +886,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
		outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
	}

	DEBUG(3, "%s: exiting interrupt, status %4.4x.\n",
	pr_debug("%s: exiting interrupt, status %4.4x.\n",
		  dev->name, inw(ioaddr + EL3_STATUS));
		  
	spin_unlock(&lp->window_lock);
@@ -1001,7 +993,7 @@ static void update_stats(struct net_device *dev)
	unsigned int ioaddr = dev->base_addr;
	u8 rx, tx, up;

	DEBUG(2, "%s: updating the statistics.\n", dev->name);
	pr_debug("%s: updating the statistics.\n", dev->name);

	if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */
		return;
@@ -1037,7 +1029,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
	unsigned int ioaddr = dev->base_addr;
	short rx_status;
	
	DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
	pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
		  dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
	while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
			worklimit > 0) {
@@ -1059,7 +1051,7 @@ static int el3_rx(struct net_device *dev, int worklimit)

			skb = dev_alloc_skb(pkt_len+5);

			DEBUG(3, "  Receiving packet size %d status %4.4x.\n",
			pr_debug("  Receiving packet size %d status %4.4x.\n",
				  pkt_len, rx_status);
			if (skb != NULL) {
				skb_reserve(skb, 2);
@@ -1070,7 +1062,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
				dev->stats.rx_packets++;
				dev->stats.rx_bytes += pkt_len;
			} else {
				DEBUG(1, "%s: couldn't allocate a sk_buff of"
				pr_debug("%s: couldn't allocate a sk_buff of"
					  " size %d.\n", dev->name, pkt_len);
				dev->stats.rx_dropped++;
			}
@@ -1099,7 +1091,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
	struct mii_ioctl_data *data = if_mii(rq);
	int phy = lp->phys & 0x1f;

	DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
	pr_debug("%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
		  dev->name, rq->ifr_ifrn.ifrn_name, cmd,
		  data->phy_id, data->reg_num, data->val_in, data->val_out);

@@ -1176,7 +1168,7 @@ static int el3_close(struct net_device *dev)
	struct el3_private *lp = netdev_priv(dev);
	struct pcmcia_device *link = lp->p_dev;

	DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
	dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
	
	if (pcmcia_dev_present(link)) {
		unsigned long flags;
+25 −50
Original line number Diff line number Diff line
@@ -130,14 +130,6 @@ MODULE_LICENSE("GPL");
/* Special hook for setting if_port when module is loaded */
INT_MODULE_PARM(if_port, 0);

#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif

/*====================================================================*/

@@ -189,7 +181,7 @@ static int tc589_probe(struct pcmcia_device *link)
    struct el3_private *lp;
    struct net_device *dev;

    DEBUG(0, "3c589_attach()\n");
    dev_dbg(&link->dev, "3c589_attach()\n");

    /* Create new ethernet device */
    dev = alloc_etherdev(sizeof(struct el3_private));
@@ -231,7 +223,7 @@ static void tc589_detach(struct pcmcia_device *link)
{
    struct net_device *dev = link->priv;

    DEBUG(0, "3c589_detach(0x%p)\n", link);
    dev_dbg(&link->dev, "3c589_detach\n");

    if (link->dev_node)
	unregister_netdev(dev);
@@ -249,21 +241,18 @@ static void tc589_detach(struct pcmcia_device *link)
    
======================================================================*/

#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)

static int tc589_config(struct pcmcia_device *link)
{
    struct net_device *dev = link->priv;
    struct el3_private *lp = netdev_priv(dev);
    __be16 *phys_addr;
    int last_fn, last_ret, i, j, multi = 0, fifo;
    int ret, i, j, multi = 0, fifo;
    unsigned int ioaddr;
    char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
    u8 *buf;
    size_t len;
    
    DEBUG(0, "3c589_config(0x%p)\n", link);
    dev_dbg(&link->dev, "3c589_config\n");

    phys_addr = (__be16 *)dev->dev_addr;
    /* Is this a 3c562? */
@@ -281,12 +270,16 @@ static int tc589_config(struct pcmcia_device *link)
	if (i == 0)
		break;
    }
    if (i != 0) {
	cs_error(link, RequestIO, i);
    if (i != 0)
	goto failed;

    ret = pcmcia_request_irq(link, &link->irq);
    if (ret)
	    goto failed;

    ret = pcmcia_request_configuration(link, &link->conf);
    if (ret)
	    goto failed;
    }
    CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
    CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
	
    dev->irq = link->irq.AssignedIRQ;
    dev->base_addr = link->io.BasePort1;
@@ -342,8 +335,6 @@ static int tc589_config(struct pcmcia_device *link)
	   if_names[dev->if_port]);
    return 0;

cs_failed:
    cs_error(link, last_fn, last_ret);
failed:
    tc589_release(link);
    return -ENODEV;
@@ -506,24 +497,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
	sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
}

#ifdef PCMCIA_DEBUG
static u32 netdev_get_msglevel(struct net_device *dev)
{
	return pc_debug;
}

static void netdev_set_msglevel(struct net_device *dev, u32 level)
{
	pc_debug = level;
}
#endif /* PCMCIA_DEBUG */

static const struct ethtool_ops netdev_ethtool_ops = {
	.get_drvinfo		= netdev_get_drvinfo,
#ifdef PCMCIA_DEBUG
	.get_msglevel		= netdev_get_msglevel,
	.set_msglevel		= netdev_set_msglevel,
#endif /* PCMCIA_DEBUG */
};

static int el3_config(struct net_device *dev, struct ifmap *map)
@@ -558,7 +533,7 @@ static int el3_open(struct net_device *dev)
    lp->media.expires = jiffies + HZ;
    add_timer(&lp->media);

    DEBUG(1, "%s: opened, status %4.4x.\n",
    dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
	  dev->name, inw(dev->base_addr + EL3_STATUS));
    
    return 0;
@@ -591,7 +566,7 @@ static void pop_tx_status(struct net_device *dev)
	if (tx_status & 0x30)
	    tc589_wait_for_completion(dev, TxReset);
	if (tx_status & 0x38) {
	    DEBUG(1, "%s: transmit error: status 0x%02x\n",
	    pr_debug("%s: transmit error: status 0x%02x\n",
		  dev->name, tx_status);
	    outw(TxEnable, ioaddr + EL3_CMD);
	    dev->stats.tx_aborted_errors++;
@@ -607,7 +582,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
    struct el3_private *priv = netdev_priv(dev);
    unsigned long flags;

    DEBUG(3, "%s: el3_start_xmit(length = %ld) called, "
    pr_debug("%s: el3_start_xmit(length = %ld) called, "
	  "status %4.4x.\n", dev->name, (long)skb->len,
	  inw(ioaddr + EL3_STATUS));

@@ -649,14 +624,14 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)

    ioaddr = dev->base_addr;

    DEBUG(3, "%s: interrupt, status %4.4x.\n",
    pr_debug("%s: interrupt, status %4.4x.\n",
	  dev->name, inw(ioaddr + EL3_STATUS));

    spin_lock(&lp->lock);    
    while ((status = inw(ioaddr + EL3_STATUS)) &
	(IntLatch | RxComplete | StatsFull)) {
	if ((status & 0xe000) != 0x2000) {
	    DEBUG(1, "%s: interrupt from dead card\n", dev->name);
	    pr_debug("%s: interrupt from dead card\n", dev->name);
	    handled = 0;
	    break;
	}
@@ -665,7 +640,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
	    el3_rx(dev);
	
	if (status & TxAvailable) {
	    DEBUG(3, "    TX room bit was handled.\n");
	    pr_debug("    TX room bit was handled.\n");
	    /* There's room in the FIFO for a full-sized packet. */
	    outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
	    netif_wake_queue(dev);
@@ -717,7 +692,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)

    lp->last_irq = jiffies;
    spin_unlock(&lp->lock);    
    DEBUG(3, "%s: exiting interrupt, status %4.4x.\n",
    pr_debug("%s: exiting interrupt, status %4.4x.\n",
	  dev->name, inw(ioaddr + EL3_STATUS));
    return IRQ_RETVAL(handled);
}
@@ -828,7 +803,7 @@ static void update_stats(struct net_device *dev)
{
    unsigned int ioaddr = dev->base_addr;

    DEBUG(2, "%s: updating the statistics.\n", dev->name);
    pr_debug("%s: updating the statistics.\n", dev->name);
    /* Turn off statistics updates while reading. */
    outw(StatsDisable, ioaddr + EL3_CMD);
    /* Switch to the stats window, and read everything. */
@@ -856,7 +831,7 @@ static int el3_rx(struct net_device *dev)
    int worklimit = 32;
    short rx_status;
    
    DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
    pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
	  dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
    while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
		    worklimit > 0) {
@@ -878,7 +853,7 @@ static int el3_rx(struct net_device *dev)
	    
	    skb = dev_alloc_skb(pkt_len+5);
	    
	    DEBUG(3, "    Receiving packet size %d status %4.4x.\n",
	    pr_debug("    Receiving packet size %d status %4.4x.\n",
		  pkt_len, rx_status);
	    if (skb != NULL) {
		skb_reserve(skb, 2);
@@ -889,7 +864,7 @@ static int el3_rx(struct net_device *dev)
		dev->stats.rx_packets++;
		dev->stats.rx_bytes += pkt_len;
	    } else {
		DEBUG(1, "%s: couldn't allocate a sk_buff of"
		pr_debug("%s: couldn't allocate a sk_buff of"
		      " size %d.\n", dev->name, pkt_len);
		dev->stats.rx_dropped++;
	    }
@@ -930,7 +905,7 @@ static int el3_close(struct net_device *dev)
    struct pcmcia_device *link = lp->p_dev;
    unsigned int ioaddr = dev->base_addr;
    
    DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
    dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);

    if (pcmcia_dev_present(link)) {
	/* Turn off statistics ASAP.  We update dev->stats below. */
+18 −35
Original line number Diff line number Diff line
@@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");
MODULE_LICENSE("GPL");

#ifdef PCMCIA_DEBUG
#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)

INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif

/*====================================================================*/

@@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link)
    struct net_device *dev;
    struct ei_device *ei_local;

    DEBUG(0, "axnet_attach()\n");
    dev_dbg(&link->dev, "axnet_attach()\n");

    dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t));
    if (!dev)
@@ -205,7 +195,7 @@ static void axnet_detach(struct pcmcia_device *link)
{
    struct net_device *dev = link->priv;

    DEBUG(0, "axnet_detach(0x%p)\n", link);
    dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link);

    if (link->dev_node)
	unregister_netdev(dev);
@@ -272,9 +262,6 @@ static int get_prom(struct pcmcia_device *link)

======================================================================*/

#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)

static int try_io_port(struct pcmcia_device *link)
{
    int j, ret;
@@ -341,26 +328,29 @@ static int axnet_config(struct pcmcia_device *link)
{
    struct net_device *dev = link->priv;
    axnet_dev_t *info = PRIV(dev);
    int i, j, j2, last_ret, last_fn;
    int i, j, j2, ret;

    DEBUG(0, "axnet_config(0x%p)\n", link);
    dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);

    /* don't trust the CIS on this; Linksys got it wrong */
    link->conf.Present = 0x63;
    last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
    if (last_ret != 0) {
	cs_error(link, RequestIO, last_ret);
    ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
    if (ret != 0)
	goto failed;
    }

    CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
    ret = pcmcia_request_irq(link, &link->irq);
    if (ret)
	    goto failed;
    
    if (link->io.NumPorts2 == 8) {
	link->conf.Attributes |= CONF_ENABLE_SPKR;
	link->conf.Status = CCSR_AUDIO_ENA;
    }
    
    CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
    ret = pcmcia_request_configuration(link, &link->conf);
    if (ret)
	    goto failed;

    dev->irq = link->irq.AssignedIRQ;
    dev->base_addr = link->io.BasePort1;

@@ -426,14 +416,12 @@ static int axnet_config(struct pcmcia_device *link)
	   dev->base_addr, dev->irq,
	   dev->dev_addr);
    if (info->phy_id != -1) {
	DEBUG(0, "  MII transceiver at index %d, status %x.\n", info->phy_id, j);
	dev_dbg(&link->dev, "  MII transceiver at index %d, status %x.\n", info->phy_id, j);
    } else {
	printk(KERN_NOTICE "  No MII transceivers found!\n");
    }
    return 0;

cs_failed:
    cs_error(link, last_fn, last_ret);
failed:
    axnet_release(link);
    return -ENODEV;
@@ -543,7 +531,7 @@ static int axnet_open(struct net_device *dev)
    struct pcmcia_device *link = info->p_dev;
    unsigned int nic_base = dev->base_addr;
    
    DEBUG(2, "axnet_open('%s')\n", dev->name);
    dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name);

    if (!pcmcia_dev_present(link))
	return -ENODEV;
@@ -572,7 +560,7 @@ static int axnet_close(struct net_device *dev)
    axnet_dev_t *info = PRIV(dev);
    struct pcmcia_device *link = info->p_dev;

    DEBUG(2, "axnet_close('%s')\n", dev->name);
    dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name);

    ax_close(dev);
    free_irq(dev->irq, dev);
@@ -741,10 +729,8 @@ static void block_input(struct net_device *dev, int count,
    int xfer_count = count;
    char *buf = skb->data;

#ifdef PCMCIA_DEBUG
    if ((ei_debug > 4) && (count != 4))
	printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4);
#endif
	    pr_debug("%s: [bi=%d]\n", dev->name, count+4);
    outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
    outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
    outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD);
@@ -762,10 +748,7 @@ static void block_output(struct net_device *dev, int count,
{
    unsigned int nic_base = dev->base_addr;

#ifdef PCMCIA_DEBUG
    if (ei_debug > 4)
	printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count);
#endif
    pr_debug("%s: [bo=%d]\n", dev->name, count);

    /* Round the count up for word writes.  Do we need to do this?
       What effect will an odd byte count have on the 8390?
+24 −31
Original line number Diff line number Diff line
@@ -53,11 +53,7 @@

#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n"

#ifdef PCMCIA_DEBUG

static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
#ifdef DEBUG

static void regdump(struct net_device *dev)
{
@@ -92,7 +88,6 @@ static void regdump(struct net_device *dev)

#else

#define DEBUG(n, args...) do { } while (0)
static inline void regdump(struct net_device *dev) { }

#endif
@@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
    struct net_device *dev;
    struct arcnet_local *lp;

    DEBUG(0, "com20020_attach()\n");
    dev_dbg(&p_dev->dev, "com20020_attach()\n");

    /* Create new network device */
    info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
@@ -198,12 +193,12 @@ static void com20020_detach(struct pcmcia_device *link)
    struct com20020_dev_t *info = link->priv;
    struct net_device *dev = info->dev;

    DEBUG(1,"detach...\n");
    dev_dbg(&link->dev, "detach...\n");

    DEBUG(0, "com20020_detach(0x%p)\n", link);
    dev_dbg(&link->dev, "com20020_detach\n");

    if (link->dev_node) {
	DEBUG(1,"unregister...\n");
	dev_dbg(&link->dev, "unregister...\n");

	unregister_netdev(dev);

@@ -218,16 +213,16 @@ static void com20020_detach(struct pcmcia_device *link)
    com20020_release(link);

    /* Unlink device structure, free bits */
    DEBUG(1,"unlinking...\n");
    dev_dbg(&link->dev, "unlinking...\n");
    if (link->priv)
    {
	dev = info->dev;
	if (dev)
	{
	    DEBUG(1,"kfree...\n");
	    dev_dbg(&link->dev, "kfree...\n");
	    free_netdev(dev);
	}
	DEBUG(1,"kfree2...\n");
	dev_dbg(&link->dev, "kfree2...\n");
	kfree(info);
    }

@@ -241,25 +236,22 @@ static void com20020_detach(struct pcmcia_device *link)

======================================================================*/

#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)

static int com20020_config(struct pcmcia_device *link)
{
    struct arcnet_local *lp;
    com20020_dev_t *info;
    struct net_device *dev;
    int i, last_ret, last_fn;
    int i, ret;
    int ioaddr;

    info = link->priv;
    dev = info->dev;

    DEBUG(1,"config...\n");
    dev_dbg(&link->dev, "config...\n");

    DEBUG(0, "com20020_config(0x%p)\n", link);
    dev_dbg(&link->dev, "com20020_config\n");

    DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1);
    dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1);
    i = -ENODEV;
    if (!link->io.BasePort1)
    {
@@ -276,26 +268,28 @@ static int com20020_config(struct pcmcia_device *link)
    
    if (i != 0)
    {
	DEBUG(1,"arcnet: requestIO failed totally!\n");
	dev_dbg(&link->dev, "requestIO failed totally!\n");
	goto failed;
    }
	
    ioaddr = dev->base_addr = link->io.BasePort1;
    DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr);
    dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);

    DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n",
    dev_dbg(&link->dev, "request IRQ %d (%Xh/%Xh)\n",
	   link->irq.AssignedIRQ,
	   link->irq.IRQInfo1, link->irq.IRQInfo2);
    i = pcmcia_request_irq(link, &link->irq);
    if (i != 0)
    {
	DEBUG(1,"arcnet: requestIRQ failed totally!\n");
	dev_dbg(&link->dev, "requestIRQ failed totally!\n");
	goto failed;
    }

    dev->irq = link->irq.AssignedIRQ;

    CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
    ret = pcmcia_request_configuration(link, &link->conf);
    if (ret)
	    goto failed;

    if (com20020_check(dev))
    {
@@ -313,21 +307,20 @@ static int com20020_config(struct pcmcia_device *link)
    i = com20020_found(dev, 0);	/* calls register_netdev */
    
    if (i != 0) {
	DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n");
	dev_printk(KERN_NOTICE, &link->dev,
		"com20020_cs: com20020_found() failed\n");
	link->dev_node = NULL;
	goto failed;
    }

    strcpy(info->node.dev_name, dev->name);

    DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n",
    dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n",
           dev->name, dev->base_addr, dev->irq);
    return 0;

cs_failed:
    cs_error(link, last_fn, last_ret);
failed:
    DEBUG(1,"com20020_config failed...\n");
    dev_dbg(&link->dev, "com20020_config failed...\n");
    com20020_release(link);
    return -ENODEV;
} /* com20020_config */
@@ -342,7 +335,7 @@ failed:

static void com20020_release(struct pcmcia_device *link)
{
	DEBUG(0, "com20020_release(0x%p)\n", link);
	dev_dbg(&link->dev, "com20020_release\n");
	pcmcia_disable_device(link);
}

+38 −71

File changed.

Preview size limit exceeded, changes collapsed.

Loading