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

Commit 8e4d9696 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

drivers/net/mac8390.c: Checkpatch cleanups



Use #include <linux/ not #include <asm/
Add spaces after arguments
Comment neatening
Make a couple of arrays static const
Align function arguments
Wrap text at 80 columns where reasonable
Cuddle brace else

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 18c00191
Loading
Loading
Loading
Loading
+122 −107
Original line number Diff line number Diff line
@@ -36,9 +36,9 @@
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/bitops.h>
#include <linux/io.h>

#include <asm/system.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/hwtest.h>
#include <asm/macints.h>
@@ -57,10 +57,15 @@ static char version[] =
#define WD_START_PG			0x00	/* First page of TX buffer */
#define CABLETRON_RX_START_PG		0x00    /* First page of RX buffer */
#define CABLETRON_RX_STOP_PG		0x30    /* Last page +1 of RX ring */
#define CABLETRON_TX_START_PG		CABLETRON_RX_STOP_PG  /* First page of TX buffer */

/* Unfortunately it seems we have to hardcode these for the moment */
/* Shouldn't the card know about this? Does anyone know where to read it off the card? Do we trust the data provided by the card? */
#define CABLETRON_TX_START_PG		CABLETRON_RX_STOP_PG
						/* First page of TX buffer */

/*
 * Unfortunately it seems we have to hardcode these for the moment
 * Shouldn't the card know about this?
 * Does anyone know where to read it off the card?
 * Do we trust the data provided by the card?
 */

#define DAYNA_8390_BASE		0x80000
#define DAYNA_8390_MEM		0x00000
@@ -92,7 +97,7 @@ static const char * cardname[] = {
	"kinetics",
};

static int word16[] = {
static const int word16[] = {
	1, /* apple */
	1, /* asante */
	1, /* farallon */
@@ -103,7 +108,7 @@ static int word16[] = {
};

/* on which cards do we use NuBus resources? */
static int useresources[] = {
static const int useresources[] = {
	1, /* apple */
	1, /* asante */
	1, /* farallon */
@@ -222,8 +227,10 @@ static enum mac8390_type __init mac8390_ident(struct nubus_dev *dev)
		break;

	case NUBUS_DRSW_DAYNA:
		// These correspond to Dayna Sonic cards
		// which use the macsonic driver
		/*
		 * These correspond to Dayna Sonic cards
		 * which use the macsonic driver
		 */
		if (dev->dr_hw == NUBUS_DRHW_SMC9194 ||
		    dev->dr_hw == NUBUS_DRHW_INTERLAN)
			return MAC8390_NONE;
@@ -281,8 +288,10 @@ static int __init mac8390_memsize(unsigned long membase)
		}
	}
	local_irq_restore(flags);
	/* in any case, we stopped once we tried one block too many,
           or once we reached 32K */
	/*
	 * in any case, we stopped once we tried one block too many,
	 * or once we reached 32K
	 */
	return i * 0x1000;
}

@@ -312,20 +321,23 @@ struct net_device * __init mac8390_probe(int unit)
	if (unit >= 0)
		sprintf(dev->name, "eth%d", unit);

	while ((ndev = nubus_find_type(NUBUS_CAT_NETWORK, NUBUS_TYPE_ETHERNET, ndev))) {
	while ((ndev = nubus_find_type(NUBUS_CAT_NETWORK, NUBUS_TYPE_ETHERNET,
				       ndev))) {
		/* Have we seen it already? */
		if (slots & (1<<ndev->board->slot))
			continue;
		slots |= 1<<ndev->board->slot;

		if ((cardtype = mac8390_ident(ndev)) == MAC8390_NONE)
		cardtype = mac8390_ident(ndev);
		if (cardtype == MAC8390_NONE)
			continue;

		printk_once(KERN_INFO pr_fmt(version));

		dev->irq = SLOT2IRQ(ndev->board->slot);
		/* This is getting to be a habit */
		dev->base_addr = ndev->board->slot_addr | ((ndev->board->slot&0xf) << 20);
		dev->base_addr = (ndev->board->slot_addr |
				  ((ndev->board->slot & 0xf) << 20));

		/* Get some Nubus info - we will trust the card's idea
		   of where its memory and registers are. */
@@ -337,7 +349,7 @@ struct net_device * __init mac8390_probe(int unit)
		}

		/* Get the MAC address */
		if ((nubus_find_rsrc(&dir, NUBUS_RESID_MAC_ADDRESS, &ent)) == -1) {
		if (nubus_find_rsrc(&dir, NUBUS_RESID_MAC_ADDRESS, &ent) == -1) {
			pr_info("%s: Couldn't get MAC address!\n", dev->name);
			continue;
		} else {
@@ -346,7 +358,8 @@ struct net_device * __init mac8390_probe(int unit)

		if (useresources[cardtype] == 1) {
			nubus_rewinddir(&dir);
			if (nubus_find_rsrc(&dir, NUBUS_RESID_MINOR_BASEOS, &ent) == -1) {
			if (nubus_find_rsrc(&dir, NUBUS_RESID_MINOR_BASEOS,
					    &ent) == -1) {
				pr_err("%s: Memory offset resource for slot %X not found!\n",
				       dev->name, ndev->board->slot);
				continue;
@@ -356,7 +369,8 @@ struct net_device * __init mac8390_probe(int unit)
			/* yes, this is how the Apple driver does it */
			dev->base_addr = dev->mem_start + 0x10000;
			nubus_rewinddir(&dir);
			if (nubus_find_rsrc(&dir, NUBUS_RESID_MINOR_LENGTH, &ent) == -1) {
			if (nubus_find_rsrc(&dir, NUBUS_RESID_MINOR_LENGTH,
					    &ent) == -1) {
				pr_info("%s: Memory length resource for slot %X not found, probing\n",
					dev->name, ndev->board->slot);
				offset = mac8390_memsize(dev->mem_start);
@@ -485,7 +499,8 @@ static const struct net_device_ops mac8390_netdev_ops = {
#endif
};

static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * ndev,
static int __init mac8390_initdev(struct net_device *dev,
				  struct nubus_dev *ndev,
				  enum mac8390_type type)
{
	static u32 fwrd4_offsets[16] = {
@@ -661,7 +676,8 @@ static void interlan_reset(struct net_device *dev)

/* dayna_memcpy_fromio/dayna_memcpy_toio */
/* directly from daynaport.c by Alan Cox */
static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count)
static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from,
				  int count)
{
	volatile unsigned char *ptr;
	unsigned char *target = to;
@@ -673,8 +689,7 @@ static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, in
		ptr += 2;
		count--;
	}
	while(count>=2)
	{
	while (count >= 2) {
		*(unsigned short *)target = *(unsigned short volatile *)ptr;
		ptr += 4;			/* skip cruft */
		target += 2;
@@ -685,7 +700,8 @@ static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, in
		*target = *ptr;
}

static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count)
static void dayna_memcpy_tocard(struct net_device *dev, int to,
				const void *from, int count)
{
	volatile unsigned short *ptr;
	const unsigned char *src = from;
@@ -697,16 +713,14 @@ static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from
		ptr++;
		count--;
	}
	while(count>=2)
	{
	while (count >= 2) {
		*ptr++ = *(unsigned short *)src;	/* Copy and */
		ptr++;			/* skip cruft */
		src += 2;
		count -= 2;
	}
	/* Trailing byte? */
	if(count)
	{
	if (count) {
		/* card doesn't like byte writes */
		*ptr = (*ptr & 0x00FF) | (*src << 8);
	}
@@ -731,11 +745,14 @@ static void sane_block_input(struct net_device *dev, int count,
	if (xfer_start + count > ei_status.rmem_end) {
		/* We must wrap the input move. */
		int semi_count = ei_status.rmem_end - xfer_start;
		memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base, semi_count);
		memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base,
			      semi_count);
		count -= semi_count;
		memcpy_toio(skb->data + semi_count, (char *)ei_status.rmem_start, count);
		memcpy_toio(skb->data + semi_count,
			    (char *)ei_status.rmem_start, count);
	} else {
		memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base, count);
		memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base,
			      count);
	}
}

@@ -748,7 +765,8 @@ static void sane_block_output(struct net_device *dev, int count,
}

/* dayna block input/output */
static void dayna_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
static void dayna_get_8390_hdr(struct net_device *dev,
			       struct e8390_pkt_hdr *hdr, int ring_page)
{
	unsigned long hdr_start = (ring_page - WD_START_PG)<<8;

@@ -757,7 +775,8 @@ static void dayna_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr
	hdr->count = (hdr->count & 0xFF) << 8 | (hdr->count >> 8);
}

static void dayna_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
static void dayna_block_input(struct net_device *dev, int count,
			      struct sk_buff *skb, int ring_offset)
{
	unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
	unsigned long xfer_start = xfer_base+dev->mem_start;
@@ -765,8 +784,7 @@ static void dayna_block_input(struct net_device *dev, int count, struct sk_buff
	/* Note the offset math is done in card memory space which is word
	   per long onto our space. */

	if (xfer_start + count > ei_status.rmem_end)
	{
	if (xfer_start + count > ei_status.rmem_end) {
		/* We must wrap the input move. */
		int semi_count = ei_status.rmem_end - xfer_start;
		dayna_memcpy_fromcard(dev, skb->data, xfer_base, semi_count);
@@ -774,14 +792,13 @@ static void dayna_block_input(struct net_device *dev, int count, struct sk_buff
		dayna_memcpy_fromcard(dev, skb->data + semi_count,
				      ei_status.rmem_start - dev->mem_start,
				      count);
	}
	else
	{
	} else {
		dayna_memcpy_fromcard(dev, skb->data, xfer_base, count);
	}
}

static void dayna_block_output(struct net_device *dev, int count, const unsigned char *buf,
static void dayna_block_output(struct net_device *dev, int count,
			       const unsigned char *buf,
			       int start_page)
{
	long shmem = (start_page - WD_START_PG)<<8;
@@ -790,7 +807,8 @@ static void dayna_block_output(struct net_device *dev, int count, const unsigned
}

/* Cabletron block I/O */
static void slow_sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
static void slow_sane_get_8390_hdr(struct net_device *dev,
				   struct e8390_pkt_hdr *hdr,
				   int ring_page)
{
	unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
@@ -799,14 +817,13 @@ static void slow_sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr
	hdr->count = (hdr->count&0xFF)<<8|(hdr->count>>8);
}

static void slow_sane_block_input(struct net_device *dev, int count, struct sk_buff *skb,
	int ring_offset)
static void slow_sane_block_input(struct net_device *dev, int count,
				  struct sk_buff *skb, int ring_offset)
{
	unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
	unsigned long xfer_start = xfer_base+dev->mem_start;

	if (xfer_start + count > ei_status.rmem_end)
	{
	if (xfer_start + count > ei_status.rmem_end) {
		/* We must wrap the input move. */
		int semi_count = ei_status.rmem_end - xfer_start;
		word_memcpy_fromcard(skb->data,
@@ -815,16 +832,14 @@ static void slow_sane_block_input(struct net_device *dev, int count, struct sk_b
		count -= semi_count;
		word_memcpy_fromcard(skb->data + semi_count,
				     (char *)ei_status.rmem_start, count);
	}
	else
	{
	} else {
		word_memcpy_fromcard(skb->data,
				     (char *)dev->mem_start + xfer_base, count);
	}
}

static void slow_sane_block_output(struct net_device *dev, int count, const unsigned char *buf,
	int start_page)
static void slow_sane_block_output(struct net_device *dev, int count,
				   const unsigned char *buf, int start_page)
{
	long shmem = (start_page - WD_START_PG)<<8;