Commit 7aef06db authored by Roberto Medina's avatar Roberto Medina Committed by David S. Miller

net: ethernet: realtek: atp: checkpatch errors and warnings corrected

Several warnings and errors of coding style rules corrected.
Compile tested.
Signed-off-by: default avatarRoberto Medina <robertoxmed@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 432c856f
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
/* The header prepended to received packets. */ /* The header prepended to received packets. */
struct rx_header { struct rx_header {
ushort pad; /* Pad. */ ushort pad; /* Pad. */
ushort rx_count; ushort rx_count;
ushort rx_status; /* Unknown bit assignments :-<. */ ushort rx_status; /* Unknown bit assignments :-<. */
ushort cur_addr; /* Apparently the current buffer address(?) */ ushort cur_addr; /* Apparently the current buffer address(?) */
}; };
#define PAR_DATA 0 #define PAR_DATA 0
...@@ -29,22 +29,25 @@ struct rx_header { ...@@ -29,22 +29,25 @@ struct rx_header {
#define RdAddr 0xC0 #define RdAddr 0xC0
#define HNib 0x10 #define HNib 0x10
enum page0_regs enum page0_regs {
{ /* The first six registers hold
/* The first six registers hold the ethernet physical station address. */ * the ethernet physical station address.
PAR0 = 0, PAR1 = 1, PAR2 = 2, PAR3 = 3, PAR4 = 4, PAR5 = 5, */
TxCNT0 = 6, TxCNT1 = 7, /* The transmit byte count. */ PAR0 = 0, PAR1 = 1, PAR2 = 2, PAR3 = 3, PAR4 = 4, PAR5 = 5,
TxSTAT = 8, RxSTAT = 9, /* Tx and Rx status. */ TxCNT0 = 6, TxCNT1 = 7, /* The transmit byte count. */
ISR = 10, IMR = 11, /* Interrupt status and mask. */ TxSTAT = 8, RxSTAT = 9, /* Tx and Rx status. */
CMR1 = 12, /* Command register 1. */ ISR = 10, IMR = 11, /* Interrupt status and mask. */
CMR2 = 13, /* Command register 2. */ CMR1 = 12, /* Command register 1. */
MODSEL = 14, /* Mode select register. */ CMR2 = 13, /* Command register 2. */
MAR = 14, /* Memory address register (?). */ MODSEL = 14, /* Mode select register. */
CMR2_h = 0x1d, }; MAR = 14, /* Memory address register (?). */
CMR2_h = 0x1d,
enum eepage_regs };
{ PROM_CMD = 6, PROM_DATA = 7 }; /* Note that PROM_CMD is in the "high" bits. */
enum eepage_regs {
PROM_CMD = 6,
PROM_DATA = 7 /* Note that PROM_CMD is in the "high" bits. */
};
#define ISR_TxOK 0x01 #define ISR_TxOK 0x01
#define ISR_RxOK 0x04 #define ISR_RxOK 0x04
...@@ -72,141 +75,146 @@ enum eepage_regs ...@@ -72,141 +75,146 @@ enum eepage_regs
#define CMR2h_Normal 2 /* Accept physical and broadcast address. */ #define CMR2h_Normal 2 /* Accept physical and broadcast address. */
#define CMR2h_PROMISC 3 /* Promiscuous mode. */ #define CMR2h_PROMISC 3 /* Promiscuous mode. */
/* An inline function used below: it differs from inb() by explicitly return an unsigned /* An inline function used below: it differs from inb() by explicitly
char, saving a truncation. */ * return an unsigned char, saving a truncation.
*/
static inline unsigned char inbyte(unsigned short port) static inline unsigned char inbyte(unsigned short port)
{ {
unsigned char _v; unsigned char _v;
__asm__ __volatile__ ("inb %w1,%b0" :"=a" (_v):"d" (port));
return _v; __asm__ __volatile__ ("inb %w1,%b0" : "=a" (_v) : "d" (port));
return _v;
} }
/* Read register OFFSET. /* Read register OFFSET.
This command should always be terminated with read_end(). */ * This command should always be terminated with read_end().
*/
static inline unsigned char read_nibble(short port, unsigned char offset) static inline unsigned char read_nibble(short port, unsigned char offset)
{ {
unsigned char retval; unsigned char retval;
outb(EOC+offset, port + PAR_DATA);
outb(RdAddr+offset, port + PAR_DATA); outb(EOC+offset, port + PAR_DATA);
inbyte(port + PAR_STATUS); /* Settling time delay */ outb(RdAddr+offset, port + PAR_DATA);
retval = inbyte(port + PAR_STATUS); inbyte(port + PAR_STATUS); /* Settling time delay */
outb(EOC+offset, port + PAR_DATA); retval = inbyte(port + PAR_STATUS);
outb(EOC+offset, port + PAR_DATA);
return retval;
return retval;
} }
/* Functions for bulk data read. The interrupt line is always disabled. */ /* Functions for bulk data read. The interrupt line is always disabled. */
/* Get a byte using read mode 0, reading data from the control lines. */ /* Get a byte using read mode 0, reading data from the control lines. */
static inline unsigned char read_byte_mode0(short ioaddr) static inline unsigned char read_byte_mode0(short ioaddr)
{ {
unsigned char low_nib; unsigned char low_nib;
outb(Ctrl_LNibRead, ioaddr + PAR_CONTROL); outb(Ctrl_LNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS); inbyte(ioaddr + PAR_STATUS);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f; low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(Ctrl_HNibRead, ioaddr + PAR_CONTROL); outb(Ctrl_HNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS); /* Settling time delay -- needed! */ inbyte(ioaddr + PAR_STATUS); /* Settling time delay -- needed! */
inbyte(ioaddr + PAR_STATUS); /* Settling time delay -- needed! */ inbyte(ioaddr + PAR_STATUS); /* Settling time delay -- needed! */
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0); return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
} }
/* The same as read_byte_mode0(), but does multiple inb()s for stability. */ /* The same as read_byte_mode0(), but does multiple inb()s for stability. */
static inline unsigned char read_byte_mode2(short ioaddr) static inline unsigned char read_byte_mode2(short ioaddr)
{ {
unsigned char low_nib; unsigned char low_nib;
outb(Ctrl_LNibRead, ioaddr + PAR_CONTROL); outb(Ctrl_LNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS); inbyte(ioaddr + PAR_STATUS);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f; low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(Ctrl_HNibRead, ioaddr + PAR_CONTROL); outb(Ctrl_HNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS); /* Settling time delay -- needed! */ inbyte(ioaddr + PAR_STATUS); /* Settling time delay -- needed! */
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0); return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
} }
/* Read a byte through the data register. */ /* Read a byte through the data register. */
static inline unsigned char read_byte_mode4(short ioaddr) static inline unsigned char read_byte_mode4(short ioaddr)
{ {
unsigned char low_nib; unsigned char low_nib;
outb(RdAddr | MAR, ioaddr + PAR_DATA); outb(RdAddr | MAR, ioaddr + PAR_DATA);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f; low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(RdAddr | HNib | MAR, ioaddr + PAR_DATA); outb(RdAddr | HNib | MAR, ioaddr + PAR_DATA);
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0); return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
} }
/* Read a byte through the data register, double reading to allow settling. */ /* Read a byte through the data register, double reading to allow settling. */
static inline unsigned char read_byte_mode6(short ioaddr) static inline unsigned char read_byte_mode6(short ioaddr)
{ {
unsigned char low_nib; unsigned char low_nib;
outb(RdAddr | MAR, ioaddr + PAR_DATA); outb(RdAddr | MAR, ioaddr + PAR_DATA);
inbyte(ioaddr + PAR_STATUS); inbyte(ioaddr + PAR_STATUS);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f; low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(RdAddr | HNib | MAR, ioaddr + PAR_DATA); outb(RdAddr | HNib | MAR, ioaddr + PAR_DATA);
inbyte(ioaddr + PAR_STATUS); inbyte(ioaddr + PAR_STATUS);
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0); return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
} }
static inline void static inline void
write_reg(short port, unsigned char reg, unsigned char value) write_reg(short port, unsigned char reg, unsigned char value)
{ {
unsigned char outval; unsigned char outval;
outb(EOC | reg, port + PAR_DATA);
outval = WrAddr | reg; outb(EOC | reg, port + PAR_DATA);
outb(outval, port + PAR_DATA); outval = WrAddr | reg;
outb(outval, port + PAR_DATA); /* Double write for PS/2. */ outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA); /* Double write for PS/2. */
outval &= 0xf0;
outval |= value; outval &= 0xf0;
outb(outval, port + PAR_DATA); outval |= value;
outval &= 0x1f; outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA); outval &= 0x1f;
outb(outval, port + PAR_DATA); outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA);
outb(EOC | outval, port + PAR_DATA);
outb(EOC | outval, port + PAR_DATA);
} }
static inline void static inline void
write_reg_high(short port, unsigned char reg, unsigned char value) write_reg_high(short port, unsigned char reg, unsigned char value)
{ {
unsigned char outval = EOC | HNib | reg; unsigned char outval = EOC | HNib | reg;
outb(outval, port + PAR_DATA); outb(outval, port + PAR_DATA);
outval &= WrAddr | HNib | 0x0f; outval &= WrAddr | HNib | 0x0f;
outb(outval, port + PAR_DATA); outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA); /* Double write for PS/2. */ outb(outval, port + PAR_DATA); /* Double write for PS/2. */
outval = WrAddr | HNib | value; outval = WrAddr | HNib | value;
outb(outval, port + PAR_DATA); outb(outval, port + PAR_DATA);
outval &= HNib | 0x0f; /* HNib | value */ outval &= HNib | 0x0f; /* HNib | value */
outb(outval, port + PAR_DATA); outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA); outb(outval, port + PAR_DATA);
outb(EOC | HNib | outval, port + PAR_DATA); outb(EOC | HNib | outval, port + PAR_DATA);
} }
/* Write a byte out using nibble mode. The low nibble is written first. */ /* Write a byte out using nibble mode. The low nibble is written first. */
static inline void static inline void
write_reg_byte(short port, unsigned char reg, unsigned char value) write_reg_byte(short port, unsigned char reg, unsigned char value)
{ {
unsigned char outval; unsigned char outval;
outb(EOC | reg, port + PAR_DATA); /* Reset the address register. */
outval = WrAddr | reg; outb(EOC | reg, port + PAR_DATA); /* Reset the address register. */
outb(outval, port + PAR_DATA); outval = WrAddr | reg;
outb(outval, port + PAR_DATA); /* Double write for PS/2. */ outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA); /* Double write for PS/2. */
outb((outval & 0xf0) | (value & 0x0f), port + PAR_DATA);
outb(value & 0x0f, port + PAR_DATA); outb((outval & 0xf0) | (value & 0x0f), port + PAR_DATA);
value >>= 4; outb(value & 0x0f, port + PAR_DATA);
outb(value, port + PAR_DATA); value >>= 4;
outb(0x10 | value, port + PAR_DATA); outb(value, port + PAR_DATA);
outb(0x10 | value, port + PAR_DATA); outb(0x10 | value, port + PAR_DATA);
outb(0x10 | value, port + PAR_DATA);
outb(EOC | value, port + PAR_DATA); /* Reset the address register. */
outb(EOC | value, port + PAR_DATA); /* Reset the address register. */
} }
/* /* Bulk data writes to the packet buffer. The interrupt line remains enabled.
* Bulk data writes to the packet buffer. The interrupt line remains enabled.
* The first, faster method uses only the dataport (data modes 0, 2 & 4). * The first, faster method uses only the dataport (data modes 0, 2 & 4).
* The second (backup) method uses data and control regs (modes 1, 3 & 5). * The second (backup) method uses data and control regs (modes 1, 3 & 5).
* It should only be needed when there is skew between the individual data * It should only be needed when there is skew between the individual data
...@@ -214,28 +222,28 @@ write_reg_byte(short port, unsigned char reg, unsigned char value) ...@@ -214,28 +222,28 @@ write_reg_byte(short port, unsigned char reg, unsigned char value)
*/ */
static inline void write_byte_mode0(short ioaddr, unsigned char value) static inline void write_byte_mode0(short ioaddr, unsigned char value)
{ {
outb(value & 0x0f, ioaddr + PAR_DATA); outb(value & 0x0f, ioaddr + PAR_DATA);
outb((value>>4) | 0x10, ioaddr + PAR_DATA); outb((value>>4) | 0x10, ioaddr + PAR_DATA);
} }
static inline void write_byte_mode1(short ioaddr, unsigned char value) static inline void write_byte_mode1(short ioaddr, unsigned char value)
{ {
outb(value & 0x0f, ioaddr + PAR_DATA); outb(value & 0x0f, ioaddr + PAR_DATA);
outb(Ctrl_IRQEN | Ctrl_LNibWrite, ioaddr + PAR_CONTROL); outb(Ctrl_IRQEN | Ctrl_LNibWrite, ioaddr + PAR_CONTROL);
outb((value>>4) | 0x10, ioaddr + PAR_DATA); outb((value>>4) | 0x10, ioaddr + PAR_DATA);
outb(Ctrl_IRQEN | Ctrl_HNibWrite, ioaddr + PAR_CONTROL); outb(Ctrl_IRQEN | Ctrl_HNibWrite, ioaddr + PAR_CONTROL);
} }
/* Write 16bit VALUE to the packet buffer: the same as above just doubled. */ /* Write 16bit VALUE to the packet buffer: the same as above just doubled. */
static inline void write_word_mode0(short ioaddr, unsigned short value) static inline void write_word_mode0(short ioaddr, unsigned short value)
{ {
outb(value & 0x0f, ioaddr + PAR_DATA); outb(value & 0x0f, ioaddr + PAR_DATA);
value >>= 4; value >>= 4;
outb((value & 0x0f) | 0x10, ioaddr + PAR_DATA); outb((value & 0x0f) | 0x10, ioaddr + PAR_DATA);
value >>= 4; value >>= 4;
outb(value & 0x0f, ioaddr + PAR_DATA); outb(value & 0x0f, ioaddr + PAR_DATA);
value >>= 4; value >>= 4;
outb((value & 0x0f) | 0x10, ioaddr + PAR_DATA); outb((value & 0x0f) | 0x10, ioaddr + PAR_DATA);
} }
/* EEPROM_Ctrl bits. */ /* EEPROM_Ctrl bits. */
...@@ -248,10 +256,10 @@ static inline void write_word_mode0(short ioaddr, unsigned short value) ...@@ -248,10 +256,10 @@ static inline void write_word_mode0(short ioaddr, unsigned short value)
/* Delay between EEPROM clock transitions. */ /* Delay between EEPROM clock transitions. */
#define eeprom_delay(ticks) \ #define eeprom_delay(ticks) \
do { int _i = 40; while (--_i > 0) { __SLOW_DOWN_IO; }} while (0) do { int _i = 40; while (--_i > 0) { __SLOW_DOWN_IO; } } while (0)
/* The EEPROM commands include the alway-set leading bit. */ /* The EEPROM commands include the alway-set leading bit. */
#define EE_WRITE_CMD(offset) (((5 << 6) + (offset)) << 17) #define EE_WRITE_CMD(offset) (((5 << 6) + (offset)) << 17)
#define EE_READ(offset) (((6 << 6) + (offset)) << 17) #define EE_READ(offset) (((6 << 6) + (offset)) << 17)
#define EE_ERASE(offset) (((7 << 6) + (offset)) << 17) #define EE_ERASE(offset) (((7 << 6) + (offset)) << 17)
#define EE_CMD_SIZE 27 /* The command+address+data size. */ #define EE_CMD_SIZE 27 /* The command+address+data size. */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment