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

Commit c659c38b authored by Sakari Ailus's avatar Sakari Ailus Committed by David S. Miller
Browse files

tlan: Code cleanup: checkpatch.pl is relatively happy now.



- Remove CamelCase.
- Convert hexadecimals to lower case.
- Remove useless comments. Tlan driver contained a name of the function at
  the end of it in a comment. Remove those comments.
- Remove local typedefs. Use real types instead of typedefs in code.
- Resolve space issues and reindent.
- One warning remain, it's a case where printing a single line involves a
  number of printk()s.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c445477d
Loading
Loading
Loading
Loading
+1869 −1834

File changed.

Preview size limit exceeded, changes collapsed.

+98 −94
Original line number Diff line number Diff line
@@ -20,8 +20,8 @@
 ********************************************************************/


#include <asm/io.h>
#include <asm/types.h>
#include <linux/io.h>
#include <linux/types.h>
#include <linux/netdevice.h>


@@ -41,7 +41,10 @@
#define TLAN_RECORD		1

#define TLAN_DBG(lvl, format, args...)					\
	do { if (debug&lvl) printk(KERN_DEBUG "TLAN: " format, ##args ); } while(0)
	do {								\
		if (debug&lvl)						\
			printk(KERN_DEBUG "TLAN: " format, ##args);	\
	} while (0)

#define TLAN_DEBUG_GNRL		0x0001
#define TLAN_DEBUG_TX		0x0002
@@ -50,7 +53,8 @@
#define TLAN_DEBUG_PROBE	0x0010

#define TX_TIMEOUT		(10*HZ)	 /* We need time for auto-neg */
#define MAX_TLAN_BOARDS		8	 /* Max number of boards installed at a time */
#define MAX_TLAN_BOARDS		8	 /* Max number of boards installed
					    at a time */


	/*****************************************************************
@@ -70,13 +74,13 @@
#define PCI_DEVICE_ID_OLICOM_OC2326			0x0014
#endif

typedef struct tlan_adapter_entry {
	u16	vendorId;
	u16	deviceId;
	char	*deviceLabel;
struct tlan_adapter_entry {
	u16	vendor_id;
	u16	device_id;
	char	*device_label;
	u32	flags;
	u16	addrOfs;
} TLanAdapterEntry;
	u16	addr_ofs;
};

#define TLAN_ADAPTER_NONE		0x00000000
#define TLAN_ADAPTER_UNMANAGED_PHY	0x00000001
@@ -129,18 +133,18 @@ typedef struct tlan_adapter_entry {
#define TLAN_CSTAT_DP_PR	0x0100


typedef struct tlan_buffer_ref_tag {
struct tlan_buffer {
	u32	count;
	u32	address;
} TLanBufferRef;
};


typedef struct tlan_list_tag {
struct tlan_list {
	u32		forward;
	u16		cStat;
	u16		frameSize;
	TLanBufferRef	buffer[TLAN_BUFFERS_PER_LIST];
} TLanList;
	u16		c_stat;
	u16		frame_size;
	struct tlan_buffer buffer[TLAN_BUFFERS_PER_LIST];
};


typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
@@ -164,49 +168,49 @@ typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
	 *
	 ****************************************************************/

typedef struct tlan_private_tag {
	struct net_device       *nextDevice;
	struct pci_dev		*pciDev;
struct tlan_priv {
	struct net_device       *next_device;
	struct pci_dev		*pci_dev;
	struct net_device       *dev;
	void			*dmaStorage;
	dma_addr_t		dmaStorageDMA;
	unsigned int		dmaSize;
	u8			*padBuffer;
	TLanList                *rxList;
	dma_addr_t		rxListDMA;
	u8			*rxBuffer;
	dma_addr_t		rxBufferDMA;
	u32                     rxHead;
	u32                     rxTail;
	u32			rxEocCount;
	TLanList                *txList;
	dma_addr_t		txListDMA;
	u8			*txBuffer;
	dma_addr_t		txBufferDMA;
	u32                     txHead;
	u32                     txInProgress;
	u32                     txTail;
	u32			txBusyCount;
	u32                     phyOnline;
	u32			timerSetAt;
	u32			timerType;
	void			*dma_storage;
	dma_addr_t		dma_storage_dma;
	unsigned int		dma_size;
	u8			*pad_buffer;
	struct tlan_list	*rx_list;
	dma_addr_t		rx_list_dma;
	u8			*rx_buffer;
	dma_addr_t		rx_buffer_dma;
	u32			rx_head;
	u32			rx_tail;
	u32			rx_eoc_count;
	struct tlan_list	*tx_list;
	dma_addr_t		tx_list_dma;
	u8			*tx_buffer;
	dma_addr_t		tx_buffer_dma;
	u32			tx_head;
	u32			tx_in_progress;
	u32			tx_tail;
	u32			tx_busy_count;
	u32			phy_online;
	u32			timer_set_at;
	u32			timer_type;
	struct timer_list	timer;
	struct board		*adapter;
	u32			adapterRev;
	u32			adapter_rev;
	u32			aui;
	u32			debug;
	u32			duplex;
	u32			phy[2];
	u32			phyNum;
	u32			phy_num;
	u32			speed;
	u8			tlanRev;
	u8			tlanFullDuplex;
	u8			tlan_rev;
	u8			tlan_full_duplex;
	spinlock_t		lock;
	u8			link;
	u8			is_eisa;
	struct work_struct			tlan_tqueue;
	u8			neg_be_verbose;
} TLanPrivateInfo;
};



@@ -439,37 +443,37 @@ typedef struct tlan_private_tag {

/* Routines to access internal registers. */

static inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
static inline u8 tlan_dio_read8(u16 base_addr, u16 internal_addr)
{
	outw(internal_addr, base_addr + TLAN_DIO_ADR);
	return inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3));

} /* TLan_DioRead8 */
}




static inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
static inline u16 tlan_dio_read16(u16 base_addr, u16 internal_addr)
{
	outw(internal_addr, base_addr + TLAN_DIO_ADR);
	return inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2));

} /* TLan_DioRead16 */
}




static inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
static inline u32 tlan_dio_read32(u16 base_addr, u16 internal_addr)
{
	outw(internal_addr, base_addr + TLAN_DIO_ADR);
	return inl(base_addr + TLAN_DIO_DATA);

} /* TLan_DioRead32 */
}




static inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
static inline void tlan_dio_write8(u16 base_addr, u16 internal_addr, u8 data)
{
	outw(internal_addr, base_addr + TLAN_DIO_ADR);
	outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
@@ -479,7 +483,7 @@ static inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)



static inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
static inline void tlan_dio_write16(u16 base_addr, u16 internal_addr, u16 data)
{
	outw(internal_addr, base_addr + TLAN_DIO_ADR);
	outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
@@ -489,16 +493,16 @@ static inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)



static inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
static inline void tlan_dio_write32(u16 base_addr, u16 internal_addr, u32 data)
{
	outw(internal_addr, base_addr + TLAN_DIO_ADR);
	outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));

}

#define TLan_ClearBit( bit, port )	outb_p(inb_p(port) & ~bit, port)
#define TLan_GetBit( bit, port )	((int) (inb_p(port) & bit))
#define TLan_SetBit( bit, port )	outb_p(inb_p(port) | bit, port)
#define tlan_clear_bit(bit, port)	outb_p(inb_p(port) & ~bit, port)
#define tlan_get_bit(bit, port)	((int) (inb_p(port) & bit))
#define tlan_set_bit(bit, port)	outb_p(inb_p(port) | bit, port)

/*
 * given 6 bytes, view them as 8 6-bit numbers and return the XOR of those
@@ -526,7 +530,7 @@ static inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
 *		      DA(a,35), DA(a,41), DA(a,47)) << 5;
 *
 */
static inline u32 TLan_HashFunc( const u8 *a )
static inline u32 tlan_hash_func(const u8 *a)
{
	u8     hash;